mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-08 19:04:46 +00:00
fix npe in rendering of boilercasing #208
This commit is contained in:
2 files changed
+69
-13
No files matched your search
@@ -336,36 +336,97 @@ public class MekanismRenderer
|
||||
|
||||
if(object.shouldSideRender(ForgeDirection.DOWN))
|
||||
{
|
||||
renderBlocks.renderFaceYNeg(null, 0, 0, 0, object.getBlockTextureFromSide(0));
|
||||
IIcon icon = getRenderIcon(object, 0);
|
||||
|
||||
if(icon != null)
|
||||
{
|
||||
renderBlocks.renderFaceYNeg(null, 0, 0, 0, icon);
|
||||
}
|
||||
}
|
||||
|
||||
if(object.shouldSideRender(ForgeDirection.UP))
|
||||
{
|
||||
renderBlocks.renderFaceYPos(null, 0, 0, 0, object.getBlockTextureFromSide(1));
|
||||
IIcon icon = getRenderIcon(object, 1);
|
||||
|
||||
if(icon != null)
|
||||
{
|
||||
renderBlocks.renderFaceYPos(null, 0, 0, 0, icon);
|
||||
}
|
||||
}
|
||||
|
||||
if(object.shouldSideRender(ForgeDirection.NORTH))
|
||||
{
|
||||
renderBlocks.renderFaceZNeg(null, 0, 0, 0, object.getBlockTextureFromSide(2));
|
||||
IIcon icon = getRenderIcon(object, 2);
|
||||
|
||||
if(icon != null)
|
||||
{
|
||||
renderBlocks.renderFaceZNeg(null, 0, 0, 0, icon);
|
||||
}
|
||||
}
|
||||
|
||||
if(object.shouldSideRender(ForgeDirection.SOUTH))
|
||||
{
|
||||
renderBlocks.renderFaceZPos(null, 0, 0, 0, object.getBlockTextureFromSide(3));
|
||||
IIcon icon = getRenderIcon(object, 3);
|
||||
|
||||
if(icon != null)
|
||||
{
|
||||
renderBlocks.renderFaceZPos(null, 0, 0, 0, icon);
|
||||
}
|
||||
}
|
||||
|
||||
if(object.shouldSideRender(ForgeDirection.WEST))
|
||||
{
|
||||
renderBlocks.renderFaceXNeg(null, 0, 0, 0, object.getBlockTextureFromSide(4));
|
||||
IIcon icon = getRenderIcon(object, 4);
|
||||
|
||||
if(icon != null)
|
||||
{
|
||||
renderBlocks.renderFaceXNeg(null, 0, 0, 0, icon);
|
||||
}
|
||||
}
|
||||
|
||||
if(object.shouldSideRender(ForgeDirection.EAST))
|
||||
{
|
||||
renderBlocks.renderFaceXPos(null, 0, 0, 0, object.getBlockTextureFromSide(5));
|
||||
IIcon icon = getRenderIcon(object, 5);
|
||||
|
||||
if(icon != null)
|
||||
{
|
||||
renderBlocks.renderFaceXPos(null, 0, 0, 0, icon);
|
||||
}
|
||||
}
|
||||
|
||||
Tessellator.instance.draw();
|
||||
}
|
||||
|
||||
private static IIcon getRenderIcon(Model3D object, int side)
|
||||
{
|
||||
IIcon icon = object.getBlockTextureFromSide(side);
|
||||
|
||||
if(icon != null || object.baseBlock == null)
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
try {
|
||||
icon = object.baseBlock.getIcon(side, 0);
|
||||
}
|
||||
catch(Throwable ignored)
|
||||
{
|
||||
// Fall through to legacy fallback below.
|
||||
}
|
||||
|
||||
if(icon != null)
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
try {
|
||||
return object.baseBlock.getBlockTextureFromSide(side);
|
||||
}
|
||||
catch(Throwable ignored)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void color(EnumColor color)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -29,9 +28,6 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer
|
||||
private static Map<RenderData, DisplayInteger> cachedUpperFluids = new HashMap<RenderData, DisplayInteger>();
|
||||
private static Map<ValveRenderData, DisplayInteger> cachedValveFluids = new HashMap<ValveRenderData, DisplayInteger>();
|
||||
|
||||
private Fluid STEAM = FluidRegistry.getFluid("steam");
|
||||
private Fluid WATER = FluidRegistry.WATER;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
|
||||
{
|
||||
@@ -194,14 +190,13 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer
|
||||
|
||||
Model3D toReturn = new Model3D();
|
||||
toReturn.baseBlock = Blocks.water;
|
||||
toReturn.setTexture(fluid.getIcon());
|
||||
toReturn.setTexture(fluid == null ? null : fluid.getIcon());
|
||||
|
||||
final int stages = getStages(data.height);
|
||||
DisplayInteger display = DisplayInteger.createAndStart();
|
||||
|
||||
cachedUpperFluids.put(data, display);
|
||||
|
||||
if(STEAM.getIcon() != null)
|
||||
if(fluid != null && fluid.getIcon() != null)
|
||||
{
|
||||
toReturn.minX = 0 + .01;
|
||||
toReturn.minY = 0 + .01;
|
||||
|
||||
Reference in new issue
Block a user