Added BlockIn (selftrap + surround + any block)

This commit is contained in:
StormyBytes
2021-07-18 12:17:22 +07:00
parent 5c97e9f5f4
commit b5f720edc2
2 changed files with 211 additions and 64 deletions

View File

@@ -23,68 +23,69 @@ import org.apache.logging.log4j.Logger;
import java.lang.invoke.MethodHandles;
public class MeteorRejectsAddon extends MeteorAddon {
public static final Logger LOG = LogManager.getLogger();
public static final Category CATEGORY = new Category("Rejects", Items.BARRIER.getDefaultStack());
public static final Logger LOG = LogManager.getLogger();
public static final Category CATEGORY = new Category("Rejects", Items.BARRIER.getDefaultStack());
@Override
public void onInitialize() {
LOG.info("Initializing Meteor Rejects Addon");
@Override
public void onInitialize() {
LOG.info("Initializing Meteor Rejects Addon");
MeteorClient.EVENT_BUS.registerLambdaFactory("cloudburst.rejects", (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup()));
MeteorClient.EVENT_BUS.registerLambdaFactory("cloudburst.rejects", (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup()));
Utils.init();
GiveUtils.init();
Utils.init();
GiveUtils.init();
Modules modules = Modules.get();
modules.add(new AntiBot());
modules.add(new AntiSpawnpoint());
modules.add(new AntiVanish());
modules.add(new Auto32K());
modules.add(new AutoBedTrap());
modules.add(new AutoExtinguish());
modules.add(new AutoEz());
modules.add(new AutoHighway());
modules.add(new AutoPot());
modules.add(new AutoTNT());
modules.add(new AutoWither());
modules.add(new BoatGlitch());
modules.add(new BoatPhase());
modules.add(new Boost());
modules.add(new ColorSigns());
modules.add(new Confuse());
modules.add(new CoordLogger());
modules.add(new InteractionMenu());
modules.add(new Lavacast());
modules.add(new NewChunks());
modules.add(new ObsidianFarm());
modules.add(new PacketFly());
modules.add(new Painter());
modules.add(new Phase());
modules.add(new Rendering());
modules.add(new SkeletonESP());
modules.add(new SoundLocator());
Modules modules = Modules.get();
modules.add(new AntiBot());
modules.add(new AntiSpawnpoint());
modules.add(new AntiVanish());
modules.add(new Auto32K());
modules.add(new AutoBedTrap());
modules.add(new AutoExtinguish());
modules.add(new AutoEz());
modules.add(new AutoHighway());
modules.add(new AutoPot());
modules.add(new AutoTNT());
modules.add(new AutoWither());
modules.add(new BoatGlitch());
modules.add(new BlockIn());
modules.add(new BoatPhase());
modules.add(new Boost());
modules.add(new ColorSigns());
modules.add(new Confuse());
modules.add(new CoordLogger());
modules.add(new InteractionMenu());
modules.add(new Lavacast());
modules.add(new NewChunks());
modules.add(new ObsidianFarm());
modules.add(new PacketFly());
modules.add(new Painter());
modules.add(new Phase());
modules.add(new Rendering());
modules.add(new SkeletonESP());
modules.add(new SoundLocator());
Commands commands = Commands.get();
commands.add(new GhostCommand());
commands.add(new GiveCommand());
commands.add(new SaveSkinCommand());
commands.add(new HeadsCommand());
commands.add(new ServerCommand());
commands.add(new SetBlockCommand());
commands.add(new TeleportCommand());
commands.add(new TerrainExport());
Commands commands = Commands.get();
commands.add(new GhostCommand());
commands.add(new GiveCommand());
commands.add(new SaveSkinCommand());
commands.add(new HeadsCommand());
commands.add(new ServerCommand());
commands.add(new SetBlockCommand());
commands.add(new TeleportCommand());
commands.add(new TerrainExport());
HUD hud = modules.get(HUD.class);
hud.elements.add(new AppleHud(hud));
hud.elements.add(new CrystalHud(hud));
hud.elements.add(new ExpHud(hud));
hud.elements.add(new CpsHud(hud));
HUD hud = modules.get(HUD.class);
hud.elements.add(new AppleHud(hud));
hud.elements.add(new CrystalHud(hud));
hud.elements.add(new ExpHud(hud));
hud.elements.add(new CpsHud(hud));
GuiThemes.add(new MeteorRoundedGuiTheme());
}
GuiThemes.add(new MeteorRoundedGuiTheme());
}
@Override
public void onRegisterCategories() {
Modules.registerCategory(CATEGORY);
}
@Override
public void onRegisterCategories() {
Modules.registerCategory(CATEGORY);
}
}

