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:
parent
0c52368524
commit
be7c5d7c49
1 changed files with 12 additions and 9 deletions
|
@ -1,11 +1,5 @@
|
||||||
package gregtech.common.tileentities.machines.multi;
|
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.gui.GT_GUIContainer_MultiMachine;
|
||||||
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
||||||
import gregtech.api.util.GT_Utility;
|
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.FluidRegistry;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
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 {
|
public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_DrillerBase {
|
||||||
|
|
||||||
private boolean completedCycle = false;
|
private boolean completedCycle = false;
|
||||||
|
@ -114,16 +114,19 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
|
||||||
if (mOilFieldChunks.isEmpty()) {
|
if (mOilFieldChunks.isEmpty()) {
|
||||||
Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord());
|
Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord());
|
||||||
int range = getRangeInChunks();
|
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 i = 0; i < range; i++) {
|
||||||
for (int j = 0; j < range; j++) {
|
for (int j = 0; j < range; j++) {
|
||||||
tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i, zChunk + j);
|
tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i, zChunk + j);
|
||||||
tFluid = undergroundOilReadInformation(tChunk);
|
tFluid = undergroundOilReadInformation(tChunk);
|
||||||
if (tOil.isFluidEqual(tFluid))
|
if (tOil.isFluidEqual(tFluid) && tFluid.amount > 0) {
|
||||||
mOilFieldChunks.add(tChunk);
|
mOilFieldChunks.add(tChunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (mOilFieldChunks.isEmpty()) return false;
|
if (mOilFieldChunks.isEmpty()) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +136,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
|
||||||
FluidStack tFluid, tOil;
|
FluidStack tFluid, tOil;
|
||||||
tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0);
|
tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0);
|
||||||
for (Chunk tChunk : mOilFieldChunks) {
|
for (Chunk tChunk : mOilFieldChunks) {
|
||||||
tFluid = undergroundOil(getBaseMetaTileEntity(),speed);
|
tFluid = undergroundOil(tChunk, speed);
|
||||||
if (tFluid == null) mOilFieldChunks.remove(tChunk);
|
if (tFluid == null) mOilFieldChunks.remove(tChunk);
|
||||||
if (tOil.isFluidEqual(tFluid)) tOil.amount += tFluid.amount;
|
if (tOil.isFluidEqual(tFluid)) tOil.amount += tFluid.amount;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue