use of net.minecraft.util.math.AxisAlignedBB in project NetherEx by LogicTechCorp.
the class EventHandler method onLivingUpdate.
@SubscribeEvent
public static void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
World world = event.getEntityLiving().getEntityWorld();
BlockPos pos = new BlockPos(event.getEntityLiving());
EntityLivingBase entity = event.getEntityLiving();
boolean canFreeze = !(entity instanceof EntityPlayer) && !Arrays.asList(ConfigHandler.potionEffect.freeze.blacklist).contains(EntityList.getKey(entity).toString());
if (world.getBiomeForCoordsBody(pos) == NetherExBiomes.ARCTIC_ABYSS) {
if (canFreeze && !entity.isPotionActive(NetherExEffects.FREEZE) && world.rand.nextInt(ConfigHandler.biome.arcticAbyss.chanceOfFreezing) == 0) {
entity.addPotionEffect(new PotionEffect(NetherExEffects.FREEZE, 300, 0));
}
}
if (entity instanceof EntityLiving && canFreeze) {
if (!entity.isPotionActive(NetherExEffects.FREEZE)) {
if (((EntityLiving) entity).isAIDisabled()) {
((EntityLiving) entity).setNoAI(false);
entity.setSilent(false);
}
} else {
((EntityLiving) entity).setNoAI(true);
entity.setSilent(true);
if (world.rand.nextInt(ConfigHandler.potionEffect.freeze.chanceOfThawing) == 0) {
entity.removePotionEffect(NetherExEffects.FREEZE);
}
}
}
if (entity instanceof EntityPlayer && entity.isPotionActive(NetherExEffects.FREEZE)) {
entity.setPosition(entity.prevPosX, entity.posY, entity.prevPosZ);
}
boolean canSpawnSpore = entity instanceof EntityPlayer || !Arrays.asList(ConfigHandler.potionEffect.spore.blacklist).contains(EntityList.getKey(entity).toString());
if (canSpawnSpore && entity.isPotionActive(NetherExEffects.SPORE) && world.rand.nextInt(ConfigHandler.potionEffect.spore.chanceOfSporeSpawning) == 0) {
if (world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(pos).expand(1, 1, 1)).size() < 3) {
BlockPos newPos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(world.rand));
if (!world.isRemote && world.isAirBlock(newPos) && world.getBlockState(newPos.down()).isSideSolid(world, newPos.down(), EnumFacing.UP)) {
EntitySpore spore = new EntitySpore(world, 0);
spore.setPosition(newPos.getX(), newPos.getY(), newPos.getZ());
world.spawnEntity(spore);
}
}
}
boolean canSpawnGhastling = entity instanceof EntityPlayer && world.provider.getDimension() == DimensionType.NETHER.getId();
if (canSpawnGhastling && entity.isPotionActive(NetherExEffects.LOST) && world.rand.nextInt(ConfigHandler.potionEffect.lost.chanceOfGhastlingSpawning) == 0) {
BlockPos newPos = pos.add(0, 5, 0).offset(entity.getHorizontalFacing().getOpposite(), 5);
if (!world.isRemote && world.isAirBlock(newPos)) {
EntityGhastling ghastling = new EntityGhastling(world);
ghastling.setPosition(newPos.getX(), newPos.getY(), newPos.getZ());
ghastling.setAttackTarget(entity);
world.spawnEntity(ghastling);
}
}
}
use of net.minecraft.util.math.AxisAlignedBB in project NetherEx by LogicTechCorp.
the class ItemObsidianBoat method onItemRightClick.
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * 1.0F;
float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * 1.0F;
double d0 = player.prevPosX + (player.posX - player.prevPosX) * 1.0D;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * 1.0D + (double) player.getEyeHeight();
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * 1.0D;
Vec3d vec3d = new Vec3d(d0, d1, d2);
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
float f6 = MathHelper.sin(-f1 * 0.017453292F);
float f7 = f4 * f5;
float f8 = f3 * f5;
Vec3d vec3d1 = vec3d.addVector((double) f7 * 5.0D, (double) f6 * 5.0D, (double) f8 * 5.0D);
RayTraceResult raytraceresult = world.rayTraceBlocks(vec3d, vec3d1, true);
if (raytraceresult == null) {
return new ActionResult(EnumActionResult.PASS, stack);
} else {
Vec3d vec3d2 = player.getLook(1.0F);
boolean flag = false;
List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(player, player.getEntityBoundingBox().addCoord(vec3d2.xCoord * 5.0D, vec3d2.yCoord * 5.0D, vec3d2.zCoord * 5.0D).expandXyz(1.0D));
for (Entity entity : entities) {
if (entity.canBeCollidedWith()) {
AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().expandXyz((double) entity.getCollisionBorderSize());
if (axisalignedbb.isVecInside(vec3d)) {
flag = true;
}
}
}
if (flag) {
return new ActionResult(EnumActionResult.PASS, stack);
} else if (raytraceresult.typeOfHit != RayTraceResult.Type.BLOCK) {
return new ActionResult(EnumActionResult.PASS, stack);
} else {
Block block = world.getBlockState(raytraceresult.getBlockPos()).getBlock();
boolean flag1 = block == Blocks.WATER || block == Blocks.FLOWING_WATER;
EntityObsidianBoat boat = new EntityObsidianBoat(world, raytraceresult.hitVec.xCoord, flag1 ? raytraceresult.hitVec.yCoord - 0.12D : raytraceresult.hitVec.yCoord, raytraceresult.hitVec.zCoord);
boat.rotationYaw = player.rotationYaw;
if (!world.getCollisionBoxes(boat, boat.getEntityBoundingBox().expandXyz(-0.1D)).isEmpty()) {
return new ActionResult(EnumActionResult.FAIL, stack);
} else {
if (!world.isRemote) {
world.spawnEntity(boat);
}
if (!player.capabilities.isCreativeMode) {
stack.shrink(1);
}
return new ActionResult(EnumActionResult.SUCCESS, stack);
}
}
}
}
use of net.minecraft.util.math.AxisAlignedBB in project ImmersiveEngineering by BluSunrize.
the class TileEntityArcFurnace method getAdvancedSelectionBounds.
@Override
public List<AxisAlignedBB> getAdvancedSelectionBounds() {
if (pos % 15 == 7)
return null;
EnumFacing fl = facing;
EnumFacing fw = facing.rotateY();
if (mirrored)
fw = fw.getOpposite();
if (pos == 0) {
List<AxisAlignedBB> list = Lists.newArrayList(new AxisAlignedBB(0, 0, 0, 1, .5f, 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
float minX = fl == EnumFacing.WEST ? .625f : fl == EnumFacing.EAST ? .125f : .125f;
float maxX = fl == EnumFacing.EAST ? .375f : fl == EnumFacing.WEST ? .875f : .25f;
float minZ = fl == EnumFacing.NORTH ? .625f : fl == EnumFacing.SOUTH ? .125f : .125f;
float maxZ = fl == EnumFacing.SOUTH ? .375f : fl == EnumFacing.NORTH ? .875f : .25f;
list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
minX = fl == EnumFacing.WEST ? .625f : fl == EnumFacing.EAST ? .125f : .75f;
maxX = fl == EnumFacing.EAST ? .375f : fl == EnumFacing.WEST ? .875f : .875f;
minZ = fl == EnumFacing.NORTH ? .625f : fl == EnumFacing.SOUTH ? .125f : .75f;
maxZ = fl == EnumFacing.SOUTH ? .375f : fl == EnumFacing.NORTH ? .875f : .875f;
list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
return list;
} else if (pos >= 46 && pos <= 48) {
float minX = fl == EnumFacing.WEST ? .25f : 0;
float maxX = fl == EnumFacing.EAST ? .75f : 1;
float minZ = fl == EnumFacing.NORTH ? .25f : 0;
float maxZ = fl == EnumFacing.SOUTH ? .75f : 1;
List<AxisAlignedBB> list = Lists.newArrayList(new AxisAlignedBB(minX, 0, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
minX = fl == EnumFacing.WEST ? 0 : fl == EnumFacing.EAST ? .75f : .25f;
maxX = fl == EnumFacing.EAST ? 1 : fl == EnumFacing.WEST ? .25f : .75f;
minZ = fl == EnumFacing.NORTH ? 0 : fl == EnumFacing.SOUTH ? .75f : .25f;
maxZ = fl == EnumFacing.SOUTH ? 1 : fl == EnumFacing.NORTH ? .25f : .75f;
list.add(new AxisAlignedBB(minX, .25f, minZ, maxX, .75, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
return list;
} else if (pos % 25 >= 10 && (pos % 5 == 0 || pos % 5 == 4)) {
List<AxisAlignedBB> list = pos < 25 ? Lists.newArrayList(new AxisAlignedBB(0, 0, 0, 1, .5f, 1).offset(getPos().getX(), getPos().getY(), getPos().getZ())) : new ArrayList(2);
if (pos % 5 == 4)
fw = fw.getOpposite();
float minX = fw == EnumFacing.EAST ? .5f : 0;
float maxX = fw == EnumFacing.WEST ? .5f : 1;
float minZ = fw == EnumFacing.SOUTH ? .5f : 0;
float maxZ = fw == EnumFacing.NORTH ? .5f : 1;
if (pos % 25 / 5 != 3)
list.add(new AxisAlignedBB(minX, pos < 25 ? .5 : 0, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
if (pos < 25) {
minX = fw == EnumFacing.EAST ? .125f : fw == EnumFacing.WEST ? .625f : fl == EnumFacing.EAST ? .375f : -1.625f;
maxX = fw == EnumFacing.EAST ? .375f : fw == EnumFacing.WEST ? .875f : fl == EnumFacing.WEST ? .625f : 2.625f;
minZ = fw == EnumFacing.SOUTH ? .125f : fw == EnumFacing.NORTH ? .625f : fl == EnumFacing.SOUTH ? .375f : -1.625f;
maxZ = fw == EnumFacing.SOUTH ? .375f : fw == EnumFacing.NORTH ? .875f : fl == EnumFacing.NORTH ? .625f : 2.625f;
AxisAlignedBB aabb = new AxisAlignedBB(minX, .6875, minZ, maxX, .9375, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ());
aabb = aabb.offset(-fl.getFrontOffsetX() * (pos % 25 - 10) / 5, 0, -fl.getFrontOffsetZ() * (pos % 25 - 10) / 5);
list.add(aabb);
minX = fw == EnumFacing.EAST ? .375f : fw == EnumFacing.WEST ? .5f : fl == EnumFacing.EAST ? .375f : .375f;
maxX = fw == EnumFacing.EAST ? .5f : fw == EnumFacing.WEST ? .625f : fl == EnumFacing.WEST ? .625f : .625f;
minZ = fw == EnumFacing.SOUTH ? .375f : fw == EnumFacing.NORTH ? .5f : fl == EnumFacing.SOUTH ? .375f : .375f;
maxZ = fw == EnumFacing.SOUTH ? .5f : fw == EnumFacing.NORTH ? .625f : fl == EnumFacing.NORTH ? .625f : .625f;
aabb = new AxisAlignedBB(minX, .6875, minZ, maxX, .9375, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ());
aabb = aabb.offset(-fl.getFrontOffsetX() * (pos % 25 - 10) / 5, 0, -fl.getFrontOffsetZ() * (pos % 25 - 10) / 5);
list.add(aabb);
minX = fw == EnumFacing.EAST ? .375f : fw == EnumFacing.WEST ? .5f : fl == EnumFacing.EAST ? 2.375f : -1.625f;
maxX = fw == EnumFacing.EAST ? .5f : fw == EnumFacing.WEST ? .625f : fl == EnumFacing.WEST ? -1.375f : 2.625f;
minZ = fw == EnumFacing.SOUTH ? .375f : fw == EnumFacing.NORTH ? .5f : fl == EnumFacing.SOUTH ? 2.375f : -1.625f;
maxZ = fw == EnumFacing.SOUTH ? .5f : fw == EnumFacing.NORTH ? .625f : fl == EnumFacing.NORTH ? -1.375f : 2.625f;
aabb = new AxisAlignedBB(minX, .6875, minZ, maxX, .9375, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ());
aabb = aabb.offset(-fl.getFrontOffsetX() * (pos % 25 - 10) / 5, 0, -fl.getFrontOffsetZ() * (pos % 25 - 10) / 5);
list.add(aabb);
} else if (pos < 50) {
minX = fw == EnumFacing.EAST ? .125f : fw == EnumFacing.WEST ? .625f : fl == EnumFacing.EAST ? .375f : -1.625f;
maxX = fw == EnumFacing.EAST ? .375f : fw == EnumFacing.WEST ? .875f : fl == EnumFacing.WEST ? .625f : 2.625f;
minZ = fw == EnumFacing.SOUTH ? .125f : fw == EnumFacing.NORTH ? .625f : fl == EnumFacing.SOUTH ? .375f : -1.625f;
maxZ = fw == EnumFacing.SOUTH ? .375f : fw == EnumFacing.NORTH ? .875f : fl == EnumFacing.NORTH ? .625f : 2.625f;
AxisAlignedBB aabb = new AxisAlignedBB(minX, .125, minZ, maxX, .375, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ());
aabb = aabb.offset(-fl.getFrontOffsetX() * (pos % 25 - 10) / 5, 0, -fl.getFrontOffsetZ() * (pos % 25 - 10) / 5);
list.add(aabb);
minX = fw == EnumFacing.EAST ? .375f : fw == EnumFacing.WEST ? .5f : fl == EnumFacing.EAST ? .375f : .375f;
maxX = fw == EnumFacing.EAST ? .5f : fw == EnumFacing.WEST ? .625f : fl == EnumFacing.WEST ? .625f : .625f;
minZ = fw == EnumFacing.SOUTH ? .375f : fw == EnumFacing.NORTH ? .5f : fl == EnumFacing.SOUTH ? .375f : .375f;
maxZ = fw == EnumFacing.SOUTH ? .5f : fw == EnumFacing.NORTH ? .625f : fl == EnumFacing.NORTH ? .625f : .625f;
aabb = new AxisAlignedBB(minX, .125, minZ, maxX, .375, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ());
aabb = aabb.offset(-fl.getFrontOffsetX() * (pos % 25 - 10) / 5, 0, -fl.getFrontOffsetZ() * (pos % 25 - 10) / 5);
if (pos % 5 == 0)
aabb = aabb.offset(0, .6875, 0);
list.add(aabb);
if (pos % 5 == 0) {
minX = fw == EnumFacing.EAST ? .125f : fw == EnumFacing.WEST ? .625f : fl == EnumFacing.EAST ? .375f : .375f;
maxX = fw == EnumFacing.EAST ? .375f : fw == EnumFacing.WEST ? .875f : fl == EnumFacing.WEST ? .625f : .625f;
minZ = fw == EnumFacing.SOUTH ? .125f : fw == EnumFacing.NORTH ? .625f : fl == EnumFacing.SOUTH ? .375f : .375f;
maxZ = fw == EnumFacing.SOUTH ? .375f : fw == EnumFacing.NORTH ? .875f : fl == EnumFacing.NORTH ? .625f : .625f;
aabb = new AxisAlignedBB(minX, .375, minZ, maxX, 1.0625, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ());
aabb = aabb.offset(-fl.getFrontOffsetX() * (pos % 25 - 10) / 5, 0, -fl.getFrontOffsetZ() * (pos % 25 - 10) / 5);
list.add(aabb);
}
minX = fw == EnumFacing.EAST ? .375f : fw == EnumFacing.WEST ? .5f : fl == EnumFacing.EAST ? 2.375f : -1.625f;
maxX = fw == EnumFacing.EAST ? .5f : fw == EnumFacing.WEST ? .625f : fl == EnumFacing.WEST ? -1.375f : 2.625f;
minZ = fw == EnumFacing.SOUTH ? .375f : fw == EnumFacing.NORTH ? .5f : fl == EnumFacing.SOUTH ? 2.375f : -1.625f;
maxZ = fw == EnumFacing.SOUTH ? .5f : fw == EnumFacing.NORTH ? .625f : fl == EnumFacing.NORTH ? -1.375f : 2.625f;
aabb = new AxisAlignedBB(minX, .125, minZ, maxX, .375, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ());
aabb = aabb.offset(-fl.getFrontOffsetX() * (pos % 25 - 10) / 5, 0, -fl.getFrontOffsetZ() * (pos % 25 - 10) / 5);
list.add(aabb);
} else if (pos == 60 || pos == 64) {
minX = fw == EnumFacing.EAST ? .375f : fw == EnumFacing.WEST ? .5f : .25f;
maxX = fw == EnumFacing.EAST ? .5f : fw == EnumFacing.WEST ? .625f : .75f;
minZ = fw == EnumFacing.SOUTH ? .375f : fw == EnumFacing.NORTH ? .5f : .25f;
maxZ = fw == EnumFacing.SOUTH ? .5f : fw == EnumFacing.NORTH ? .625f : .75f;
list.add(new AxisAlignedBB(minX, .25, minZ, maxX, .75, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
}
return list;
}
return null;
}
use of net.minecraft.util.math.AxisAlignedBB in project ImmersiveEngineering by BluSunrize.
the class BlockIEFluidConcrete method updateTick.
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
if (!isSourceBlock(world, pos) && ForgeEventFactory.canCreateFluidSource(world, pos, state, false)) {
int adjacentSourceBlocks = (isSourceBlock(world, pos.north()) ? 1 : 0) + (isSourceBlock(world, pos.south()) ? 1 : 0) + (isSourceBlock(world, pos.east()) ? 1 : 0) + (isSourceBlock(world, pos.west()) ? 1 : 0);
if (adjacentSourceBlocks >= 2 && (world.getBlockState(pos.up(densityDir)).getMaterial().isSolid() || isSourceBlock(world, pos.up(densityDir))))
world.setBlockState(pos, state.withProperty(LEVEL, 0));
}
int level = state.getValue(LEVEL);
int timer = state.getValue(IEProperties.INT_16);
int quantaRemaining = quantaPerBlock - level;
int expQuanta = -101;
if (timer >= Math.min(14, quantaRemaining)) {
IBlockState solidState;
if (level >= 14)
solidState = IEContent.blockStoneDevice.getStateFromMeta(BlockTypes_StoneDevices.CONCRETE_SHEET.getMeta());
else if (level >= 10)
solidState = IEContent.blockStoneDevice.getStateFromMeta(BlockTypes_StoneDevices.CONCRETE_QUARTER.getMeta());
else if (level >= 6)
solidState = IEContent.blockStoneDecorationSlabs.getStateFromMeta(BlockTypes_StoneDecoration.CONCRETE.getMeta());
else if (level >= 2)
solidState = IEContent.blockStoneDevice.getStateFromMeta(BlockTypes_StoneDevices.CONCRETE_THREEQUARTER.getMeta());
else
solidState = IEContent.blockStoneDecoration.getStateFromMeta(BlockTypes_StoneDecoration.CONCRETE.getMeta());
world.setBlockState(pos, solidState);
for (EntityLivingBase living : world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)))) living.addPotionEffect(new PotionEffect(IEPotions.concreteFeet, Integer.MAX_VALUE));
return;
} else {
state = state.withProperty(IEProperties.INT_16, Math.min(15, timer + 1));
world.setBlockState(pos, state);
}
// check adjacent block levels if non-source
if (quantaRemaining < quantaPerBlock) {
if (world.getBlockState(pos.add(0, -densityDir, 0)).getBlock() == this || world.getBlockState(pos.add(-1, -densityDir, 0)).getBlock() == this || world.getBlockState(pos.add(1, -densityDir, 0)).getBlock() == this || world.getBlockState(pos.add(0, -densityDir, -1)).getBlock() == this || world.getBlockState(pos.add(0, -densityDir, 1)).getBlock() == this) {
expQuanta = quantaPerBlock - 1;
} else {
int maxQuanta = -100;
maxQuanta = getLargerQuanta(world, pos.add(-1, 0, 0), maxQuanta);
maxQuanta = getLargerQuanta(world, pos.add(1, 0, 0), maxQuanta);
maxQuanta = getLargerQuanta(world, pos.add(0, 0, -1), maxQuanta);
maxQuanta = getLargerQuanta(world, pos.add(0, 0, 1), maxQuanta);
expQuanta = maxQuanta - 1;
}
int total = level;
int blocks = 1;
for (EnumFacing f : EnumFacing.HORIZONTALS) {
IBlockState otherState = world.getBlockState(pos.offset(f));
if (otherState.getBlock() == this) {
blocks++;
total += otherState.getValue(LEVEL);
}
}
int newEvenQuanta = (int) Math.ceil(total / (float) blocks);
for (EnumFacing f : EnumFacing.HORIZONTALS) {
IBlockState otherState = world.getBlockState(pos.offset(f));
if (otherState.getBlock() == this)
world.setBlockState(pos.offset(f), otherState.withProperty(LEVEL, newEvenQuanta));
}
// decay calculation
if (expQuanta != quantaRemaining) {
quantaRemaining = expQuanta;
if (expQuanta <= 0)
world.setBlockToAir(pos);
else {
world.setBlockState(pos, state.withProperty(LEVEL, quantaPerBlock - expQuanta), 2);
world.scheduleUpdate(pos, this, tickRate);
world.notifyNeighborsOfStateChange(pos, this);
}
}
} else // This is a "source" block, set meta to zero, and send a server only update
if (quantaRemaining >= quantaPerBlock)
world.setBlockState(pos, this.getDefaultState(), 2);
// Flow vertically if possible
if (canDisplace(world, pos.up(densityDir))) {
flowIntoBlockRet(world, pos.up(densityDir), 1, timer);
return;
}
// Flow outward if possible
int flowMeta = quantaPerBlock - quantaRemaining + 1;
if (flowMeta >= quantaPerBlock) {
world.setBlockState(pos, state.withProperty(IEProperties.INT_16, Math.min(15, timer + 1)));
world.scheduleUpdate(pos, this, tickRate);
return;
}
if (isSourceBlock(world, pos) || !isFlowingVertically(world, pos)) {
if (world.getBlockState(pos.down(densityDir)).getBlock() == this)
flowMeta = 1;
boolean[] flowTo = getOptimalFlowDirections(world, pos);
boolean hasFlown = false;
if (flowTo[0])
hasFlown |= flowIntoBlockRet(world, pos.add(-1, 0, 0), flowMeta, timer);
if (flowTo[1])
hasFlown |= flowIntoBlockRet(world, pos.add(1, 0, 0), flowMeta, timer);
if (flowTo[2])
hasFlown |= flowIntoBlockRet(world, pos.add(0, 0, -1), flowMeta, timer);
if (flowTo[3])
hasFlown |= flowIntoBlockRet(world, pos.add(0, 0, 1), flowMeta, timer);
if (!hasFlown) {
world.setBlockState(pos, state.withProperty(IEProperties.INT_16, Math.min(15, timer + 1)));
world.scheduleUpdate(pos, this, tickRate);
}
}
}
use of net.minecraft.util.math.AxisAlignedBB in project ImmersiveEngineering by BluSunrize.
the class TileEntitySqueezer method getAdvancedSelectionBounds.
@Override
public List<AxisAlignedBB> getAdvancedSelectionBounds() {
EnumFacing fl = facing;
EnumFacing fw = facing.rotateY();
if (mirrored)
fw = fw.getOpposite();
if (pos == 2) {
List<AxisAlignedBB> list = Lists.newArrayList(new AxisAlignedBB(0, 0, 0, 1, .5f, 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
float minX = fl == EnumFacing.WEST ? .625f : fl == EnumFacing.EAST ? .125f : .125f;
float maxX = fl == EnumFacing.EAST ? .375f : fl == EnumFacing.WEST ? .875f : .25f;
float minZ = fl == EnumFacing.NORTH ? .625f : fl == EnumFacing.SOUTH ? .125f : .125f;
float maxZ = fl == EnumFacing.SOUTH ? .375f : fl == EnumFacing.NORTH ? .875f : .25f;
list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
minX = fl == EnumFacing.WEST ? .625f : fl == EnumFacing.EAST ? .125f : .75f;
maxX = fl == EnumFacing.EAST ? .375f : fl == EnumFacing.WEST ? .875f : .875f;
minZ = fl == EnumFacing.NORTH ? .625f : fl == EnumFacing.SOUTH ? .125f : .75f;
maxZ = fl == EnumFacing.SOUTH ? .375f : fl == EnumFacing.NORTH ? .875f : .875f;
list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
return list;
}
if (pos == 3 || pos == 4 || pos == 6 || pos == 7) {
List<AxisAlignedBB> list = Lists.newArrayList(new AxisAlignedBB(0, 0, 0, 1, .5f, 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
if (pos > 5)
fl = fl.getOpposite();
if (pos % 3 == 1)
fw = fw.getOpposite();
float minX = fl == EnumFacing.WEST ? .6875f : fl == EnumFacing.EAST ? .0625f : fw == EnumFacing.EAST ? .0625f : .6875f;
float maxX = fl == EnumFacing.EAST ? .3125f : fl == EnumFacing.WEST ? .9375f : fw == EnumFacing.EAST ? .3125f : .9375f;
float minZ = fl == EnumFacing.NORTH ? .6875f : fl == EnumFacing.SOUTH ? .0625f : fw == EnumFacing.SOUTH ? .0625f : .6875f;
float maxZ = fl == EnumFacing.SOUTH ? .3125f : fl == EnumFacing.NORTH ? .9375f : fw == EnumFacing.SOUTH ? .3125f : .9375f;
list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
if (pos == 4) {
minX = fl == EnumFacing.WEST ? .375f : fl == EnumFacing.EAST ? .625f : fw == EnumFacing.WEST ? -.125f : 0;
maxX = fl == EnumFacing.EAST ? .375f : fl == EnumFacing.WEST ? .625f : fw == EnumFacing.EAST ? 1.125f : 1;
minZ = fl == EnumFacing.NORTH ? .375f : fl == EnumFacing.SOUTH ? .625f : fw == EnumFacing.NORTH ? -.125f : 0;
maxZ = fl == EnumFacing.SOUTH ? .375f : fl == EnumFacing.NORTH ? .625f : fw == EnumFacing.SOUTH ? 1.125f : 1;
list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, .75f, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
minX = fl == EnumFacing.WEST ? -.125f : fl == EnumFacing.EAST ? .625f : fw == EnumFacing.WEST ? -.125f : .875f;
maxX = fl == EnumFacing.EAST ? 1.125f : fl == EnumFacing.WEST ? .375f : fw == EnumFacing.EAST ? 1.125f : .125f;
minZ = fl == EnumFacing.NORTH ? -.125f : fl == EnumFacing.SOUTH ? .625f : fw == EnumFacing.NORTH ? -.125f : .875f;
maxZ = fl == EnumFacing.SOUTH ? 1.25f : fl == EnumFacing.NORTH ? .375f : fw == EnumFacing.SOUTH ? 1.125f : .125f;
list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, .75f, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
minX = fl == EnumFacing.WEST ? -.125f : fl == EnumFacing.EAST ? .875f : fw == EnumFacing.WEST ? -.125f : .875f;
maxX = fl == EnumFacing.EAST ? 1.125f : fl == EnumFacing.WEST ? .125f : fw == EnumFacing.EAST ? 1.125f : .125f;
minZ = fl == EnumFacing.NORTH ? -.125f : fl == EnumFacing.SOUTH ? .875f : fw == EnumFacing.NORTH ? -.125f : .875f;
maxZ = fl == EnumFacing.SOUTH ? 1.25f : fl == EnumFacing.NORTH ? .125f : fw == EnumFacing.SOUTH ? 1.125f : .125f;
list.add(new AxisAlignedBB(minX, .75f, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
}
return list;
}
if ((pos == 12 || pos == 13 || pos == 15 || pos == 16) || (pos == 21 || pos == 22 || pos == 24 || pos == 25)) {
List<AxisAlignedBB> list = new ArrayList<AxisAlignedBB>(2);
if (pos < 18)
list.add(new AxisAlignedBB(0, 0, 0, 1, .125f, 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
if (pos % 9 > 5)
fl = fl.getOpposite();
if (pos % 3 == 1)
fw = fw.getOpposite();
float minY = pos < 18 ? .125f : -.875f;
float maxY = pos < 18 ? 1.125f : .125f;
float minX = fl == EnumFacing.WEST ? .84375f : fl == EnumFacing.EAST ? 0f : fw == EnumFacing.EAST ? 0f : .84375f;
float maxX = fl == EnumFacing.EAST ? .15625f : fl == EnumFacing.WEST ? 1f : fw == EnumFacing.EAST ? .15625f : 1;
float minZ = fl == EnumFacing.NORTH ? .84375f : fl == EnumFacing.SOUTH ? 0f : fw == EnumFacing.SOUTH ? 0f : .84375f;
float maxZ = fl == EnumFacing.SOUTH ? .15625f : fl == EnumFacing.NORTH ? 1f : fw == EnumFacing.SOUTH ? .15625f : 1;
list.add(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
minX = fl == EnumFacing.WEST ? 0f : fl == EnumFacing.EAST ? .15625f : fw == EnumFacing.EAST ? .0625f : .8125f;
maxX = fl == EnumFacing.EAST ? 1f : fl == EnumFacing.WEST ? .84375f : fw == EnumFacing.EAST ? .1875f : .9375f;
minZ = fl == EnumFacing.NORTH ? 0f : fl == EnumFacing.SOUTH ? .15625f : fw == EnumFacing.SOUTH ? .0625f : .8125f;
maxZ = fl == EnumFacing.SOUTH ? 1f : fl == EnumFacing.NORTH ? .84375f : fw == EnumFacing.SOUTH ? .1875f : .9375f;
list.add(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
minX = fl == EnumFacing.WEST ? .8125f : fl == EnumFacing.EAST ? .0625f : fw == EnumFacing.EAST ? .15625f : 0f;
maxX = fl == EnumFacing.EAST ? .1875f : fl == EnumFacing.WEST ? .9375f : fw == EnumFacing.EAST ? 1f : .84375f;
minZ = fl == EnumFacing.NORTH ? .8125f : fl == EnumFacing.SOUTH ? .0625f : fw == EnumFacing.SOUTH ? .15625f : 0f;
maxZ = fl == EnumFacing.SOUTH ? .1875f : fl == EnumFacing.NORTH ? .9375f : fw == EnumFacing.SOUTH ? 1f : .84375f;
list.add(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
if (pos > 18) {
minX = fl == EnumFacing.WEST ? -.25f : fl == EnumFacing.EAST ? 1.25f : fw == EnumFacing.EAST ? .75f : -.25f;
maxX = fl == EnumFacing.EAST ? .75f : fl == EnumFacing.WEST ? .25f : fw == EnumFacing.EAST ? 1.25f : .25f;
minZ = fl == EnumFacing.NORTH ? -.25f : fl == EnumFacing.SOUTH ? 1.25f : fw == EnumFacing.SOUTH ? .75f : -.25f;
maxZ = fl == EnumFacing.SOUTH ? .75f : fl == EnumFacing.NORTH ? .25f : fw == EnumFacing.SOUTH ? 1.25f : .25f;
list.add(new AxisAlignedBB(minX, .375f, minZ, maxX, .9375f, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
}
return list;
}
return null;
}
Aggregations