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
This commit is contained in:
Wo0kiee 2018-04-12 03:34:31 +06:00 committed by Blood-Asp
parent 0c52368524
commit be7c5d7c49

View file

@ -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;
}