Sort out problems when the pony skulls are off

This commit is contained in:
Sollace 2018-06-20 23:41:08 +02:00
parent 00d4009a76
commit 232089bfad
2 changed files with 8 additions and 4 deletions

View file

@ -82,7 +82,7 @@ public class LevitatingItemRenderer {
IRenderItem renderItem = (IRenderItem)Minecraft.getMinecraft().getRenderItem(); IRenderItem renderItem = (IRenderItem)Minecraft.getMinecraft().getRenderItem();
renderItem.useTransparency(true); renderItem.useTransparency(true);
((IRenderItem)PonySkullRenderer.instance).useTransparency(true); PonySkullRenderer.ponyInstance.useTransparency(true);
setColor(pony.getMetadata().getGlowColor()); setColor(pony.getMetadata().getGlowColor());
@ -94,7 +94,8 @@ public class LevitatingItemRenderer {
renderer.renderItemSide(entity, stack, transform, left); renderer.renderItemSide(entity, stack, transform, left);
renderItem.useTransparency(false); renderItem.useTransparency(false);
((IRenderItem)PonySkullRenderer.instance).useTransparency(false); PonySkullRenderer.ponyInstance.useTransparency(false);
unsetColor(); unsetColor();
enableLighting(); enableLighting();
} }

View file

@ -24,7 +24,7 @@ import net.minecraft.util.ResourceLocation;
*/ */
public class PonySkullRenderer extends TileEntitySkullRenderer implements IRenderItem { public class PonySkullRenderer extends TileEntitySkullRenderer implements IRenderItem {
private static PonySkullRenderer ponyInstance = new PonySkullRenderer(); public static PonySkullRenderer ponyInstance = new PonySkullRenderer();
private static TileEntitySkullRenderer backup = null; private static TileEntitySkullRenderer backup = null;
private static final Map<Integer, ISkull> skullMap = new HashMap<Integer, ISkull>(); private static final Map<Integer, ISkull> skullMap = new HashMap<Integer, ISkull>();
@ -43,8 +43,11 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende
instance = ponyInstance; instance = ponyInstance;
} }
} else { } else {
if ((instance instanceof PonySkullRenderer) && backup != null) { if ((instance instanceof PonySkullRenderer)) {
ponyInstance = (PonySkullRenderer)instance; ponyInstance = (PonySkullRenderer)instance;
if (backup == null) {
backup = new TileEntitySkullRenderer();
}
ModUtilities.addRenderer(TileEntitySkull.class, backup); ModUtilities.addRenderer(TileEntitySkull.class, backup);
instance = backup; instance = backup;
} }