Fixed Spawn Proofer
This commit is contained in:
@@ -41,7 +41,7 @@ public class MeteorRejectsAddon extends MeteorAddon {
|
||||
modules.add(new Rendering());
|
||||
modules.add(new SkeletonESP());
|
||||
modules.add(new SoundLocator());
|
||||
// modules.add(new SpawnProofer());
|
||||
modules.add(new SpawnProofer());
|
||||
|
||||
Commands commands = Commands.get();
|
||||
commands.add(new AntiAntiXrayCommand());
|
||||
|
||||
@@ -92,9 +92,6 @@ public class AutoTNT extends Module {
|
||||
// If there isn't any tnt
|
||||
if (blocks.size() <= 0) {
|
||||
|
||||
// Give a warning
|
||||
error("No TNT in range");
|
||||
|
||||
// If we should just turn off after igniting
|
||||
if (turnOff.get() && ignited) {
|
||||
toggle();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import cloudburst.rejects.utils.WorldUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import minegame159.meteorclient.events.render.RenderEvent;
|
||||
import minegame159.meteorclient.events.world.TickEvent;
|
||||
@@ -10,20 +12,17 @@ import minegame159.meteorclient.settings.*;
|
||||
import minegame159.meteorclient.systems.modules.Module;
|
||||
import minegame159.meteorclient.utils.player.InvUtils;
|
||||
import minegame159.meteorclient.utils.render.color.SettingColor;
|
||||
import minegame159.meteorclient.utils.world.BlockIterator;
|
||||
import minegame159.meteorclient.utils.world.BlockUtils;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.enums.BlockHalf;
|
||||
import net.minecraft.block.enums.SlabType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.LightType;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class SpawnProofer extends Module {
|
||||
@@ -43,7 +42,7 @@ public class SpawnProofer extends Module {
|
||||
private final Setting<List<Block>> blocks = sgGeneral.add(new BlockListSetting.Builder()
|
||||
.name("blocks")
|
||||
.description("Blocks to use for spawn proofing")
|
||||
.defaultValue(Collections.emptyList())
|
||||
.defaultValue(getDefaultBlocks())
|
||||
.build()
|
||||
);
|
||||
|
||||
@@ -75,7 +74,6 @@ public class SpawnProofer extends Module {
|
||||
.build()
|
||||
);
|
||||
|
||||
private final BlockPos.Mutable bp = new BlockPos.Mutable();
|
||||
private final ArrayList<BlockPos> positions = new ArrayList<>();
|
||||
private final MeshBuilder mb = new MeshBuilder();
|
||||
|
||||
@@ -87,15 +85,15 @@ public class SpawnProofer extends Module {
|
||||
private void onTick(TickEvent.Post event) {
|
||||
// Clear and set positions
|
||||
positions.clear();
|
||||
BlockIterator.register(range.get(), range.get(), (blockPos, blockState) -> {
|
||||
if (validSpawn(new BlockPos(blockPos.getX(), blockPos.getY()-1, blockPos.getZ()), blockState)) positions.add(blockPos);
|
||||
});
|
||||
for (BlockPos blockPos : WorldUtils.getSphere(mc.player.getBlockPos(), range.get(), range.get())) {
|
||||
if (validSpawn(blockPos)) positions.add(blockPos);
|
||||
}
|
||||
|
||||
for (BlockPos blockPos : positions) {
|
||||
// Set slot
|
||||
int slot = findSlot();
|
||||
// Place blocks
|
||||
BlockUtils.place(blockPos, Hand.MAIN_HAND, slot, rotate.get(), -50, false, true, true, true);
|
||||
BlockUtils.place(blockPos, Hand.MAIN_HAND, slot, rotate.get(), -50, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +101,7 @@ public class SpawnProofer extends Module {
|
||||
private void onRender(RenderEvent event) {
|
||||
// Render all positions
|
||||
for (BlockPos blockPos : positions) {
|
||||
Renderer.boxWithLines(Renderer.NORMAL, Renderer.LINES, blockPos, sideColor.get(), lineColor.get(), shapeMode.get(), 0);
|
||||
Renderer.boxWithLines(Renderer.NORMAL, Renderer.LINES, blockPos.down(), sideColor.get(), lineColor.get(), shapeMode.get(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,14 +109,15 @@ public class SpawnProofer extends Module {
|
||||
return InvUtils.findItemInHotbar(itemStack -> blocks.get().contains(Block.getBlockFromItem(itemStack.getItem())));
|
||||
}
|
||||
|
||||
private boolean validSpawn(BlockPos blockPos, BlockState blockState) {
|
||||
private boolean validSpawn(BlockPos blockPos) {
|
||||
BlockState blockState = mc.world.getBlockState(blockPos);
|
||||
|
||||
if (blockPos.getY() == 0) return false;
|
||||
if (!(blockState.getBlock() instanceof AirBlock)) return false;
|
||||
|
||||
bp.set(blockPos).move(0, -1, 0);
|
||||
if (!topSurface(mc.world.getBlockState(bp))) {
|
||||
if (mc.world.getBlockState(bp).getCollisionShape(mc.world, bp) != VoxelShapes.fullCube()) return false;
|
||||
if (mc.world.getBlockState(bp).isTranslucent(mc.world, bp)) return false;
|
||||
if (!topSurface(mc.world.getBlockState(blockPos.down()))) {
|
||||
if (mc.world.getBlockState(blockPos.down()).getCollisionShape(mc.world, blockPos.down()) != VoxelShapes.fullCube()) return false;
|
||||
if (mc.world.getBlockState(blockPos.down()).isTranslucent(mc.world, blockPos.down())) return false;
|
||||
}
|
||||
|
||||
if (mc.world.getLightLevel(blockPos, 0) <= 7) return false;
|
||||
@@ -129,4 +128,16 @@ public class SpawnProofer extends Module {
|
||||
if (blockState.getBlock() instanceof SlabBlock && blockState.get(SlabBlock.TYPE) == SlabType.TOP) return true;
|
||||
else return blockState.getBlock() instanceof StairsBlock && blockState.get(StairsBlock.HALF) == BlockHalf.TOP;
|
||||
}
|
||||
|
||||
private List<Block> getDefaultBlocks() {
|
||||
List<Block> defaultBlocks = new ArrayList<>();
|
||||
|
||||
for (Block block : Registry.BLOCK) {
|
||||
if (block instanceof SlabBlock) defaultBlocks.add(block);
|
||||
if (block instanceof AbstractButtonBlock) defaultBlocks.add(block);
|
||||
if (block instanceof TorchBlock) defaultBlocks.add(block);
|
||||
}
|
||||
|
||||
return defaultBlocks;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user