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();
}
}
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;
}
}
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;
}
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;
}
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;
}
Aggregations