Search in sources :

Example 26 with Box

use of net.minecraft.util.math.Box in project BleachHack by BleachDrinker420.

the class AutoBedrockBreak method dirtyPlace.

private boolean dirtyPlace(BlockPos pos, int slot, Direction dir) {
    Vec3d hitPos = Vec3d.ofCenter(pos).add(dir.getOffsetX() * 0.5, dir.getOffsetY() * 0.5, dir.getOffsetZ() * 0.5);
    if (mc.player.getEyePos().distanceTo(hitPos) >= 4.75 || !mc.world.getOtherEntities(null, new Box(pos)).isEmpty()) {
        return false;
    }
    Hand hand = InventoryUtils.selectSlot(slot);
    if (hand != null) {
        mc.interactionManager.interactBlock(mc.player, mc.world, hand, new BlockHitResult(hitPos, dir, pos, false));
        return true;
    }
    return false;
}
Also used : Box(net.minecraft.util.math.Box) BlockHitResult(net.minecraft.util.hit.BlockHitResult) Hand(net.minecraft.util.Hand) Vec3d(net.minecraft.util.math.Vec3d)

Example 27 with Box

use of net.minecraft.util.math.Box in project BleachHack by BleachDrinker420.

the class HoleESP method onRender.

@BleachSubscribe
public void onRender(EventWorldRender.Post event) {
    if (getSetting(1).asToggle().getState()) {
        int bottomMode = getSetting(1).asToggle().getChild(0).asMode().getMode();
        Direction[] excludeDirs = ArrayUtils.remove(Direction.values(), 0);
        if (bottomMode == 0 || bottomMode == 2) {
            int alpha = (int) (getSetting(1).asToggle().getChild(2).asSlider().getValueFloat() * 255);
            holes.forEach((pos, color) -> Renderer.drawBoxFill(pos, QuadColor.single(color[0], color[1], color[2], alpha), excludeDirs));
        }
        if (bottomMode == 0 || bottomMode == 1) {
            holes.forEach((pos, color) -> Renderer.drawBoxOutline(pos, QuadColor.single(color[0], color[1], color[2], 255), getSetting(1).asToggle().getChild(1).asSlider().getValueFloat(), excludeDirs));
        }
    }
    if (getSetting(2).asToggle().getState()) {
        int sideMode = getSetting(2).asToggle().getChild(0).asMode().getMode();
        float height = getSetting(2).asToggle().getChild(3).asSlider().getValueFloat();
        int alpha = (int) (getSetting(2).asToggle().getChild(2).asSlider().getValueFloat() * 255);
        Direction[] excludeDirs = new Direction[] { Direction.UP, Direction.DOWN };
        if (sideMode == 0 || sideMode == 1) {
            CardinalDirection gradientDir = sideMode == 0 ? CardinalDirection.NORTH : CardinalDirection.SOUTH;
            holes.forEach((pos, color) -> Renderer.drawBoxFill(new Box(pos, pos.add(1, 0, 1)).stretch(0, height, 0), QuadColor.gradient(color[0], color[1], color[2], alpha, color[0], color[1], color[2], 0, gradientDir), excludeDirs));
        } else {
            if (sideMode == 2 || sideMode == 4) {
                holes.forEach((pos, color) -> Renderer.drawBoxFill(new Box(pos, pos.add(1, 0, 1)).stretch(0, height, 0), QuadColor.single(color[0], color[1], color[2], alpha), excludeDirs));
            }
            if (sideMode == 2 || sideMode == 3) {
                holes.forEach((pos, color) -> Renderer.drawBoxOutline(new Box(pos, pos.add(1, 0, 1)).stretch(0, height, 0), QuadColor.single(color[0], color[1], color[2], 255), getSetting(2).asToggle().getChild(1).asSlider().getValueFloat(), excludeDirs));
            }
        }
    }
}
Also used : CardinalDirection(org.bleachhack.util.render.color.QuadColor.CardinalDirection) Box(net.minecraft.util.math.Box) CardinalDirection(org.bleachhack.util.render.color.QuadColor.CardinalDirection) Direction(net.minecraft.util.math.Direction) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Example 28 with Box

use of net.minecraft.util.math.Box in project BleachHack by BleachDrinker420.

the class ClickTp method onWorldRender.

