From 28694dac932c64c331011b6aa24a0d1c500d9473 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 9 May 2017 06:39:35 +0200 Subject: [PATCH] Fix that so pollution is not negative. --- src/main/java/gregtech/common/GT_Pollution.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/gregtech/common/GT_Pollution.java b/src/main/java/gregtech/common/GT_Pollution.java index 4ab0c97d..23dd3ad0 100644 --- a/src/main/java/gregtech/common/GT_Pollution.java +++ b/src/main/java/gregtech/common/GT_Pollution.java @@ -242,9 +242,13 @@ public class GT_Pollution { dataMap=new HashMap<>(1024); dimensionWiseChunkData.put(ch.worldObj.provider.dimensionId,dataMap); } - if(dataMap.get(ch.getChunkCoordIntPair())==null) - dataMap.put(ch.getChunkCoordIntPair(),getDefaultChunkDataOnCreation()); - dataMap.get(ch.getChunkCoordIntPair())[GTPOLLUTION]+=aPollution; + int[] dataArr=dataMap.get(ch.getChunkCoordIntPair()); + if(dataArr==null){ + dataArr=getDefaultChunkDataOnCreation(); + dataMap.put(ch.getChunkCoordIntPair(),dataArr); + } + dataArr[GTPOLLUTION]+=aPollution; + if(dataArr[GTPOLLUTION]<0)dataArr[GTPOLLUTION]=0; } public static int getPollution(IGregTechTileEntity te){