76 lines
2.7 KiB
Java
Executable file
76 lines
2.7 KiB
Java
Executable file
package game.renderer.tileentity;
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
import game.block.Block;
|
|
import game.init.Blocks;
|
|
import game.init.Items;
|
|
import game.item.ItemStack;
|
|
import game.renderer.GlState;
|
|
import game.tileentity.TileEntityBanner;
|
|
import game.tileentity.TileEntityChest;
|
|
import game.tileentity.TileEntitySkull;
|
|
import game.world.Facing;
|
|
|
|
public class TileEntityItemStackRenderer
|
|
{
|
|
public static TileEntityItemStackRenderer instance = new TileEntityItemStackRenderer();
|
|
private TileEntityChest field_147717_b = new TileEntityChest(0);
|
|
private TileEntityChest field_147718_c = new TileEntityChest(1);
|
|
// private TileEntityWarpChest warpChest = new TileEntityWarpChest();
|
|
private TileEntityBanner banner = new TileEntityBanner();
|
|
private TileEntitySkull skull = new TileEntitySkull();
|
|
|
|
public void renderByItem(ItemStack itemStackIn)
|
|
{
|
|
if (itemStackIn.getItem() == Items.banner)
|
|
{
|
|
this.banner.setItemValues(itemStackIn);
|
|
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F);
|
|
}
|
|
else if (itemStackIn.getItem() == Items.skull)
|
|
{
|
|
// String user = null;
|
|
//
|
|
// if (itemStackIn.hasTagCompound())
|
|
// {
|
|
// NBTTagCompound nbttagcompound = itemStackIn.getTagCompound();
|
|
//
|
|
// if (nbttagcompound.hasKey("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0)
|
|
// {
|
|
// user = nbttagcompound.getString("SkullOwner");
|
|
// }
|
|
// }
|
|
|
|
if (TileEntitySkullRenderer.instance != null)
|
|
{
|
|
GL11.glPushMatrix();
|
|
GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
|
|
GL11.glScalef(2.0F, 2.0F, 2.0F);
|
|
boolean flag = GlState.isCullEbabled();
|
|
GlState.disableCull();
|
|
TileEntitySkullRenderer.instance.renderSkull(0.0F, 0.0F, 0.0F, Facing.UP, 0.0F, -1);
|
|
if(flag)
|
|
GlState.enableCull();
|
|
GL11.glPopMatrix();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Block block = itemStackIn.getItem().getBlock();
|
|
|
|
// if (block == Blocks.warp_chest)
|
|
// {
|
|
// TileEntityRendererDispatcher.instance.renderTileEntityAt(this.warpChest, 0.0D, 0.0D, 0.0D, 0.0F);
|
|
// }
|
|
if (block == Blocks.trapped_chest)
|
|
{
|
|
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F);
|
|
}
|
|
else
|
|
{
|
|
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F);
|
|
}
|
|
}
|
|
}
|
|
}
|