View File

@@ -0,0 +1,146 @@
package cloudburst.rejects.modules;
import cloudburst.rejects.MeteorRejectsAddon;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.utils.player.FindItemResult;
import meteordevelopment.meteorclient.utils.player.InvUtils;
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
import meteordevelopment.meteorclient.utils.world.BlockUtils;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.block.Block;
import net.minecraft.block.FallingBlock;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
public class BlockIn extends Module {
private final SettingGroup sgGeneral = settings.getDefaultGroup();
private final Setting<Boolean> multiPlace = sgGeneral.add(new BoolSetting.Builder()
.name("multi-place")
.description("Whether to place all blocks in a single tick")
.defaultValue(false)
.build()
);
private final Setting<Boolean> center = sgGeneral.add(new BoolSetting.Builder()
.name("center")
.description("Whether to center to avoid obstructing placement")
.defaultValue(true)
.build()
);
private final Setting<Boolean> rotate = sgGeneral.add(new BoolSetting.Builder()
.name("rotate")
.description("Whether to rotate towards block placements.")
.defaultValue(true)
.build()
);
private final Setting<Boolean> turnOff = sgGeneral.add(new BoolSetting.Builder()
.name("turn-off")
.description("Whether to turn off after finished placing.")
.defaultValue(true)
.build()
);
private final Setting<Boolean> onlyOnGround = sgGeneral.add(new BoolSetting.Builder()
.name("only-on-ground")
.description("Only places when you are standing on blocks (not in midair).")
.defaultValue(true)
.build()
);
private final BlockPos.Mutable bp = new BlockPos.Mutable();
private boolean return_;
public BlockIn() {
super(MeteorRejectsAddon.CATEGORY, "block-in", "Block yourself in using any block.");
}
@EventHandler
private void onPreTick(TickEvent.Pre event) {
if (center.get()) PlayerUtils.centerPlayer();
if (onlyOnGround.get() && !mc.player.isOnGround()) return;
return_ = false;
// Multiplace
if (multiPlace.get()) {
// Bottom
boolean p1 = place(0, -1, 0);
// Lower sides
boolean p2 = place(1, 0, 0);
boolean p3 = place(-1, 0, 0);
boolean p4 = place(0, 0, 1);
boolean p5 = place(0, 0, -1);
// Upper sides
boolean p6 = place(1, 1, 0);
boolean p7 = place(-1, 1, 0);
boolean p8 = place(0, 1, 1);
boolean p9 = place(0, 1, -1);
// Top
boolean p10 = place(0, 2, 0);
// Turn off
if (turnOff.get() && p1 && p2 && p3 && p4 && p5 && p6 && p7 && p8 && p9 && p10) toggle();
// No multiplace
} else {
// Bottom
boolean p1 = place(0, -1, 0);
if (return_) return;
// Lower sides
boolean p2 = place(1, 0, 0);
if (return_) return;
boolean p3 = place(-1, 0, 0);
if (return_) return;
boolean p4 = place(0, 0, 1);
if (return_) return;
boolean p5 = place(0, 0, -1);
if (return_) return;
// Upper sides
boolean p6 = place(1, 1, 0);
if (return_) return;
boolean p7 = place(-1, 1, 0);
if (return_) return;
boolean p8 = place(0, 1, 1);
if (return_) return;
boolean p9 = place(0, 1, -1);
if (return_) return;
// Top
boolean p10 = place(0, 2, 0);
// Turn off
if (turnOff.get() && p1 && p2 && p3 && p4 && p5 && p6 && p7 && p8 && p9 && p10) toggle();
}
}
private boolean place(int x, int y, int z) {
setBlockPos(x, y, z);
FindItemResult findItemResult = InvUtils.findInHotbar(itemStack -> validItem(itemStack, bp));
if (!BlockUtils.canPlace(bp)) return true;
if (BlockUtils.place(bp, findItemResult, rotate.get(), 100, true)) {
return_ = true;
}
return false;
}
private void setBlockPos(int x, int y, int z) {
bp.set(mc.player.getX() + x, mc.player.getY() + y, mc.player.getZ() + z);
}
private boolean validItem(ItemStack itemStack, BlockPos pos) {
if (!(itemStack.getItem() instanceof BlockItem)) return false;
Block block = ((BlockItem) itemStack.getItem()).getBlock();
if (!Block.isShapeFullCube(block.getDefaultState().getCollisionShape(mc.world, pos))) return false;
return !(block instanceof FallingBlock) || !FallingBlock.canFallThrough(mc.world.getBlockState(pos));
}
}