From 6d0cb6ec9146fd98d9b0671a7be92f9fe647d4e1 Mon Sep 17 00:00:00 2001 From: kaziu687 Date: Thu, 1 Oct 2020 21:06:14 +0200 Subject: Update BaseMetaTileEntity.java Fixes problem that may cause explosion on Thermos servers with load-chunks-on-request: false When machine stays at the edge of loaded chunk (where siblings is not loaded) worldObj.getPrecipitationHeight will return -1 (cuz chunk wont be loaded on request). Machine will explode even if there is a roof. --- src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 2a275a5354..7e711aaccd 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -448,10 +448,10 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (getRandomNumber(1000) == 0) { if ((getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord) - || (getCoverIDAtSide((byte) 2) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) - 1 < yCoord) - || (getCoverIDAtSide((byte) 3) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) - 1 < yCoord) - || (getCoverIDAtSide((byte) 4) == 0 && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) - 1 < yCoord) - || (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord)) { + || (getCoverIDAtSide((byte) 2) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) - 1 < yCoord && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) > -1) + || (getCoverIDAtSide((byte) 3) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) - 1 < yCoord && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) > -1) + || (getCoverIDAtSide((byte) 4) == 0 && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) - 1 < yCoord && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) > -1) + || (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord) && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) > -1) { if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) { if (getRandomNumber(10) == 0) { try{ -- cgit From b9170d551d95e9fe61234397dbd5ae67df2b6149 Mon Sep 17 00:00:00 2001 From: kaziu687 Date: Thu, 1 Oct 2020 22:41:24 +0200 Subject: worldObj.getPrecipitationHeight moved to variable --- .../gregtech/api/metatileentity/BaseMetaTileEntity.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 7e711aaccd..cfb34eb34e 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -447,11 +447,16 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE } if (getRandomNumber(1000) == 0) { + int precipitationHeightAtSide2 = worldObj.getPrecipitationHeight(xCoord, zCoord - 1); + int precipitationHeightAtSide3 = worldObj.getPrecipitationHeight(xCoord, zCoord + 1); + int precipitationHeightAtSide4 = worldObj.getPrecipitationHeight(xCoord - 1, zCoord); + int precipitationHeightAtSide5 = worldObj.getPrecipitationHeight(xCoord + 1, zCoord); + if ((getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord) - || (getCoverIDAtSide((byte) 2) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) - 1 < yCoord && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) > -1) - || (getCoverIDAtSide((byte) 3) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) - 1 < yCoord && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) > -1) - || (getCoverIDAtSide((byte) 4) == 0 && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) - 1 < yCoord && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) > -1) - || (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord) && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) > -1) { + || (getCoverIDAtSide((byte) 2) == 0 && precipitationHeightAtSide2 - 1 < yCoord && precipitationHeightAtSide2 > -1) + || (getCoverIDAtSide((byte) 3) == 0 && precipitationHeightAtSide3 - 1 < yCoord && precipitationHeightAtSide3 > -1) + || (getCoverIDAtSide((byte) 4) == 0 && precipitationHeightAtSide4 - 1 < yCoord && precipitationHeightAtSide4 > -1) + || (getCoverIDAtSide((byte) 5) == 0 && precipitationHeightAtSide5 - 1 < yCoord && precipitationHeightAtSide5 > -1)) { if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) { if (getRandomNumber(10) == 0) { try{ -- cgit