From e8915b6a55cc98a558aaa9a5ab897845ca8f58da Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 16 Feb 2016 14:13:19 +0300 Subject: [PATCH] Added default levels for fluid extended properties in fluid model. --- .../java/net/minecraftforge/client/model/ModelFluid.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index 3337dabcc3..fdd3cda7f0 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -149,7 +149,8 @@ public class ModelFluid implements IModelCustomData IExtendedBlockState state = stateOption.get(); for(int i = 0; i < 4; i++) { - cornerRound[i] = Math.round(state.getValue(BlockFluidBase.LEVEL_CORNERS[i]) * 768); + Float level = state.getValue(BlockFluidBase.LEVEL_CORNERS[i]); + cornerRound[i] = Math.round((level == null ? 7f / 8 : level) * 768); } } return cornerRound; @@ -157,10 +158,11 @@ public class ModelFluid implements IModelCustomData private static int getFlow(Optional stateOption) { - float flow = -1000; + Float flow = -1000f; if(stateOption.isPresent()) { flow = stateOption.get().getValue(BlockFluidBase.FLOW_DIRECTION); + if(flow == null) flow = -1000f; } int flowRound = (int)Math.round(Math.toDegrees(flow)); flowRound = MathHelper.clamp_int(flowRound, -1000, 1000);