use of net.minecraft.util.math.Box in project BleachHack by BleachDrinker420.
the class NewChunks method onWorldRender.
@BleachSubscribe
public void onWorldRender(EventWorldRender.Post event) {
int renderY = mc.world.getBottomY() + getSetting(0).asSlider().getValueInt();
int opacity = (int) (getSetting(2).asToggle().getChild(0).asSlider().getValueFloat() * 255);
if (getSetting(3).asToggle().getState()) {
int[] color = getSetting(3).asToggle().getChild(0).asColor().getRGBArray();
QuadColor outlineColor = QuadColor.single(color[0], color[1], color[2], 255);
QuadColor fillColor = QuadColor.single(color[0], color[1], color[2], opacity);
synchronized (newChunks) {
for (ChunkPos c : newChunks) {
if (mc.getCameraEntity().getBlockPos().isWithinDistance(c.getStartPos(), 1024)) {
Box box = new Box(c.getStartX(), renderY, c.getStartZ(), c.getStartX() + 16, renderY, c.getStartZ() + 16);
if (getSetting(2).asToggle().getState()) {
Renderer.drawBoxFill(box, fillColor, SKIP_DIRS);
}
Renderer.drawBoxOutline(box, outlineColor, 2f, SKIP_DIRS);
}
}
}
}
if (getSetting(4).asToggle().getState()) {
int[] color = getSetting(4).asToggle().getChild(0).asColor().getRGBArray();
QuadColor outlineColor = QuadColor.single(color[0], color[1], color[2], 255);
QuadColor fillColor = QuadColor.single(color[0], color[1], color[2], opacity);
synchronized (oldChunks) {
for (ChunkPos c : oldChunks) {
if (mc.getCameraEntity().getBlockPos().isWithinDistance(c.getStartPos(), 1024)) {
Box box = new Box(c.getStartX(), renderY, c.getStartZ(), c.getStartX() + 16, renderY, c.getStartZ() + 16);
if (getSetting(2).asToggle().getState()) {
Renderer.drawBoxFill(box, fillColor, SKIP_DIRS);
}
Renderer.drawBoxOutline(box, outlineColor, 2f, SKIP_DIRS);
}
}
}
}
}
use of net.minecraft.util.math.Box in project BleachHack by BleachDrinker420.
the class BlockHighlight method onWorldRender.
@BleachSubscribe
public void onWorldRender(EventWorldRender.Post event) {
int mode = getSetting(0).asMode().getMode();
if (!(mc.crosshairTarget instanceof BlockHitResult))
return;
BlockPos pos = ((BlockHitResult) mc.crosshairTarget).getBlockPos();
BlockState state = mc.world.getBlockState(pos);
if (state.getMaterial() == Material.AIR || !mc.world.getWorldBorder().contains(pos))
return;
int[] color = this.getSetting(4).asColor().getRGBArray();
if (mode == 0) {
shader.prepare();
shader.clearFramebuffer("main");
Vec3d offset = state.getModelOffset(mc.world, pos);
MatrixStack matrices = Renderer.matrixFrom(pos.getX() + offset.x, pos.getY() + offset.y, pos.getZ() + offset.z);
BlockEntity be = mc.world.getBlockEntity(pos);
BlockEntityRenderer<BlockEntity> renderer = be != null ? mc.getBlockEntityRenderDispatcher().get(be) : null;
if (renderer != null) {
renderer.render(be, mc.getTickDelta(), matrices, colorVertexer.createSingleProvider(mc.getBufferBuilders().getEntityVertexConsumers(), color[0], color[1], color[2], getSetting(1).asSlider().getValueInt()), LightmapTextureManager.MAX_LIGHT_COORDINATE, OverlayTexture.DEFAULT_UV);
} else {
mc.getBlockRenderManager().getModelRenderer().renderFlat(mc.world, mc.getBlockRenderManager().getModel(state), state, pos, matrices, colorVertexer.createSingleProvider(mc.getBufferBuilders().getEntityVertexConsumers(), color[0], color[1], color[2], getSetting(1).asSlider().getValueInt()).getBuffer(RenderLayers.getMovingBlockLayer(state)), false, new Random(), 0L, OverlayTexture.DEFAULT_UV);
}
colorVertexer.draw();
shader.render();
shader.drawFramebufferToMain("main");
} else {
Box box = state.getOutlineShape(mc.world, pos).getBoundingBox().offset(pos);
float width = getSetting(2).asSlider().getValueFloat();
int fill = getSetting(3).asSlider().getValueInt();
if (width != 0)
Renderer.drawBoxOutline(box, QuadColor.single(color[0], color[1], color[2], 255), width);
if (fill != 0)
Renderer.drawBoxFill(box, QuadColor.single(color[0], color[1], color[2], fill));
}
}
use of net.minecraft.util.math.Box in project BleachHack by BleachDrinker420.
the class AutoParkour method onTick.
@BleachSubscribe
public void onTick(EventTick event) {
if (smartPos != null) {
if (mc.player.getY() - 0.5 < smartPos.getY() && mc.player.getVelocity().y < 0) {
smartPos = null;
}
}
if (!mc.player.isSneaking() && mc.player.isOnGround()) {
smartPos = null;
Box box = mc.player.getBoundingBox().offset(0, -0.51, 0);
Stream<VoxelShape> blockCollisions = mc.world.getBlockCollisions(mc.player, box);
if (blockCollisions.findAny().isEmpty()) {
if (getSetting(0).asToggle().getState() && !mc.player.isSprinting()) {
mc.player.setSprinting(true);
mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, Mode.START_SPRINTING));
}
if (getSetting(1).asToggle().getState()) {
Vec3d lookVec = mc.player.getPos().add(new Vec3d(0, 0, 3.5).rotateY(-(float) Math.toRadians(mc.player.getYaw())));
BlockPos nearestPos = BlockPos.streamOutwards(mc.player.getBlockPos().down(), 4, 1, 4).map(BlockPos::toImmutable).filter(pos -> (mc.world.isTopSolid(pos, mc.player) && mc.world.getBlockCollisions(mc.player, new Box(pos.up(), pos.add(1, 3, 1))).findAny().isEmpty()) || mc.world.getBlockState(pos).getBlock() instanceof LadderBlock || mc.world.getBlockState(pos.up()).getBlock() instanceof LadderBlock).filter(pos -> mc.player.getPos().distanceTo(Vec3d.of(pos).add(0.5, 1, 0.5)) >= 1).filter(pos -> mc.player.getPos().distanceTo(Vec3d.of(pos).add(0.5, 1, 0.5)) <= 4.5).sorted(Comparator.comparing(pos -> pos.getSquaredDistance(lookVec, false))).findFirst().orElse(null);
if (nearestPos != null) {
smartPos = nearestPos;
}
}
mc.player.jump();
}
}
}
use of net.minecraft.util.math.Box in project BleachHack by BleachDrinker420.
the class ArrowJuke method onTick.
@BleachSubscribe
public void onTick(EventTick envent) {
for (Entity e : mc.world.getEntities()) {
if (e.age > 75 || !(e instanceof ArrowEntity) || ((ArrowEntity) e).getOwner() == mc.player)
continue;
int mode = getSetting(0).asMode().getMode();
int steps = getSetting(2).asSlider().getValueInt();
Box playerBox = mc.player.getBoundingBox().expand(0.3);
List<Box> futureBoxes = new ArrayList<>(steps);
Box currentBox = e.getBoundingBox();
Vec3d currentVel = e.getVelocity();
for (int i = 0; i < steps; i++) {
currentBox = currentBox.offset(currentVel);
currentVel = currentVel.multiply(0.99, 0.94, 0.99);
futureBoxes.add(currentBox);
if (!mc.world.getOtherEntities(null, currentBox).isEmpty() || WorldUtils.doesBoxCollide(currentBox)) {
break;
}
}
for (Box box : futureBoxes) {
if (playerBox.intersects(box)) {
for (Vec3d vel : getMoveVecs(e.getVelocity())) {
Box newBox = mc.player.getBoundingBox().offset(vel);
if (!WorldUtils.doesBoxCollide(newBox) && futureBoxes.stream().noneMatch(playerBox.offset(vel)::intersects)) {
if (mode == 0 && vel.y == 0) {
mc.player.setVelocity(vel);
} else {
mc.player.updatePosition(mc.player.getX() + vel.x, mc.player.getY() + vel.y, mc.player.getZ() + vel.z);
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY(), mc.player.getZ(), false));
}
return;
}
}
}
}
}
}
use of net.minecraft.util.math.Box in project BleachHack by BleachDrinker420.
the class AutoBedrockBreak method onTick.
@BleachSubscribe
public void onTick(EventTick event) {
if (pos != null) {
switch(step) {
case 0:
if (!mc.world.isSpaceEmpty(new Box(pos.up(), pos.add(1, 8, 1)))) {
reset();
BleachLogger.info("Not enough empty space to break this block!");
} else if (InventoryUtils.getSlot(true, i -> mc.player.getInventory().getStack(i).getItem() == Items.PISTON) == -1) {
reset();
BleachLogger.info("Missing pistons!");
} else if (InventoryUtils.getSlot(true, i -> mc.player.getInventory().getStack(i).getItem() == Items.REDSTONE_BLOCK) == -1) {
reset();
BleachLogger.info("Missing a redstone block!");
} else if (InventoryUtils.getSlot(true, i -> mc.player.getInventory().getStack(i).getItem() == Items.TNT) == -1) {
reset();
BleachLogger.info("Missing TNT!");
} else if (InventoryUtils.getSlot(true, i -> mc.player.getInventory().getStack(i).getItem() == Items.LEVER) == -1) {
reset();
BleachLogger.info("Missing a lever!");
} else if (dirtyPlace(pos.up(3), InventoryUtils.getSlot(true, i -> mc.player.getInventory().getStack(i).getItem() == Items.REDSTONE_BLOCK), Direction.DOWN)) {
step++;
}
break;
case 1:
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(mc.player.getX(), mc.player.getY(), mc.player.getZ(), mc.player.getYaw(), 90, mc.player.isOnGround()));
// mc.player.setPitch(90) "its jank either way"
step++;
break;
case 2:
if (dirtyPlace(pos.up(), InventoryUtils.getSlot(true, i -> mc.player.getInventory().getStack(i).getItem() == Items.PISTON), Direction.DOWN))
step++;
break;
case 3:
if (dirtyPlace(pos.up(7), InventoryUtils.getSlot(true, i -> mc.player.getInventory().getStack(i).getItem() == Items.TNT), Direction.DOWN))
step++;
break;
case 4:
if (dirtyPlace(pos.up(6), InventoryUtils.getSlot(true, i -> mc.player.getInventory().getStack(i).getItem() == Items.LEVER), Direction.UP))
step++;
break;
case 5:
if (dirtyPlace(pos.up(5), InventoryUtils.getSlot(true, i -> mc.player.getInventory().getStack(i).getItem() == Items.TNT), Direction.DOWN))
step++;
break;
case 6:
Vec3d leverCenter = Vec3d.ofCenter(pos.up(6));
if (mc.player.getEyePos().distanceTo(leverCenter) <= 4.75) {
mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(leverCenter, Direction.DOWN, pos.up(6), false));
step++;
}
break;
default:
if (mc.world.getBlockState(pos).isAir() || mc.world.getBlockState(pos).getBlock() instanceof PistonBlock || (mc.world.getBlockState(pos.up()).getBlock() instanceof PistonBlock && mc.world.getBlockState(pos.up()).get(PistonBlock.FACING) != Direction.UP)) {
setEnabled(false);
return;
}
if (step >= 82) {
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(mc.player.getX(), mc.player.getY(), mc.player.getZ(), mc.player.getYaw(), -90, mc.player.isOnGround()));
// mc.player.setPitch(-90) "its jank either way"
}
if (step > 84) {
Hand hand = InventoryUtils.selectSlot(true, i -> mc.player.getInventory().getStack(i).getItem() == Items.PISTON);
if (hand != null) {
mc.player.networkHandler.sendPacket(new PlayerInteractBlockC2SPacket(hand, new BlockHitResult(Vec3d.ofBottomCenter(pos.up()), Direction.DOWN, pos.up(), false)));
}
}
step++;
break;
}
}
}
Aggregations