Search in sources :

Example 91 with AxisAlignedBB

use of net.minecraft.util.AxisAlignedBB in project ArsMagica2 by Mithion.

the class AffinityModifiers method isOnIce.

private boolean isOnIce(EntityPlayer ent) {
    AxisAlignedBB par1AxisAlignedBB = ent.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 - 1.0D);
    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);
    boolean isOnIce = false;
    for (int k1 = i; k1 < j && !isOnIce; ++k1) {
        for (int l1 = k; l1 < l && !isOnIce; ++l1) {
            for (int i2 = i1; i2 < j1 && !isOnIce; ++i2) {
                Block block = ent.worldObj.getBlock(k1, l1, i2);
                if (block == Blocks.ice) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) Block(net.minecraft.block.Block)

Example 92 with AxisAlignedBB

use of net.minecraft.util.AxisAlignedBB in project ArsMagica2 by Mithion.

the class Attract method getClosestEntityToPointWithin.

private EntityLivingBase getClosestEntityToPointWithin(EntityLivingBase caster, World world, AMVector3 point, double radius) {
    AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(point.x - radius, point.y - radius, point.z - radius, point.x + radius, point.y + radius, point.z + radius);
    List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, bb);
    EntityLivingBase closest = null;
    for (EntityLivingBase e : entities) {
        if (e == caster)
            continue;
        if (closest == null || point.distanceSqTo(new AMVector3(e)) < point.distanceSqTo(new AMVector3(closest)))
            closest = e;
    }
    return closest;
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) AMVector3(am2.api.math.AMVector3) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 93 with AxisAlignedBB

use of net.minecraft.util.AxisAlignedBB in project ArsMagica2 by Mithion.

the class Blink method CheckCoords.

private boolean CheckCoords(World world, int x, int y, int z) {
    if (y < 0) {
        return false;
    }
    Block firstBlock = world.getBlock(x, y, z);
    Block secondBlock = world.getBlock(x, y + 1, z);
    AxisAlignedBB firstBlockBB = null;
    AxisAlignedBB secondBlockBB = null;
    if (firstBlock != null) {
        firstBlockBB = firstBlock.getCollisionBoundingBoxFromPool(world, x, y, z);
    }
    if (secondBlock != null) {
        secondBlockBB = secondBlock.getCollisionBoundingBoxFromPool(world, x, y, z);
    }
    if ((firstBlockBB == null && secondBlockBB == null)) {
        return true;
    }
    return false;
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) Block(net.minecraft.block.Block)

Example 94 with AxisAlignedBB

use of net.minecraft.util.AxisAlignedBB in project Armourers-Workshop by RiskyKen.

the class TileEntityMannequin method getRenderBoundingBox.

@Override
public AxisAlignedBB getRenderBoundingBox() {
    AxisAlignedBB bb = INFINITE_EXTENT_AABB;
    bb = AxisAlignedBB.getBoundingBox(xCoord - 1, yCoord, zCoord - 1, xCoord + 2, yCoord + 3, zCoord + 2);
    return bb;
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB)

Example 95 with AxisAlignedBB

use of net.minecraft.util.AxisAlignedBB in project Armourers-Workshop by RiskyKen.

the class RenderBlockHologramProjector method renderTileEntityAt.

public void renderTileEntityAt(TileEntityHologramProjector tileEntity, double x, double y, double z, float partialTickTime) {
    if (tileEntity.getPowerMode() != PowerMode.IGNORED) {
        if (tileEntity.getPowerMode() == PowerMode.HIGH) {
            if (!tileEntity.isPowered()) {
                return;
            }
        } else {
            if (tileEntity.isPowered()) {
                return;
            }
        }
    }
    ItemStack itemStack = tileEntity.getStackInSlot(0);
    SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(itemStack);
    if (skinPointer == null) {
        return;
    }
    int rot = tileEntity.getBlockMetadata();
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_NORMALIZE);
    GL11.glTranslated(x + 0.5F, y + 0.5D, z + 0.5F);
    GL11.glRotatef(180, 0, 0, 1);
    if (rot == 1) {
        GL11.glRotatef(180, 0, 0, 1);
    }
    if (rot == 2) {
        GL11.glRotatef(90, -1, 0, 0);
    }
    if (rot == 3) {
        GL11.glRotatef(90, 1, 0, 0);
    }
    if (rot == 4) {
        GL11.glRotatef(90, 0, 0, -1);
    }
    if (rot == 5) {
        GL11.glRotatef(90, 0, 0, 1);
    }
    float scale = 0.0625F;
    GL11.glTranslated(tileEntity.getOffsetX() * scale, tileEntity.getOffsetY() * scale, tileEntity.getOffsetZ() * scale);
    GL11.glScalef(-1, -1, 1);
    int speedX = tileEntity.getRotationSpeedX();
    int speedY = tileEntity.getRotationSpeedY();
    int speedZ = tileEntity.getRotationSpeedZ();
    float angleX = 0;
    float angleY = 0;
    float angleZ = 0;
    if (speedX != 0) {
        angleX = (System.currentTimeMillis() % speedX);
        angleX = angleX / speedX * 360F;
    }
    if (speedY != 0) {
        angleY = (System.currentTimeMillis() % speedY);
        angleY = angleY / speedY * 360F;
    }
    if (speedZ != 0) {
        angleZ = (System.currentTimeMillis() % speedZ);
        angleZ = angleZ / speedZ * 360F;
    }
    if (!tileEntity.isGlowing()) {
        ForgeDirection dir = ForgeDirection.getOrientation(tileEntity.getBlockMetadata());
        float xLight = tileEntity.xCoord;
        float yLight = tileEntity.yCoord;
        float zLight = tileEntity.zCoord;
        float offsetX = tileEntity.getOffsetX();
        float offsetY = tileEntity.getOffsetY();
        float offsetZ = tileEntity.getOffsetZ();
        switch(dir) {
            case UP:
                xLight += offsetX * scale;
                yLight += offsetY * scale;
                zLight += offsetZ * scale;
                break;
            case DOWN:
                xLight += -offsetX * scale;
                yLight += -offsetY * scale;
                zLight += offsetZ * scale;
                break;
            case EAST:
                xLight += offsetY * scale;
                yLight += -offsetX * scale;
                zLight += offsetZ * scale;
                break;
            case WEST:
                xLight += -offsetY * scale;
                yLight += offsetX * scale;
                zLight += offsetZ * scale;
                break;
            case NORTH:
                xLight += offsetX * scale;
                yLight += -offsetZ * scale;
                zLight += -offsetY * scale;
                break;
            case SOUTH:
                xLight += -offsetX * scale;
                yLight += offsetY * scale;
                zLight += offsetZ * scale;
                break;
            default:
                break;
        }
        ModRenderHelper.setLightingForBlock(tileEntity.getWorldObj(), (int) (xLight + 0.5F), (int) (yLight + 0.5F), (int) (zLight + 0.5F));
    }
    GL11.glPushMatrix();
    GL11.glTranslated((-tileEntity.getRotationOffsetX() + tileEntity.getRotationOffsetX()) * scale, (-tileEntity.getRotationOffsetY() + tileEntity.getRotationOffsetY()) * scale, (-tileEntity.getRotationOffsetZ() + tileEntity.getRotationOffsetZ()) * scale);
    if (tileEntity.getAngleX() != 0) {
        GL11.glRotatef(tileEntity.getAngleX(), 1F, 0F, 0F);
    }
    if (tileEntity.getAngleY() != 0) {
        GL11.glRotatef(tileEntity.getAngleY(), 0F, 1F, 0F);
    }
    if (tileEntity.getAngleZ() != 0) {
        GL11.glRotatef(tileEntity.getAngleZ(), 0F, 0F, 1F);
    }
    if (angleX != 0) {
        GL11.glRotatef((float) angleX, 1, 0, 0);
    }
    if (angleY != 0) {
        GL11.glRotatef((float) angleY, 0, 1, 0);
    }
    if (angleZ != 0) {
        GL11.glRotatef((float) angleZ, 0, 0, 1);
    }
    GL11.glTranslated(tileEntity.getRotationOffsetX() * scale, tileEntity.getRotationOffsetY() * scale, tileEntity.getRotationOffsetZ() * scale);
    if (tileEntity.isGlowing()) {
        ModRenderHelper.disableLighting();
    }
    ModRenderHelper.enableAlphaBlend();
    Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
    ItemStackRenderHelper.renderSkinWithHelper(skin, skinPointer, true, false);
    GL11.glPopMatrix();
    if (tileEntity.isShowRotationPoint()) {
        AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(0, 0, 0, scale, scale, scale);
        renderBox(aabb, 1F, 0F, 1F);
    }
    ModRenderHelper.disableAlphaBlend();
    if (tileEntity.isGlowing()) {
        ModRenderHelper.enableLighting();
    }
    GL11.glDisable(GL11.GL_NORMALIZE);
    GL11.glPopMatrix();
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) ItemStack(net.minecraft.item.ItemStack)

Aggregations

AxisAlignedBB (net.minecraft.util.AxisAlignedBB)123 Entity (net.minecraft.entity.Entity)40 EntityPlayer (net.minecraft.entity.player.EntityPlayer)28 MovingObjectPosition (net.minecraft.util.MovingObjectPosition)24 TileEntity (net.minecraft.tileentity.TileEntity)20 Vec3 (net.minecraft.util.Vec3)20 ArrayList (java.util.ArrayList)16 ItemStack (net.minecraft.item.ItemStack)16 List (java.util.List)15 Block (net.minecraft.block.Block)15 EntityLivingBase (net.minecraft.entity.EntityLivingBase)15 EntityItem (net.minecraft.entity.item.EntityItem)13 SideOnly (cpw.mods.fml.relauncher.SideOnly)10 World (net.minecraft.world.World)7 Pos (com.builtbroken.mc.imp.transform.vector.Pos)6 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)6 Iterator (java.util.Iterator)5 BlockPos (net.minecraft.util.BlockPos)5 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)4 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)4