@BleachSubscribe
public void onWorldRender(EventWorldRender.Post event) {
    if (pos != null && dir != null) {
        int[] col = getSetting(4).asColor().getRGBArray();
        Renderer.drawBoxBoth(new Box(pos.getX() + (dir == Direction.EAST ? 0.95 : 0), pos.getY() + (dir == Direction.UP ? 0.95 : 0), pos.getZ() + (dir == Direction.SOUTH ? 0.95 : 0), pos.getX() + (dir == Direction.WEST ? 0.05 : 1), pos.getY() + (dir == Direction.DOWN ? 0.05 : 1), pos.getZ() + (dir == Direction.NORTH ? 0.05 : 1)), QuadColor.single(col[0], col[1], col[2], 128), 2.5f);
    }
}
Also used : Box(net.minecraft.util.math.Box) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Example 29 with Box

use of net.minecraft.util.math.Box in project BleachHack by BleachDrinker420.

the class CrystalAura method canPlace.

private boolean canPlace(BlockPos basePos) {
    BlockState baseState = mc.world.getBlockState(basePos);
    if (baseState.getBlock() != Blocks.BEDROCK && baseState.getBlock() != Blocks.OBSIDIAN)
        return false;
    boolean oldPlace = getSetting(4).asToggle().getChild(1).asToggle().getState();
    BlockPos placePos = basePos.up();
    if (!mc.world.isAir(placePos) || (oldPlace && !mc.world.isAir(placePos.up())))
        return false;
    return mc.world.getOtherEntities(null, new Box(placePos, placePos.up(oldPlace ? 2 : 1))).isEmpty();
}
Also used : BlockState(net.minecraft.block.BlockState) BlockPos(net.minecraft.util.math.BlockPos) Box(net.minecraft.util.math.Box)

Example 30 with Box

use of net.minecraft.util.math.Box in project bewitchment by MoriyaShiine.

the class MakeEntitiesWetRitualFunction method start.

@Override
public void start(ServerWorld world, BlockPos glyphPos, BlockPos effectivePos, Inventory inventory, boolean catFamiliar) {
    int radius = catFamiliar ? 9 : 3;
    world.getEntitiesByClass(Entity.class, new Box(effectivePos).expand(radius), Entity::isAlive).forEach(entity -> BWComponents.ADDITIONAL_WATER_DATA_COMPONENT.get(entity).setWetTimer(6000 * (catFamiliar ? 3 : 1)));
    BWUtil.getBlockPoses(effectivePos, radius, currentPos -> world.getBlockState(currentPos).getBlock() instanceof AbstractFireBlock).forEach(foundPos -> world.setBlockState(foundPos, Blocks.AIR.getDefaultState()));
    super.start(world, glyphPos, effectivePos, inventory, catFamiliar);
}
Also used : Entity(net.minecraft.entity.Entity) ParticleType(net.minecraft.particle.ParticleType) LivingEntity(net.minecraft.entity.LivingEntity) Predicate(java.util.function.Predicate) AbstractFireBlock(net.minecraft.block.AbstractFireBlock) ServerWorld(net.minecraft.server.world.ServerWorld) Box(net.minecraft.util.math.Box) BWUtil(moriyashiine.bewitchment.common.misc.BWUtil) Inventory(net.minecraft.inventory.Inventory) BlockPos(net.minecraft.util.math.BlockPos) Blocks(net.minecraft.block.Blocks) RitualFunction(moriyashiine.bewitchment.api.registry.RitualFunction) BWComponents(moriyashiine.bewitchment.common.registry.BWComponents) Entity(net.minecraft.entity.Entity) LivingEntity(net.minecraft.entity.LivingEntity) Box(net.minecraft.util.math.Box) AbstractFireBlock(net.minecraft.block.AbstractFireBlock)

Aggregations

Box (net.minecraft.util.math.Box)150 Vec3d (net.minecraft.util.math.Vec3d)56 LivingEntity (net.minecraft.entity.LivingEntity)50 PlayerEntity (net.minecraft.entity.player.PlayerEntity)46 Entity (net.minecraft.entity.Entity)43 BlockPos (net.minecraft.util.math.BlockPos)43 PersistentProjectileEntity (net.minecraft.entity.projectile.PersistentProjectileEntity)18 Direction (net.minecraft.util.math.Direction)18 List (java.util.List)15 VoxelShape (net.minecraft.util.shape.VoxelShape)14 BlockState (net.minecraft.block.BlockState)13 ItemStack (net.minecraft.item.ItemStack)12 ArrayList (java.util.ArrayList)11 Comparator (java.util.Comparator)11 World (net.minecraft.world.World)11 Random (java.util.Random)10 AreaEffectCloudEntity (net.minecraft.entity.AreaEffectCloudEntity)10 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)10 BleachSubscribe (org.bleachhack.eventbus.BleachSubscribe)10 DemonEntity (mod.azure.doom.entity.DemonEntity)9