Search in sources :

Example 6 with AxisAlignedBB

use of net.minecraft.util.math.AxisAlignedBB in project Witchworks by Um-Mitternacht.

the class TileKettle method update.

@Override
public void update() {
    if (!world.isRemote && ticks % 2 == 0) {
        double x = getPos().getX();
        double y = getPos().getY();
        double z = getPos().getZ();
        AxisAlignedBB box = new AxisAlignedBB(x, y, z, x + 1, y + 0.65D, z + 1);
        final List<EntityItem> entityItemList = world.getEntitiesWithinAABB(EntityItem.class, box);
        entityItemList.forEach(this::collideItem);
    }
    if (inv.hasFluid()) {
        if (!inv.hasFluid(FluidRegistry.LAVA)) {
            if (isBoiling()) {
                handleParticles();
                if (ticks % 5 == 0 && world.rand.nextInt(15) == 0) {
                    play(SoundEvents.BLOCK_LAVA_AMBIENT, 0.1F, 1F);
                }
            }
        } else if (ticks % 5 == 0 && world.rand.nextInt(20) == 0) {
            play(SoundEvents.BLOCK_LAVA_AMBIENT, 1F, 1F);
        }
    }
    if (ticks % 20 == 0) {
        handleHeat();
        tryTurnLiquid();
    }
    if (!world.isRemote && mode == Mode.RITUAL && ritual != null) {
        handleRitual();
    }
    ++ticks;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EntityItem(net.minecraft.entity.item.EntityItem)

Example 7 with AxisAlignedBB

use of net.minecraft.util.math.AxisAlignedBB in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class CoordTransformObject method updateParentAABB.

// TODO: FinishME
public void updateParentAABB() {
    double mnX = 0, mnY = 0, mnZ = 0, mxX = 0, mxY = 0, mxZ = 0;
    Vector currentLocation = new Vector();
    mnX = mxX = parent.wrapper.posX;
    mnY = mxY = parent.wrapper.posY;
    mnZ = mxZ = parent.wrapper.posZ;
    for (BlockPos pos : parent.blockPositions) {
        currentLocation.X = pos.getX() + .5D;
        currentLocation.Y = pos.getY() + .5D;
        currentLocation.Z = pos.getZ() + .5D;
        fromLocalToGlobal(currentLocation);
        if (currentLocation.X < mnX) {
            mnX = currentLocation.X;
        }
        if (currentLocation.X > mxX) {
            mxX = currentLocation.X;
        }
        if (currentLocation.Y < mnY) {
            mnY = currentLocation.Y;
        }
        if (currentLocation.Y > mxY) {
            mxY = currentLocation.Y;
        }
        if (currentLocation.Z < mnZ) {
            mnZ = currentLocation.Z;
        }
        if (currentLocation.Z > mxZ) {
            mxZ = currentLocation.Z;
        }
    }
    AxisAlignedBB enclosingBB = new AxisAlignedBB(mnX, mnY, mnZ, mxX, mxY, mxZ).expand(.6D, .6D, .6D);
    parent.collisionBB = enclosingBB;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) BlockPos(net.minecraft.util.math.BlockPos) Vector(ValkyrienWarfareBase.API.Vector)

Example 8 with AxisAlignedBB

use of net.minecraft.util.math.AxisAlignedBB in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class WorldPhysObjectManager method getNearbyPhysObjects.

public List<PhysicsWrapperEntity> getNearbyPhysObjects(AxisAlignedBB toCheck) {
    ArrayList<PhysicsWrapperEntity> ships = new ArrayList<PhysicsWrapperEntity>();
    AxisAlignedBB expandedCheck = toCheck.expand(6, 6, 6);
    for (PhysicsWrapperEntity wrapper : physicsEntities) {
        if (wrapper.wrapping.collisionBB.intersectsWith(expandedCheck)) {
            ships.add(wrapper);
        }
    }
    return ships;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) ArrayList(java.util.ArrayList)

Example 9 with AxisAlignedBB

use of net.minecraft.util.math.AxisAlignedBB in project Realistic-Terrain-Generation by Team-RTG.

the class WorldUtil method isNotSolid.

/**
     * Checks if the Block has a bounding box.
     * @param world The world to check in
     * @param pos The position to check
     * @return True if the block has a bounding box, false otherwise.
     */
public static boolean isNotSolid(World world, BlockPos pos) {
    IBlockState state = world.getBlockState(pos);
    AxisAlignedBB boundingBox = state.getCollisionBoundingBox(world, pos);
    return boundingBox == null || boundingBox.equals(Block.NULL_AABB);
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) IBlockState(net.minecraft.block.state.IBlockState)

Example 10 with AxisAlignedBB

use of net.minecraft.util.math.AxisAlignedBB in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class EntityCollisionInjector method setEntityPositionAndUpdateBB.

public static void setEntityPositionAndUpdateBB(Entity entity, double x, double y, double z) {
    entity.posX = x;
    entity.posY = y;
    entity.posZ = z;
    float f = entity.width / 2.0F;
    float f1 = entity.height;
    entity.boundingBox = new AxisAlignedBB(x - (double) f, y, z - (double) f, x + (double) f, y + (double) f1, z + (double) f);
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB)

Aggregations

AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)181 EntityPlayer (net.minecraft.entity.player.EntityPlayer)50 BlockPos (net.minecraft.util.math.BlockPos)45 EntityLivingBase (net.minecraft.entity.EntityLivingBase)40 Entity (net.minecraft.entity.Entity)39 EnumFacing (net.minecraft.util.EnumFacing)29 IBlockState (net.minecraft.block.state.IBlockState)28 Vec3d (net.minecraft.util.math.Vec3d)26 ItemStack (net.minecraft.item.ItemStack)21 PotionEffect (net.minecraft.potion.PotionEffect)20 ArrayList (java.util.ArrayList)15 World (net.minecraft.world.World)15 EntityItem (net.minecraft.entity.item.EntityItem)14 TileEntity (net.minecraft.tileentity.TileEntity)14 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)9 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)9 Vector (ValkyrienWarfareBase.API.Vector)8 List (java.util.List)8 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)8 RayTraceResult (net.minecraft.util.math.RayTraceResult)8