use of net.minecraft.util.AxisAlignedBB in project PneumaticCraft by MineMaarten.
the class TileEntityPneumaticDoorBase method shouldOpen.
private boolean shouldOpen() {
switch(redstoneMode) {
case 0:
case 1:
int range = TileEntityConstants.RANGE_PNEUMATIC_DOOR_BASE + this.getUpgrades(ItemMachineUpgrade.UPGRADE_RANGE);
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xCoord - range, yCoord - range, zCoord - range, xCoord + range + 1, yCoord + range + 1, zCoord + range + 1);
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb);
for (EntityPlayer player : players) {
if (PneumaticCraftUtils.getProtectingSecurityStations(worldObj, xCoord, yCoord, zCoord, player, false, false) == 0) {
if (redstoneMode == 0) {
return true;
} else {
((BlockPneumaticDoor) Blockss.pneumaticDoor).isTrackingPlayerEye = true;
// max range = range * sqrt(2).
ChunkPosition lookedPosition = PneumaticCraftUtils.getEntityLookedBlock(player, range * 1.41F);
((BlockPneumaticDoor) Blockss.pneumaticDoor).isTrackingPlayerEye = false;
if (lookedPosition != null) {
if (lookedPosition.equals(new ChunkPosition(xCoord, yCoord, zCoord))) {
return true;
} else {
if (door != null) {
if (lookedPosition.equals(new ChunkPosition(door.xCoord, door.yCoord, door.zCoord)))
return true;
if (lookedPosition.equals(new ChunkPosition(door.xCoord, door.yCoord + (door.getBlockMetadata() < 6 ? 1 : -1), door.zCoord)))
return true;
}
}
}
}
}
}
return false;
case 2:
return opening;
}
return false;
}
use of net.minecraft.util.AxisAlignedBB in project PneumaticCraft by MineMaarten.
the class SemiBlockRendererLogistics method render.
@Override
public void render(SemiBlockLogistics semiBlock, float partialTick) {
int alpha = semiBlock.getAlpha();
if (alpha == 0)
return;
GL11.glDisable(GL11.GL_TEXTURE_2D);
// GL11.glColor4d(1, 0, 0, 1);
if (alpha < 255)
GL11.glEnable(GL11.GL_BLEND);
RenderUtils.glColorHex((alpha << 24 | 0x00FFFFFF) & semiBlock.getColor());
double fw = 1 / 32D;
AxisAlignedBB aabb;
if (semiBlock.getWorld() != null) {
semiBlock.getBlock().setBlockBoundsBasedOnState(semiBlock.getWorld(), semiBlock.getPos().chunkPosX, semiBlock.getPos().chunkPosY, semiBlock.getPos().chunkPosZ);
aabb = semiBlock.getBlock().getSelectedBoundingBoxFromPool(semiBlock.getWorld(), semiBlock.getPos().chunkPosX, semiBlock.getPos().chunkPosY, semiBlock.getPos().chunkPosZ);
} else {
aabb = AxisAlignedBB.getBoundingBox(0 + fw, 0 + fw, 0 + fw, 1 - fw, 1 - fw, 1 - fw);
}
if (semiBlock.getPos() != null)
GL11.glTranslated(-semiBlock.getPos().chunkPosX, -semiBlock.getPos().chunkPosY, -semiBlock.getPos().chunkPosZ);
renderFrame(aabb, fw);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4d(1, 1, 1, 1);
}
use of net.minecraft.util.AxisAlignedBB in project ArsMagica2 by Mithion.
the class AffinityHelper method applyReverseWaterMovement.
private void applyReverseWaterMovement(EntityLivingBase entity) {
AxisAlignedBB par1AxisAlignedBB = entity.boundingBox.expand(0.0D, -0.4000000059604645D, 0.0D).contract(0.001D, 0.001D, 0.001D);
int i = MathHelper.floor_double(par1AxisAlignedBB.minX);
int j = MathHelper.floor_double(par1AxisAlignedBB.maxX + 1.0D);
int k = MathHelper.floor_double(par1AxisAlignedBB.minY);
int l = MathHelper.floor_double(par1AxisAlignedBB.maxY + 1.0D);
int i1 = MathHelper.floor_double(par1AxisAlignedBB.minZ);
int j1 = MathHelper.floor_double(par1AxisAlignedBB.maxZ + 1.0D);
if (!entity.worldObj.checkChunksExist(i, k, i1, j, l, j1)) {
return;
} else {
boolean flag = false;
Vec3 vec3 = Vec3.createVectorHelper(0.0D, 0.0D, 0.0D);
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
Block block = entity.worldObj.getBlock(k1, l1, i2);
if (block != null && block.getMaterial() == Material.water) {
double d0 = l1 + 1 - BlockLiquid.getLiquidHeightPercent(entity.worldObj.getBlockMetadata(k1, l1, i2));
if (l >= d0) {
flag = true;
block.velocityToAddToEntity(entity.worldObj, k1, l1, i2, entity, vec3);
}
}
}
}
}
if (vec3.lengthVector() > 0.0D && entity.isInWater()) {
vec3 = vec3.normalize();
double d1 = -0.014D;
entity.motionX += vec3.xCoord * d1;
entity.motionY += vec3.yCoord * d1;
entity.motionZ += vec3.zCoord * d1;
// AMCore.proxy.packetSender.SendVelocityAddPacket(entity.worldObj, entity, vec3.xCoord * d1, vec3.yCoord * d1, vec3.zCoord * d1);
}
}
}
use of net.minecraft.util.AxisAlignedBB in project Engine by VoltzEngine-Project.
the class BlastBasic method doEffectOther.
@Override
public void doEffectOther(boolean beforeBlocksPlaced) {
if (!beforeBlocksPlaced) {
// TODO wright own version of getEntitiesWithinAABB that takes a filter and cuboid(or Vector3 to Vector3)
// TODO ensure that the entity is in line of sight
// TODO ensure that the entity can be pathed by the explosive
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(x - size - 1, y - size - 1, z - size - 1, x + size + 1, y + size + 1, z + size + 1);
List list = world.selectEntitiesWithinAABB(Entity.class, bounds, new EntityDistanceSelector(new Pos(x, y, z), size + 1, true));
if (list != null && !list.isEmpty()) {
damageEntities(list, source);
}
}
}
use of net.minecraft.util.AxisAlignedBB in project Engine by VoltzEngine-Project.
the class BlockTile method getCollisionBoundingBoxFromPool.
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
Tile tile = inject(world, x, y, z);
AxisAlignedBB value = tile.getCollisionBounds().clone().add(tile.x(), tile.y(), tile.z()).toAABB();
eject();
return value;
}
Aggregations