use of net.minecraft.util.math.AxisAlignedBB in project MorePlanets by SteveKunG.
the class RenderInfectedElderGuardian method shouldRender.
@Override
public boolean shouldRender(EntityInfectedElderGuardian entity, ICamera camera, double camX, double camY, double camZ) {
if (super.shouldRender(entity, camera, camX, camY, camZ)) {
return true;
} else {
if (entity.hasTargetedEntity()) {
EntityLivingBase entitylivingbase = entity.getTargetedEntity();
if (entitylivingbase != null) {
Vec3d vec3 = this.getPosition(entitylivingbase, entitylivingbase.height * 0.5D, 1.0F);
Vec3d vec31 = this.getPosition(entity, entity.getEyeHeight(), 1.0F);
if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(vec31.x, vec31.y, vec31.z, vec3.x, vec3.y, vec3.z))) {
return true;
}
}
}
return false;
}
}
use of net.minecraft.util.math.AxisAlignedBB in project MorePlanets by SteveKunG.
the class BlockMultalicCrystal method getBoundingBox.
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
EnumFacing facing = state.getValue(BlockStateHelper.FACING_ALL);
double box = 0.0625D;
switch(facing) {
case NORTH:
default:
return new AxisAlignedBB(0.0D + box, 0.0D + box, 0.0D + box, 1.0D - box, 1.0D - box, 1.0D);
case EAST:
return new AxisAlignedBB(0.0D, 0.0D + box, 0.0D + box, 1.0D - box, 1.0D - box, 1.0D - box);
case WEST:
return new AxisAlignedBB(0.0D + box, 0.0D + box, 0.0D + box, 1.0D, 1.0D - box, 1.0D - box);
case SOUTH:
return new AxisAlignedBB(0.0D + box, 0.0D + box, 0.0D, 1.0D - box, 1.0D - box, 1.0D - box);
case UP:
return new AxisAlignedBB(0.0D + box, 0.0D, 0.0D + box, 1.0D - box, 1.0D - box, 1.0D - box);
case DOWN:
return new AxisAlignedBB(0.0D + box, 0.0D + box, 0.0D + box, 1.0D - box, 1.0D, 1.0D - box);
}
}
use of net.minecraft.util.math.AxisAlignedBB in project MorePlanets by SteveKunG.
the class TileEntityAncientChestMP method update.
@Override
public void update() {
this.checkForAdjacentChests();
int i = this.pos.getX();
int j = this.pos.getY();
int k = this.pos.getZ();
++this.ticksSinceSync;
float f;
if (!this.world.isRemote && this.numPlayersUsing != 0 && (this.ticksSinceSync + i + j + k) % 200 == 0) {
this.numPlayersUsing = 0;
f = 5.0F;
List list = this.world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(i - f, j - f, k - f, i + 1 + f, j + 1 + f, k + 1 + f));
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
if (entityplayer.openContainer instanceof ContainerChest) {
IInventory iinventory = ((ContainerChest) entityplayer.openContainer).getLowerChestInventory();
if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest) iinventory).isPartOfLargeChest(this)) {
++this.numPlayersUsing;
}
}
}
}
this.prevLidAngle = this.lidAngle;
f = 0.1F;
double d2;
if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) {
double d1 = i + 0.5D;
d2 = k + 0.5D;
if (this.adjacentChestZPos != null) {
d2 += 0.5D;
}
if (this.adjacentChestXPos != null) {
d1 += 0.5D;
}
this.world.playSound((EntityPlayer) null, d1, j + 0.5D, d2, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F);
}
if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) {
float f1 = this.lidAngle;
if (this.numPlayersUsing > 0) {
this.lidAngle += f;
} else {
this.lidAngle -= f;
}
if (this.lidAngle > 1.0F) {
this.lidAngle = 1.0F;
}
float f2 = 0.5F;
if (this.lidAngle < f2 && f1 >= f2 && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) {
d2 = i + 0.5D;
double d0 = k + 0.5D;
if (this.adjacentChestZPos != null) {
d0 += 0.5D;
}
if (this.adjacentChestXPos != null) {
d2 += 0.5D;
}
this.world.playSound((EntityPlayer) null, d2, j + 0.5D, d0, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F);
}
if (this.lidAngle < 0.0F) {
this.lidAngle = 0.0F;
}
}
}
use of net.minecraft.util.math.AxisAlignedBB in project MorePlanets by SteveKunG.
the class ItemBlockSlabMP method tryPlace.
private boolean tryPlace(EntityPlayer player, ItemStack itemStack, World world, BlockPos pos, Object variantInStack, BlockSlabMP half, BlockSlabMP doubleSlab) {
IBlockState state = world.getBlockState(pos);
if (state.getBlock() == half) {
Comparable comparable = state.getValue(half.getVariantProperty());
if (comparable == variantInStack) {
IBlockState state1 = doubleSlab.getDefaultState().withProperty((IProperty) half.getVariantProperty(), comparable);
AxisAlignedBB axisalignedbb = state1.getCollisionBoundingBox(world, pos);
if (axisalignedbb != Block.NULL_AABB && world.checkNoEntityCollision(axisalignedbb.offset(pos)) && world.setBlockState(pos, state1, 11)) {
SoundType soundtype = doubleSlab.getSoundType(state1, world, pos, player);
world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
itemStack.shrink(1);
}
return true;
}
}
return false;
}
use of net.minecraft.util.math.AxisAlignedBB in project MorePlanets by SteveKunG.
the class EntityInfectedCrystallizeWorm method onDeath.
@Override
public void onDeath(DamageSource source) {
if (!this.world.isRemote) {
if (this.rand.nextInt(5) == 0) {
List<EntityPlayer> playerList = this.world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(this.posX - 2.5D, this.posY - 1.5D, this.posZ - 2.5D, this.posX + 2.5D, this.posY + 1.5D, this.posZ + 2.5D));
EntityAlbetiusWorm worm = new EntityAlbetiusWorm(this.world);
for (EntityPlayer player : playerList) {
player.addPotionEffect(new PotionEffect(MPPotions.INFECTED_CRYSTALLIZE, 24, 0));
}
this.world.playSound(null, this.posX, this.posY, this.posZ, MPSounds.INFECTED_MOB_EXPLODE, SoundCategory.HOSTILE, 1.0F, 1.0F);
this.world.createExplosion(this, this.posX, this.posY, this.posZ, 0.5F + this.rand.nextInt(2), this.world.getGameRules().getBoolean("mobGriefing"));
worm.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rand.nextFloat() * 360.0F, 0.0F);
this.world.spawnEntity(worm);
}
}
}
Aggregations