Search in sources :

Example 6 with TileEntityRedNetLogic

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();
}
Also used : TileEntityRedNetLogic(powercrystals.minefactoryreloaded.tile.rednet.TileEntityRedNetLogic)

Example 7 with TileEntityRedNetLogic

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());
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityRedNetLogic(powercrystals.minefactoryreloaded.tile.rednet.TileEntityRedNetLogic)

Aggregations

TileEntityRedNetLogic (powercrystals.minefactoryreloaded.tile.rednet.TileEntityRedNetLogic)7 TileEntity (net.minecraft.tileentity.TileEntity)6 ByteArrayInputStream (java.io.ByteArrayInputStream)2 DataInputStream (java.io.DataInputStream)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 TileEntityAutoJukebox (powercrystals.minefactoryreloaded.tile.machine.TileEntityAutoJukebox)2 TileEntityRedNetCable (powercrystals.minefactoryreloaded.tile.rednet.TileEntityRedNetCable)2 Entity (net.minecraft.entity.Entity)1 EntityLiving (net.minecraft.entity.EntityLiving)1 IInventory (net.minecraft.inventory.IInventory)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 World (net.minecraft.world.World)1 EntityRocket (powercrystals.minefactoryreloaded.entity.EntityRocket)1 TileEntityFactory (powercrystals.minefactoryreloaded.tile.base.TileEntityFactory)1 TileEntityConveyor (powercrystals.minefactoryreloaded.tile.conveyor.TileEntityConveyor)1 TileEntityAutoDisenchanter (powercrystals.minefactoryreloaded.tile.machine.TileEntityAutoDisenchanter)1 TileEntityAutoEnchanter (powercrystals.minefactoryreloaded.tile.machine.TileEntityAutoEnchanter)1 TileEntityAutoSpawner (powercrystals.minefactoryreloaded.tile.machine.TileEntityAutoSpawner)1 TileEntityBlockSmasher (powercrystals.minefactoryreloaded.tile.machine.TileEntityBlockSmasher)1