Search in sources :

Example 6 with ForgeDirection

use of net.minecraftforge.common.util.ForgeDirection in project BluePower by Qmunity.

the class RenderEngine method renderTileEntityAt.

@SuppressWarnings("cast")
@Override
public void renderTileEntityAt(TileEntity engine, double x, double y, double z, float f) {
    if (engine instanceof TileEngine) {
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_LIGHTING);
        TileEngine tile = (TileEngine) engine.getWorldObj().getTileEntity(engine.xCoord, engine.yCoord, engine.zCoord);
        ForgeDirection direction = tile.getOrientation();
        GL11.glTranslated(x, y, z);
        GL11.glScaled(.0315, .0315, .0315);
        if (direction == ForgeDirection.UP) {
            GL11.glTranslated(16, 28, 16);
            GL11.glRotatef(180, 1, 0, 0);
        }
        if (direction == ForgeDirection.DOWN) {
            GL11.glTranslated(16, 4, 16);
            GL11.glRotatef(0, 0, 0, 0);
        }
        if (direction == ForgeDirection.EAST) {
            GL11.glTranslated(28, 16, 16);
            GL11.glRotatef(90, 0, 0, 1);
        }
        if (direction == ForgeDirection.WEST) {
            GL11.glTranslated(4, 16, 16);
            GL11.glRotatef(90, 0, 0, -1);
        }
        if (direction == ForgeDirection.NORTH) {
            GL11.glTranslated(16, 16, 4);
            GL11.glRotatef(90, 1, 0, 0);
        }
        if (direction == ForgeDirection.SOUTH) {
            GL11.glTranslated(16, 16, 28);
            GL11.glRotatef(90, -1, 0, 0);
        }
        if (tile.isActive) {
            bindTexture(textureLocationOn);
        } else {
            bindTexture(textureLocationOff);
        }
        engineModel.renderAllExcept("gear", "glider");
        if (tile.isActive) {
            f += tile.pumpTick;
            if (tile.pumpSpeed > 0) {
                f /= tile.pumpSpeed;
            }
        } else {
            f = 0;
        }
        f = (float) ((float) 6 * (.5 - .5 * Math.cos(3.1415926535897931D * (double) f)));
        GL11.glTranslatef(0, f, 0);
        engineModel.renderPart("glider");
        GL11.glTranslatef(0, -f, 0);
        if (tile.isActive) {
            if (tile.getWorldObj().isRemote) {
                rotateAmount++;
                GL11.glRotated(tile.gearTick * 19, 0, 1.5707963267948966D * (double) f, 0);
            }
        }
        engineModel.renderPart("gear");
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
    }
}
Also used : ForgeDirection(net.minecraftforge.common.util.ForgeDirection) TileEngine(com.bluepowermod.tile.tier3.TileEngine)

Example 7 with ForgeDirection

use of net.minecraftforge.common.util.ForgeDirection in project BluePower by Qmunity.

the class BlockMonitor method getIcon.

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
    TileMonitor tile = (TileMonitor) world.getTileEntity(x, y, z);
    ForgeDirection dir = tile.getFacingDirection();
    if (dir.ordinal() == side) {
        return frontTexture;
    } else if (dir.getOpposite().ordinal() == side) {
        return backTexture;
    } else if (ForgeDirection.UP.ordinal() == side) {
        return topTexture;
    } else if (ForgeDirection.DOWN.ordinal() == side) {
        return bottomTexture;
    } else {
        return sideTexture;
    }
}
Also used : TileMonitor(com.bluepowermod.tile.tier3.TileMonitor) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 8 with ForgeDirection

use of net.minecraftforge.common.util.ForgeDirection in project BluePower by Qmunity.

the class BlockAlloyFurnace method getIcon.

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
    TileAlloyFurnace te = (TileAlloyFurnace) world.getTileEntity(x, y, z);
    ForgeDirection forgeSide = ForgeDirection.getOrientation(side);
    if (forgeSide == ForgeDirection.UP)
        return textureTop;
    if (forgeSide == ForgeDirection.DOWN)
        return textureBottom;
    if (forgeSide == te.getFacingDirection())
        return te.getIsActive() ? textureFrontOn : textureFrontOff;
    return textureSide;
}
Also used : TileAlloyFurnace(com.bluepowermod.tile.tier1.TileAlloyFurnace) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 9 with ForgeDirection

use of net.minecraftforge.common.util.ForgeDirection in project BluePower by Qmunity.

the class BlockIgniter method rotateBlock.

@Override
public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis) {
    TileEntity te = worldObj.getTileEntity(x, y, z);
    if (te instanceof IRotatable) {
        IRotatable rotatable = (IRotatable) te;
        ForgeDirection dir = rotatable.getFacingDirection();
        Block target = worldObj.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
        if (target == Blocks.fire || target == Blocks.portal) {
            worldObj.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, Blocks.air);
        }
        dir = dir.getRotation(axis);
        if (dir != ForgeDirection.UP && dir != ForgeDirection.DOWN || canRotateVertical()) {
            rotatable.setFacingDirection(dir);
            return true;
        }
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IRotatable(com.bluepowermod.tile.IRotatable) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) Block(net.minecraft.block.Block)

Example 10 with ForgeDirection

use of net.minecraftforge.common.util.ForgeDirection in project BluePower by Qmunity.

the class BlockProjectTable method getIcon.

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
    IRotatable rotatable = (IRotatable) world.getTileEntity(x, y, z);
    ForgeDirection s = ForgeDirection.getOrientation(side);
    if (rotatable.getFacingDirection() == s) {
        return textureFront;
    }
    switch(s) {
        case UP:
            return textureTop;
        case DOWN:
            return textureBottom;
        case EAST:
        case NORTH:
        case SOUTH:
        case WEST:
        case UNKNOWN:
            return textureSide;
        default:
            break;
    }
    return null;
}
Also used : IRotatable(com.bluepowermod.tile.IRotatable) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

ForgeDirection (net.minecraftforge.common.util.ForgeDirection)242 TileEntity (net.minecraft.tileentity.TileEntity)80 ItemStack (net.minecraft.item.ItemStack)47 ArrayList (java.util.ArrayList)29 Block (net.minecraft.block.Block)28 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)24 LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)21 IInventory (net.minecraft.inventory.IInventory)19 FluidStack (net.minecraftforge.fluids.FluidStack)18 SideOnly (cpw.mods.fml.relauncher.SideOnly)17 CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)17 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)17 IFluidHandler (net.minecraftforge.fluids.IFluidHandler)16 HashMap (java.util.HashMap)12 Pair (logisticspipes.utils.tuples.Pair)11 MovingObjectPosition (net.minecraft.util.MovingObjectPosition)10 World (net.minecraft.world.World)10 IRoutedItem (logisticspipes.logisticspipes.IRoutedItem)9 ItemIdentifier (logisticspipes.utils.item.ItemIdentifier)9 List (java.util.List)8