Search in sources :

Example 11 with AxisAlignedBB

use of net.minecraft.util.math.AxisAlignedBB in project ImmersiveEngineering by BluSunrize.

the class TileEntityRazorWire method outputEnergy.

@Override
public int outputEnergy(int amount, boolean simulate, int energyType) {
    if (amount > 0) {
        if (!simulate) {
            int maxReach = amount / 8;
            int widthP = 0;
            boolean connectP = true;
            int widthN = 0;
            boolean connectN = true;
            EnumFacing dir = facing.rotateY();
            if (dir.getAxisDirection() == AxisDirection.NEGATIVE)
                dir = dir.getOpposite();
            for (int i = 1; i <= maxReach; i++) {
                BlockPos posP = getPos().offset(dir, i);
                if (connectP && worldObj.isBlockLoaded(posP) && worldObj.getTileEntity(posP) instanceof TileEntityRazorWire)
                    widthP++;
                else
                    connectP = false;
                BlockPos posN = getPos().offset(dir, -i);
                if (connectN && worldObj.isBlockLoaded(posN) && worldObj.getTileEntity(posN) instanceof TileEntityRazorWire)
                    widthN++;
                else
                    connectN = false;
            }
            AxisAlignedBB aabb = new AxisAlignedBB(getPos().add(facing.getAxis() == Axis.Z ? -widthN : 0, 0, facing.getAxis() == Axis.X ? -widthN : 0), getPos().add(facing.getAxis() == Axis.Z ? 1 + widthP : 1, 1, facing.getAxis() == Axis.X ? 1 + widthP : 1));
            List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, aabb);
            for (EntityLivingBase ent : entities) ent.attackEntityFrom(IEDamageSources.razorShock, 2);
        }
        return 64;
    }
    return 0;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EnumFacing(net.minecraft.util.EnumFacing) EntityLivingBase(net.minecraft.entity.EntityLivingBase) BlockPos(net.minecraft.util.math.BlockPos)

Example 12 with AxisAlignedBB

use of net.minecraft.util.math.AxisAlignedBB in project ImmersiveEngineering by BluSunrize.

the class TileEntityRefinery method getAdvancedSelectionBounds.

