use of powercrystals.minefactoryreloaded.tile.rednet.TileEntityRedNetLogic in project MineFactoryReloaded by powercrystals.
the class RedNetLogicRenderer method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
TileEntityRedNetLogic logic = (TileEntityRedNetLogic) tileentity;
int rotation = tileentity.worldObj.getBlockMetadata(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
bindTextureByName(MineFactoryReloadedCore.tileEntityFolder + "redcomp.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5f, (float) z + 0.5F);
// Techne sucks so do some crazy rotations to turn techne coords into
// real coords
GL11.glRotatef(180, 0, 0, 1);
GL11.glRotatef(180 + (90 * rotation), 0, 1, 0);
// Render the base, with no cards or slots
_logicModel.render(0.0625f);
// Manually translate and then render each slot with the cards texture
// up
bindTextureByName(MineFactoryReloadedCore.tileEntityFolder + "cards.png");
GL11.glTranslatef(-0.4375f, -0.375f, -0.390625f);
renderCard(logic.getLevelForSlot(0));
GL11.glTranslatef(0, 0, 0.234375f);
renderCard(logic.getLevelForSlot(1));
GL11.glTranslatef(0, 0, 0.234375f);
renderCard(logic.getLevelForSlot(2));
GL11.glTranslatef(0, 0.375f, -0.46875f);
renderCard(logic.getLevelForSlot(3));
GL11.glTranslatef(0, 0, 0.234375f);
renderCard(logic.getLevelForSlot(4));
GL11.glTranslatef(0, 0, 0.234375f);
renderCard(logic.getLevelForSlot(5));
GL11.glPopMatrix();
}
use of powercrystals.minefactoryreloaded.tile.rednet.TileEntityRedNetLogic in project MineFactoryReloaded by powercrystals.
the class BlockRedNetLogic method onBlockPlacedBy.
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entity, ItemStack stack) {
if (entity == null) {
return;
}
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te instanceof TileEntityRedNetLogic) {
int facing = MathHelper.floor_double((entity.rotationYaw * 4F) / 360F + 0.5D) & 3;
if (facing == 0) {
world.setBlockMetadataWithNotify(x, y, z, 3, 3);
} else if (facing == 1) {
world.setBlockMetadataWithNotify(x, y, z, 0, 3);
} else if (facing == 2) {
world.setBlockMetadataWithNotify(x, y, z, 1, 3);
} else if (facing == 3) {
world.setBlockMetadataWithNotify(x, y, z, 2, 3);
}
if (stack.hasTagCompound()) {
stack.getTagCompound().setInteger("x", x);
stack.getTagCompound().setInteger("y", y);
stack.getTagCompound().setInteger("z", z);
te.readFromNBT(stack.getTagCompound());
}
}
}
Aggregations