.save-skin, better .give, interactionMenu, cate...

This commit is contained in:
Cloudburst
2021-04-27 11:43:16 +02:00
parent a9bfe215fa
commit 2a05c8d0ce
23 changed files with 2369 additions and 299 deletions

View File

@@ -0,0 +1,60 @@
package cloudburst.rejects.modules;
import cloudburst.rejects.MeteorRejectsAddon;
import meteordevelopment.orbit.EventHandler;
import minegame159.meteorclient.events.packets.PacketEvent;
import minegame159.meteorclient.settings.BoolSetting;
import minegame159.meteorclient.settings.Setting;
import minegame159.meteorclient.settings.SettingGroup;
import minegame159.meteorclient.systems.modules.Categories;
import minegame159.meteorclient.systems.modules.Module;
import net.minecraft.block.BedBlock;
import net.minecraft.block.Blocks;
import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
public class AntiSpawnpoint extends Module {
private SettingGroup sgDefault = settings.getDefaultGroup();
private Setting<Boolean> fakeUse = sgDefault.add(new BoolSetting.Builder()
.name("fake-use")
.description("Fake using the bed or anchor.")
.defaultValue(true)
.build()
);
public AntiSpawnpoint() {
super(MeteorRejectsAddon.CATEGORY, "anti-spawnpoint", "Protects the player from losing the respawn point.");
}
@EventHandler
private void onSendPacket(PacketEvent.Send event) {
if (mc.world == null) return;
if(!(event.packet instanceof PlayerInteractBlockC2SPacket)) return;
BlockPos blockPos = ((PlayerInteractBlockC2SPacket) event.packet).getBlockHitResult().getBlockPos();
boolean IsOverWorld = mc.world.getDimension().isBedWorking();
boolean IsNetherWorld = mc.world.getDimension().isRespawnAnchorWorking();
boolean BlockIsBed = mc.world.getBlockState(blockPos).getBlock() instanceof BedBlock;
boolean BlockIsAnchor = mc.world.getBlockState(blockPos).getBlock().equals(Blocks.RESPAWN_ANCHOR);
if (fakeUse.get()) {
if (BlockIsBed && IsOverWorld) {
mc.player.swingHand(Hand.MAIN_HAND);
mc.player.updatePosition(blockPos.getX(),blockPos.up().getY(),blockPos.getZ());
}
else if (BlockIsAnchor && IsNetherWorld) {
mc.player.swingHand(Hand.MAIN_HAND);
}
}
//
if((BlockIsBed && IsOverWorld)||(BlockIsAnchor && IsNetherWorld)) {
event.cancel();
}
}
}