@Override
public List<AxisAlignedBB> getAdvancedSelectionBounds() {
    EnumFacing fl = facing;
    EnumFacing fw = facing.rotateY();
    if (mirrored)
        fw = fw.getOpposite();
    if (pos == 0 || pos == 4 || pos == 10 || pos == 14) {
        List<AxisAlignedBB> list = Lists.newArrayList(new AxisAlignedBB(0, 0, 0, 1, .5f, 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        if (pos >= 10)
            fl = fl.getOpposite();
        if (pos % 10 == 0)
            fw = fw.getOpposite();
        float minX = fl == EnumFacing.WEST ? 0 : fl == EnumFacing.EAST ? .75f : fw == EnumFacing.WEST ? .5f : .25f;
        float maxX = fl == EnumFacing.EAST ? 1 : fl == EnumFacing.WEST ? .25f : fw == EnumFacing.EAST ? .5f : .75f;
        float minZ = fl == EnumFacing.NORTH ? 0 : fl == EnumFacing.SOUTH ? .75f : fw == EnumFacing.NORTH ? .5f : .25f;
        float maxZ = fl == EnumFacing.SOUTH ? 1 : fl == EnumFacing.NORTH ? .25f : fw == EnumFacing.SOUTH ? .5f : .75f;
        list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, 1.375f, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        if (pos == 4) {
            minX = fl == EnumFacing.WEST ? .625f : fl == EnumFacing.EAST ? .125f : .125f;
            maxX = fl == EnumFacing.EAST ? .375f : fl == EnumFacing.WEST ? .875f : .25f;
            minZ = fl == EnumFacing.NORTH ? .625f : fl == EnumFacing.SOUTH ? .125f : .125f;
            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 == 1 || pos == 3 || pos == 11 || pos == 13) {
        List<AxisAlignedBB> list = Lists.newArrayList(new AxisAlignedBB(0, 0, 0, 1, .0f, 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        if (pos >= 10)
            fl = fl.getOpposite();
        if (pos % 10 == 1)
            fw = fw.getOpposite();
        float minX = fl == EnumFacing.WEST ? 0 : fl == EnumFacing.EAST ? .75f : fw == EnumFacing.WEST ? .75f : 0;
        float maxX = fl == EnumFacing.EAST ? 1 : fl == EnumFacing.WEST ? .25f : fw == EnumFacing.EAST ? .25f : 1;
        float minZ = fl == EnumFacing.NORTH ? 0 : fl == EnumFacing.SOUTH ? .75f : fw == EnumFacing.NORTH ? .75f : 0;
        float maxZ = fl == EnumFacing.SOUTH ? 1 : fl == EnumFacing.NORTH ? .25f : fw == EnumFacing.SOUTH ? .25f : 1;
        list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, 1.375f, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        return list;
    }
    if ((pos == 20 || pos == 24 || pos == 25 || pos == 29) || (pos == 35 || pos == 39 || pos == 40 || pos == 44)) {
        List<AxisAlignedBB> list = Lists.newArrayList();
        if (pos % 5 == 4)
            fw = fw.getOpposite();
        float minX = fl == EnumFacing.WEST ? -.25f : fl == EnumFacing.EAST ? -.25f : fw == EnumFacing.WEST ? -1f : .5f;
        float maxX = fl == EnumFacing.EAST ? 1.25f : fl == EnumFacing.WEST ? 1.25f : fw == EnumFacing.EAST ? 2 : .5f;
        float minZ = fl == EnumFacing.NORTH ? -.25f : fl == EnumFacing.SOUTH ? -.25f : fw == EnumFacing.NORTH ? -1f : .5f;
        float maxZ = fl == EnumFacing.SOUTH ? 1.25f : fl == EnumFacing.NORTH ? 1.25f : fw == EnumFacing.SOUTH ? 2 : .5f;
        float minY = pos < 35 ? .5f : -.5f;
        float maxY = pos < 35 ? 2f : 1f;
        if (pos % 15 >= 10) {
            minX += fl == EnumFacing.WEST ? 1 : fl == EnumFacing.EAST ? -1 : 0;
            maxX += fl == EnumFacing.WEST ? 1 : fl == EnumFacing.EAST ? -1 : 0;
            minZ += fl == EnumFacing.NORTH ? 1 : fl == EnumFacing.SOUTH ? -1 : 0;
            maxZ += fl == EnumFacing.NORTH ? 1 : fl == EnumFacing.SOUTH ? -1 : 0;
        }
        list.add(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        return list;
    }
    if ((pos == 21 || pos == 23 || pos == 26 || pos == 28) || (pos == 36 || pos == 38 || pos == 41 || pos == 43)) {
        List<AxisAlignedBB> list = Lists.newArrayList();
        if (pos % 5 == 3)
            fw = fw.getOpposite();
        float minX = fl == EnumFacing.WEST ? -.25f : fl == EnumFacing.EAST ? -.25f : fw == EnumFacing.WEST ? 0f : -.5f;
        float maxX = fl == EnumFacing.EAST ? 1.25f : fl == EnumFacing.WEST ? 1.25f : fw == EnumFacing.EAST ? 1f : 1.5f;
        float minZ = fl == EnumFacing.NORTH ? -.25f : fl == EnumFacing.SOUTH ? -.25f : fw == EnumFacing.NORTH ? 0 : -.5f;
        float maxZ = fl == EnumFacing.SOUTH ? 1.25f : fl == EnumFacing.NORTH ? 1.25f : fw == EnumFacing.SOUTH ? 1f : 1.5f;
        float minY = pos < 35 ? .5f : -.5f;
        float maxY = pos < 35 ? 2f : 1f;
        if (pos % 15 >= 10) {
            minX += fl == EnumFacing.WEST ? 1 : fl == EnumFacing.EAST ? -1 : 0;
            maxX += fl == EnumFacing.WEST ? 1 : fl == EnumFacing.EAST ? -1 : 0;
            minZ += fl == EnumFacing.NORTH ? 1 : fl == EnumFacing.SOUTH ? -1 : 0;
            maxZ += fl == EnumFacing.NORTH ? 1 : fl == EnumFacing.SOUTH ? -1 : 0;
        }
        list.add(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        return list;
    }
    return null;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EnumFacing(net.minecraft.util.EnumFacing)

Example 13 with AxisAlignedBB

use of net.minecraft.util.math.AxisAlignedBB in project ImmersiveEngineering by BluSunrize.

the class TileEntityCrusher 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 == 4) {
        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 > 20 && pos < 24) || (pos > 35 && pos < 39)) {
        List<AxisAlignedBB> list = new ArrayList<AxisAlignedBB>(3);
        float minY = .5f;
        float minX = (pos % 5 == 1 && fw == EnumFacing.EAST) || (pos % 5 == 3 && fw == EnumFacing.WEST) ? .4375f : 0;
        float maxX = (pos % 5 == 1 && fw == EnumFacing.WEST) || (pos % 5 == 3 && fw == EnumFacing.EAST) ? .5625f : 1;
        float minZ = (pos % 5 == 1 && fw == EnumFacing.SOUTH) || (pos % 5 == 3 && fw == EnumFacing.NORTH) ? .4375f : 0;
        float maxZ = (pos % 5 == 1 && fw == EnumFacing.NORTH) || (pos % 5 == 3 && fw == EnumFacing.SOUTH) ? .5625f : 1;
        if (pos > 20 && pos < 24)
            list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, .75f, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        else
            minY = 0;
        minX = (pos % 5 == 1 && fw == EnumFacing.EAST) || (pos % 5 == 3 && fw == EnumFacing.WEST) ? .1875f : (pos % 5 == 1 && fw == EnumFacing.WEST) || (pos % 5 == 3 && fw == EnumFacing.EAST) ? .5625f : 0;
        maxX = (pos % 5 == 1 && fw == EnumFacing.WEST) || (pos % 5 == 3 && fw == EnumFacing.EAST) ? .8125f : (pos % 5 == 1 && fw == EnumFacing.EAST) || (pos % 5 == 3 && fw == EnumFacing.WEST) ? .4375f : 1;
        minZ = (pos % 5 == 1 && fw == EnumFacing.SOUTH) || (pos % 5 == 3 && fw == EnumFacing.NORTH) ? .1875f : (pos % 5 == 1 && fw == EnumFacing.NORTH) || (pos % 5 == 3 && fw == EnumFacing.SOUTH) ? .5625f : 0;
        maxZ = (pos % 5 == 1 && fw == EnumFacing.NORTH) || (pos % 5 == 3 && fw == EnumFacing.SOUTH) ? .8125f : (pos % 5 == 1 && fw == EnumFacing.SOUTH) || (pos % 5 == 3 && fw == EnumFacing.NORTH) ? .4375f : 1;
        list.add(new AxisAlignedBB(minX, minY, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        return list;
    }
    if ((pos > 15 && pos < 19) || (pos > 30 && pos < 34) || (pos > 25 && pos < 29) || (pos > 40 && pos < 44)) {
        if (pos % 15 > 9)
            fl = fl.getOpposite();
        List<AxisAlignedBB> list = new ArrayList<AxisAlignedBB>(3);
        float minY = .5f;
        float minX = (pos % 5 == 1 && fw == EnumFacing.EAST) || (pos % 5 == 3 && fw == EnumFacing.WEST) ? .4375f : fl == EnumFacing.EAST ? .4375f : 0;
        float maxX = (pos % 5 == 1 && fw == EnumFacing.WEST) || (pos % 5 == 3 && fw == EnumFacing.EAST) ? .5625f : fl == EnumFacing.WEST ? .5625f : 1;
        float minZ = (pos % 5 == 1 && fw == EnumFacing.SOUTH) || (pos % 5 == 3 && fw == EnumFacing.NORTH) ? .4375f : fl == EnumFacing.SOUTH ? .4375f : 0;
        float maxZ = (pos % 5 == 1 && fw == EnumFacing.NORTH) || (pos % 5 == 3 && fw == EnumFacing.SOUTH) ? .5625f : fl == EnumFacing.NORTH ? .5625f : 1;
        if ((pos > 15 && pos < 19) || (pos > 25 && pos < 29))
            list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, .75f, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        else
            minY = 0;
        if (pos / 15 > 9)
            fl = fl.getOpposite();
        minX = (pos % 5 == 1 && fw == EnumFacing.EAST) || (pos % 5 == 3 && fw == EnumFacing.WEST) ? .1875f : fl == EnumFacing.EAST ? .1875f : fl == EnumFacing.WEST ? .5625f : 0;
        maxX = (pos % 5 == 1 && fw == EnumFacing.WEST) || (pos % 5 == 3 && fw == EnumFacing.EAST) ? .8125f : fl == EnumFacing.WEST ? .8125f : fl == EnumFacing.EAST ? .4375f : 1;
        minZ = (pos % 5 == 1 && fw == EnumFacing.SOUTH) || (pos % 5 == 3 && fw == EnumFacing.NORTH) ? .1875f : fl == EnumFacing.SOUTH ? .1875f : fl == EnumFacing.NORTH ? .5625f : 0;
        maxZ = (pos % 5 == 1 && fw == EnumFacing.NORTH) || (pos % 5 == 3 && fw == EnumFacing.SOUTH) ? .8125f : fl == EnumFacing.NORTH ? .8125f : fl == EnumFacing.SOUTH ? .4375f : 1;
        list.add(new AxisAlignedBB(minX, minY, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        if (pos != 17 && pos != 32 && pos != 27 && pos != 42) {
            minX = (pos % 5 == 1 && fw == EnumFacing.EAST) || (pos % 5 == 3 && fw == EnumFacing.WEST) ? .1875f : fl == EnumFacing.EAST ? .4375f : fl == EnumFacing.WEST ? 0 : .5625f;
            maxX = (pos % 5 == 1 && fw == EnumFacing.WEST) || (pos % 5 == 3 && fw == EnumFacing.EAST) ? .8125f : fl == EnumFacing.WEST ? .5625f : fl == EnumFacing.EAST ? 1 : .4375f;
            minZ = (pos % 5 == 1 && fw == EnumFacing.SOUTH) || (pos % 5 == 3 && fw == EnumFacing.NORTH) ? .1875f : fl == EnumFacing.SOUTH ? .4375f : fl == EnumFacing.NORTH ? 0 : .5625f;
            maxZ = (pos % 5 == 1 && fw == EnumFacing.NORTH) || (pos % 5 == 3 && fw == EnumFacing.SOUTH) ? .8125f : fl == EnumFacing.NORTH ? .5625f : fl == EnumFacing.SOUTH ? 1 : .4375f;
            list.add(new AxisAlignedBB(minX, minY, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
            if (pos % 15 % 10 == 1)
                fw = fw.getOpposite();
            if ((pos > 15 && pos < 19) || (pos > 25 && pos < 29)) {
                minX = fl == EnumFacing.WEST ? .5f : fl == EnumFacing.EAST ? .25f : fw == EnumFacing.EAST ? .5f : .25f;
                maxX = fl == EnumFacing.EAST ? .5f : fl == EnumFacing.WEST ? .75f : fw == EnumFacing.EAST ? .75f : .5f;
                minZ = fl == EnumFacing.NORTH ? .5f : fl == EnumFacing.SOUTH ? .25f : fw == EnumFacing.SOUTH ? .5f : .25f;
                maxZ = fl == EnumFacing.SOUTH ? .5f : fl == EnumFacing.NORTH ? .75f : fw == EnumFacing.SOUTH ? .75f : .5f;
                list.add(new AxisAlignedBB(minX, 0, minZ, maxX, .5f, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
            }
        }
        return list;
    }
    if (pos == 1 || pos == 3 || pos == 11 || pos == 13) {
        List<AxisAlignedBB> list = Lists.newArrayList(new AxisAlignedBB(0, 0, 0, 1, .5f, 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        if (pos % 15 > 9)
            fl = fl.getOpposite();
        if (pos % 15 % 10 == 1)
            fw = fw.getOpposite();
        float minX = fl == EnumFacing.WEST ? .5f : fl == EnumFacing.EAST ? .25f : fw == EnumFacing.EAST ? .5f : .25f;
        float maxX = fl == EnumFacing.EAST ? .5f : fl == EnumFacing.WEST ? .75f : fw == EnumFacing.EAST ? .75f : .5f;
        float minZ = fl == EnumFacing.NORTH ? .5f : fl == EnumFacing.SOUTH ? .25f : fw == EnumFacing.SOUTH ? .5f : .25f;
        float maxZ = fl == EnumFacing.SOUTH ? .5f : fl == EnumFacing.NORTH ? .75f : fw == EnumFacing.SOUTH ? .75f : .5f;
        list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        return list;
    }
    return null;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EnumFacing(net.minecraft.util.EnumFacing) ArrayList(java.util.ArrayList)

Example 14 with AxisAlignedBB

use of net.minecraft.util.math.AxisAlignedBB in project ImmersiveEngineering by BluSunrize.

the class TileEntityExcavator method getAdvancedSelectionBounds.

@Override
public List<AxisAlignedBB> getAdvancedSelectionBounds() {
    EnumFacing fl = facing;
    EnumFacing fw = facing.rotateY();
    if (mirrored)
        fw = fw.getOpposite();
    if (pos == 5 || pos == 23 || pos == 41) {
        List list = Lists.newArrayList(new AxisAlignedBB(fw == EnumFacing.WEST ? .5f : 0, 0, fw == EnumFacing.NORTH ? .5f : 0, fw == EnumFacing.EAST ? .5f : 1, 1, fw == EnumFacing.SOUTH ? .5f : 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        list.add(new AxisAlignedBB(fw == EnumFacing.EAST ? .5f : fw == EnumFacing.WEST ? 0 : .25f, .25f, fw == EnumFacing.SOUTH ? .5f : fw == EnumFacing.NORTH ? 0 : .25f, fw == EnumFacing.WEST ? .5f : fw == EnumFacing.EAST ? 1 : .75f, .75f, fw == EnumFacing.NORTH ? .5f : fw == EnumFacing.SOUTH ? 1 : .75f).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        return list;
    } else if (pos == 9 || pos == 12 || pos == 15) {
        List list = Lists.newArrayList(new AxisAlignedBB(fw == EnumFacing.EAST ? .5f : 0, 0, fw == EnumFacing.SOUTH ? .5f : 0, fw == EnumFacing.WEST ? .5f : 1, 1, fw == EnumFacing.NORTH ? .5f : 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        if (pos == 9)
            list.add(new AxisAlignedBB(fw == EnumFacing.WEST || fl == EnumFacing.EAST ? .5f : 0, .5f, fw == EnumFacing.NORTH || fl == EnumFacing.SOUTH ? .5f : 0, fw == EnumFacing.EAST || fl == EnumFacing.WEST ? .5f : 1, 1, fw == EnumFacing.SOUTH || fl == EnumFacing.NORTH ? .5f : 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        else if (pos == 12)
            list.add(new AxisAlignedBB(fw == EnumFacing.WEST ? .5f : 0, .5f, fw == EnumFacing.NORTH ? .5f : 0, fw == EnumFacing.EAST ? .5f : 1, 1, fw == EnumFacing.SOUTH ? .5f : 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        else
            list.add(new AxisAlignedBB(fw == EnumFacing.WEST || fl == EnumFacing.WEST ? .5f : 0, .5f, fw == EnumFacing.NORTH || fl == EnumFacing.NORTH ? .5f : 0, fw == EnumFacing.EAST || fl == EnumFacing.EAST ? .5f : 1, 1, fw == EnumFacing.SOUTH || fl == EnumFacing.SOUTH ? .5f : 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        return list;
    } else if (pos == 47) {
        List list = Lists.newArrayList(new AxisAlignedBB(fl == EnumFacing.EAST ? .5f : fl == EnumFacing.WEST ? .375f : 0, 0, fl == EnumFacing.SOUTH ? .5f : fl == EnumFacing.NORTH ? .375f : 0, fl == EnumFacing.WEST ? .5f : fl == EnumFacing.EAST ? .625f : 1, 1, fl == EnumFacing.NORTH ? .5f : fl == EnumFacing.SOUTH ? .625f : 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        list.add(new AxisAlignedBB(fl == EnumFacing.EAST ? .625f : fw == EnumFacing.EAST ? .875f : 0, 0, fl == EnumFacing.SOUTH ? .625f : fw == EnumFacing.SOUTH ? .875f : 0, fl == EnumFacing.WEST ? .375f : fw == EnumFacing.WEST ? .125f : 1, 1, fl == EnumFacing.NORTH ? .375f : fw == EnumFacing.NORTH ? .125f : 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        return list;
    } else if (pos == 53) {
        List list = Lists.newArrayList(new AxisAlignedBB(fl == EnumFacing.WEST ? .5f : fl == EnumFacing.EAST ? .375f : 0, 0, fl == EnumFacing.NORTH ? .5f : fl == EnumFacing.SOUTH ? .375f : 0, fl == EnumFacing.EAST ? .5f : fl == EnumFacing.WEST ? .625f : 1, 1, fl == EnumFacing.SOUTH ? .5f : fl == EnumFacing.NORTH ? .625f : 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        list.add(new AxisAlignedBB(fl == EnumFacing.WEST ? .625f : fw == EnumFacing.EAST ? .875f : 0, 0, fl == EnumFacing.NORTH ? .625f : fw == EnumFacing.SOUTH ? .875f : 0, fl == EnumFacing.EAST ? .375f : fw == EnumFacing.WEST ? .125f : 1, 1, fl == EnumFacing.SOUTH ? .375f : fw == EnumFacing.NORTH ? .125f : 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        return list;
    }
    return null;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EnumFacing(net.minecraft.util.EnumFacing) ArrayList(java.util.ArrayList) List(java.util.List)

Example 15 with AxisAlignedBB

use of net.minecraft.util.math.AxisAlignedBB in project ImmersiveEngineering by BluSunrize.

the class TileEntityFermenter 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.1875f, 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 % 9 > 5)
            fl = fl.getOpposite();
        if (pos % 3 == 1)
            fw = fw.getOpposite();
        float minY = pos < 18 ? .1875f : -.8125f;
        float maxY = pos < 18 ? 2 : 1;
        float minX = fl == EnumFacing.WEST ? 0 : fl == EnumFacing.EAST ? .0625f : fw == EnumFacing.EAST ? .0625f : 0;
        float maxX = fl == EnumFacing.EAST ? 1 : fl == EnumFacing.WEST ? .9375f : fw == EnumFacing.EAST ? 1 : .9375f;
        float minZ = fl == EnumFacing.NORTH ? 0 : fl == EnumFacing.SOUTH ? .0625f : fw == EnumFacing.SOUTH ? .0625f : 0;
        float maxZ = fl == EnumFacing.SOUTH ? 1 : fl == EnumFacing.NORTH ? .9375f : fw == EnumFacing.SOUTH ? 1 : .9375f;
        list.add(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
        return list;
    }
    return null;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EnumFacing(net.minecraft.util.EnumFacing) ArrayList(java.util.ArrayList)

Aggregations

AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)127 EntityPlayer (net.minecraft.entity.player.EntityPlayer)34 BlockPos (net.minecraft.util.math.BlockPos)31 EntityLivingBase (net.minecraft.entity.EntityLivingBase)30 Entity (net.minecraft.entity.Entity)23 EnumFacing (net.minecraft.util.EnumFacing)22 IBlockState (net.minecraft.block.state.IBlockState)17 Vec3d (net.minecraft.util.math.Vec3d)17 ArrayList (java.util.ArrayList)11 ItemStack (net.minecraft.item.ItemStack)11 TileEntity (net.minecraft.tileentity.TileEntity)10 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)9 World (net.minecraft.world.World)9 Vector (ValkyrienWarfareBase.API.Vector)8 EntityItem (net.minecraft.entity.item.EntityItem)8 PotionEffect (net.minecraft.potion.PotionEffect)8 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)8 EntityAnimal (net.minecraft.entity.passive.EntityAnimal)6 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)6 Polygon (ValkyrienWarfareBase.Collision.Polygon)5