From be7c5d7c4918282561eb9796d7d6ebb365f123d7 Mon Sep 17 00:00:00 2001 From: Wo0kiee <33743476+Wo0kiee@users.noreply.github.com> Date: Thu, 12 Apr 2018 03:34:31 +0600 Subject: [PATCH] Oil Drilling Rig fixes (#1410) * Fix Oil drilling rig With negative coordinates ODR get wrong location * Oil Drilling Rig fix ODR now gets right oil amount from chunk list. * ODR doesn't lift up pipes * ODR doesn't lift up pipes * GT_Log removed * ODR tier1 doesn't lift up pipes --- .../multi/GT_MetaTileEntity_OilDrillBase.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java index 5d760e62..5a8810b5 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java @@ -1,11 +1,5 @@ package gregtech.common.tileentities.machines.multi; -import static gregtech.api.enums.GT_Values.VN; -import static gregtech.common.GT_UndergroundOil.undergroundOil; -import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; - -import java.util.ArrayList; - import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; @@ -16,6 +10,12 @@ import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import java.util.ArrayList; + +import static gregtech.api.enums.GT_Values.VN; +import static gregtech.common.GT_UndergroundOil.undergroundOil; +import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; + public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_DrillerBase { private boolean completedCycle = false; @@ -114,13 +114,16 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D if (mOilFieldChunks.isEmpty()) { Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); int range = getRangeInChunks(); - int xChunk = (tChunk.xPosition / range) * range - (tChunk.xPosition < 0 ? range : 0), zChunk = (tChunk.zPosition / range) * range - (tChunk.zPosition < 0 ? range : 0); + int xChunk = (tChunk.xPosition / range) * range - ((tChunk.xPosition < 0 && tChunk.xPosition % range != 0) ? range : 0); + int zChunk = (tChunk.zPosition / range) * range - ((tChunk.zPosition < 0 && tChunk.zPosition % range != 0) ? range : 0); + for (int i = 0; i < range; i++) { for (int j = 0; j < range; j++) { tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i, zChunk + j); tFluid = undergroundOilReadInformation(tChunk); - if (tOil.isFluidEqual(tFluid)) + if (tOil.isFluidEqual(tFluid) && tFluid.amount > 0) { mOilFieldChunks.add(tChunk); + } } } } @@ -133,7 +136,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D FluidStack tFluid, tOil; tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0); for (Chunk tChunk : mOilFieldChunks) { - tFluid = undergroundOil(getBaseMetaTileEntity(),speed); + tFluid = undergroundOil(tChunk, speed); if (tFluid == null) mOilFieldChunks.remove(tChunk); if (tOil.isFluidEqual(tFluid)) tOil.amount += tFluid.amount; }