Create the EntityItem only when it's needed. Closes #178
This commit is contained in:
parent
a91739d57b
commit
ac7ab8ab3c
|
|
@ -49,7 +49,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
||||||
{ 0.5F, 0.32F, 0.5F } };
|
{ 0.5F, 0.32F, 0.5F } };
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
private static EntityItem customitem = new EntityItem(null);
|
private static EntityItem customItem;
|
||||||
|
|
||||||
private static float halfPI = (float) (Math.PI / 2D);
|
private static float halfPI = (float) (Math.PI / 2D);
|
||||||
|
|
||||||
|
|
@ -183,8 +183,12 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate((float) x, (float) y, (float) z);
|
GlStateManager.translate((float) x, (float) y, (float) z);
|
||||||
|
|
||||||
customitem.setWorld(this.getWorld());
|
if (customItem == null)
|
||||||
customitem.hoverStart = 0F;
|
{
|
||||||
|
customItem = new EntityItem(this.getWorld());
|
||||||
|
}
|
||||||
|
|
||||||
|
customItem.hoverStart = 0F;
|
||||||
|
|
||||||
for (ItemStack item : te.getTopItems())
|
for (ItemStack item : te.getTopItems())
|
||||||
{
|
{
|
||||||
|
|
@ -209,7 +213,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
||||||
GlStateManager.rotate(timeD, 0F, 1F, 0F);
|
GlStateManager.rotate(timeD, 0F, 1F, 0F);
|
||||||
GlStateManager.scale(blockScale, blockScale, blockScale);
|
GlStateManager.scale(blockScale, blockScale, blockScale);
|
||||||
|
|
||||||
customitem.setItem(item);
|
customItem.setItem(item);
|
||||||
|
|
||||||
if (this.itemRenderer == null)
|
if (this.itemRenderer == null)
|
||||||
{
|
{
|
||||||
|
|
@ -235,7 +239,7 @@ public class TileEntityIronChestRenderer extends TileEntitySpecialRenderer<TileE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.itemRenderer.doRender(customitem, 0D, 0D, 0D, 0F, partialTicks);
|
this.itemRenderer.doRender(customItem, 0D, 0D, 0D, 0F, partialTicks);
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class TileEntityIronShulkerBoxRenderer extends TileEntitySpecialRenderer<
|
||||||
private static float[][] shifts = { { 0.3F, 0.45F, 0.3F }, { 0.7F, 0.45F, 0.3F }, { 0.3F, 0.45F, 0.7F }, { 0.7F, 0.45F, 0.7F }, { 0.3F, 0.1F, 0.3F }, { 0.7F, 0.1F, 0.3F }, { 0.3F, 0.1F, 0.7F }, { 0.7F, 0.1F, 0.7F }, { 0.5F, 0.32F, 0.5F } };
|
private static float[][] shifts = { { 0.3F, 0.45F, 0.3F }, { 0.7F, 0.45F, 0.3F }, { 0.3F, 0.45F, 0.7F }, { 0.7F, 0.45F, 0.7F }, { 0.3F, 0.1F, 0.3F }, { 0.7F, 0.1F, 0.3F }, { 0.3F, 0.1F, 0.7F }, { 0.7F, 0.1F, 0.7F }, { 0.5F, 0.32F, 0.5F } };
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
private static EntityItem customitem = new EntityItem(null);
|
private static EntityItem customItem;
|
||||||
|
|
||||||
public TileEntityIronShulkerBoxRenderer()
|
public TileEntityIronShulkerBoxRenderer()
|
||||||
{
|
{
|
||||||
|
|
@ -174,8 +174,12 @@ public class TileEntityIronShulkerBoxRenderer extends TileEntitySpecialRenderer<
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate((float) x, (float) y, (float) z);
|
GlStateManager.translate((float) x, (float) y, (float) z);
|
||||||
|
|
||||||
customitem.setWorld(this.getWorld());
|
if (customItem == null)
|
||||||
customitem.hoverStart = 0F;
|
{
|
||||||
|
customItem = new EntityItem(this.getWorld());
|
||||||
|
}
|
||||||
|
|
||||||
|
customItem.hoverStart = 0F;
|
||||||
|
|
||||||
for (ItemStack item : te.getTopItems())
|
for (ItemStack item : te.getTopItems())
|
||||||
{
|
{
|
||||||
|
|
@ -200,7 +204,7 @@ public class TileEntityIronShulkerBoxRenderer extends TileEntitySpecialRenderer<
|
||||||
GlStateManager.rotate(timeD, 0F, 1F, 0F);
|
GlStateManager.rotate(timeD, 0F, 1F, 0F);
|
||||||
GlStateManager.scale(blockScale, blockScale, blockScale);
|
GlStateManager.scale(blockScale, blockScale, blockScale);
|
||||||
|
|
||||||
customitem.setItem(item);
|
customItem.setItem(item);
|
||||||
|
|
||||||
if (this.itemRenderer == null)
|
if (this.itemRenderer == null)
|
||||||
{
|
{
|
||||||
|
|
@ -226,7 +230,7 @@ public class TileEntityIronShulkerBoxRenderer extends TileEntitySpecialRenderer<
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.itemRenderer.doRender(customitem, 0D, 0D, 0D, 0F, partialTicks);
|
this.itemRenderer.doRender(customItem, 0D, 0D, 0D, 0F, partialTicks);
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue