diff options
Diffstat (limited to 'src/main/java/gregtech/common')
| -rw-r--r-- | src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java | 16 | ||||
| -rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java | 57 |
2 files changed, 59 insertions, 14 deletions
diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java index fe8a2b2697..db26ca6e71 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java @@ -544,14 +544,14 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { GregTech_API.registerCover(ItemList.Electric_Pump_UV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(524288)); GregTech_API.registerCover(ItemList.Electric_Pump_UHV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[9][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(1048576)); - ItemList.FluidRegulator_LV.set(addItem(tLastID = 660, "Fluid Regulator (LV)", "Configuable up to 640 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click", new Object[]{})); - ItemList.FluidRegulator_MV.set(addItem(tLastID = 661, "Fluid Regulator (MV)", "Configuable up to 2.560 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click", new Object[]{})); - ItemList.FluidRegulator_HV.set(addItem(tLastID = 662, "Fluid Regulator (HV)", "Configuable up to 10.240 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click", new Object[]{})); - ItemList.FluidRegulator_EV.set(addItem(tLastID = 663, "Fluid Regulator (EV)", "Configuable up to 40.960 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click", new Object[]{})); - ItemList.FluidRegulator_IV.set(addItem(tLastID = 664, "Fluid Regulator (IV)", "Configuable up to 163.840 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click", new Object[]{})); - ItemList.FluidRegulator_LuV.set(addItem(tLastID = 665, "Fluid Regulator (LuV)", "Configuable up to 655.360 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click", new Object[]{})); - ItemList.FluidRegulator_ZPM.set(addItem(tLastID = 666, "Fluid Regulator (ZPM)", "Configuable up to 2.621.440 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click", new Object[]{})); - ItemList.FluidRegulator_UV.set(addItem(tLastID = 667, "Fluid Regulator (UV)", "Configuable up to 10.485.760 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click", new Object[]{})); + ItemList.FluidRegulator_LV.set(addItem(tLastID = 660, "Fluid Regulator (LV)", "Configuable up to 640 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/tick per click", new Object[]{})); + ItemList.FluidRegulator_MV.set(addItem(tLastID = 661, "Fluid Regulator (MV)", "Configuable up to 2.560 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/tick per click", new Object[]{})); + ItemList.FluidRegulator_HV.set(addItem(tLastID = 662, "Fluid Regulator (HV)", "Configuable up to 10.240 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/tick per click", new Object[]{})); + ItemList.FluidRegulator_EV.set(addItem(tLastID = 663, "Fluid Regulator (EV)", "Configuable up to 40.960 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/tick per click", new Object[]{})); + ItemList.FluidRegulator_IV.set(addItem(tLastID = 664, "Fluid Regulator (IV)", "Configuable up to 163.840 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/tick per click", new Object[]{})); + ItemList.FluidRegulator_LuV.set(addItem(tLastID = 665, "Fluid Regulator (LuV)", "Configuable up to 655.360 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/tick per click", new Object[]{})); + ItemList.FluidRegulator_ZPM.set(addItem(tLastID = 666, "Fluid Regulator (ZPM)", "Configuable up to 2.621.440 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/tick per click", new Object[]{})); + ItemList.FluidRegulator_UV.set(addItem(tLastID = 667, "Fluid Regulator (UV)", "Configuable up to 10.485.760 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/tick per click", new Object[]{})); GregTech_API.registerCover(ItemList.FluidRegulator_LV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_FluidRegulator(32)); GregTech_API.registerCover(ItemList.FluidRegulator_MV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_FluidRegulator(128)); 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 b1480791e3..e322d018e2 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 @@ -12,6 +12,7 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; +import java.lang.Math; //Java was written by idiots import static gregtech.api.enums.GT_Values.VN; import static gregtech.api.enums.GT_Values.debugDriller; @@ -48,7 +49,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D protected String[] getDescriptionInternal(String tierSuffix) { String casings = getCasingBlockItem().get(0).getDisplayName(); return new String[]{ - "Controller Block for the Oil Drilling Rig " + (tierSuffix != null ? tierSuffix : ""), + "Controller Block for the Oil/Gas/Fluid Drilling Rig " + (tierSuffix != null ? tierSuffix : ""), "Size(WxHxD): 3x7x3", "Controller (Front middle at bottom)", "3x1x3 Base of " + casings, "1x3x1 " + casings + " pillar (Center of base)", @@ -112,19 +113,49 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D if (tFluid == null) return false; mOilId = tFluid.getFluidID(); } + if (debugDriller) { + GT_Log.out.println( + " Driller on fluid = " + mOilId + ); + } + tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0); if (mOilFieldChunks.isEmpty()) { Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); int range = getRangeInChunks(); - int xChunk = (tChunk.xPosition / range) * range; - int zChunk = (tChunk.zPosition / range) * range; + int xChunk = Math.floorDiv(tChunk.xPosition,range) * range; //Java was written by idiots. For negative values, / returns rounded towards zero. Fucking morons. + int zChunk = Math.floorDiv(tChunk.zPosition,range) * range; + if (debugDriller) { + GT_Log.out.println( + "tChunk.xPosition = " + tChunk.xPosition + + " tChunk.zPosition = " + tChunk.zPosition + + " xChunk = " + xChunk + + " zChunk = " + zChunk + ); + } for (int i = 0; i < range; i++) { for (int j = 0; j < range; j++) { + if (debugDriller) { + GT_Log.out.println( + " getChunkX = " + (xChunk + i) + + " getChunkZ = " + (zChunk + j) + ); + } tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i, zChunk + j); tFluid = undergroundOilReadInformation(tChunk); + if (debugDriller) { + GT_Log.out.println( + " Fluid in chunk = " + tFluid.getFluid().getID() + ); + } if (tOil.isFluidEqual(tFluid) && tFluid.amount > 0) { mOilFieldChunks.add(tChunk); + if (debugDriller) { + GT_Log.out.println( + " Matching fluid, quantity = " + tFluid.amount + ); + } } } } @@ -146,19 +177,33 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D " pump speed = " + speed ); } + + ArrayList<Chunk> emptyChunks = new ArrayList<Chunk>(); for (Chunk tChunk : mOilFieldChunks) { tFluid = undergroundOil(tChunk,speed); if (debugDriller) { GT_Log.out.println( " chunkX = " + tChunk.getChunkCoordIntPair().chunkXPos + - " chunkZ = " + tChunk.getChunkCoordIntPair().chunkZPos + - " Oil pumped = " + tFluid.amount + " chunkZ = " + tChunk.getChunkCoordIntPair().chunkZPos ); + if( tFluid != null ) { + GT_Log.out.println( + " Fluid pumped = " + tFluid.amount + ); + } else { + GT_Log.out.println( + " No fluid pumped " + ); + } + } - if (tFluid == null || tFluid.amount<1) mOilFieldChunks.remove(tChunk); + if (tFluid == null || tFluid.amount<1) emptyChunks.add(tChunk); if (tOil.isFluidEqual(tFluid)) tOil.amount += tFluid.amount; } + for( Chunk tChunk : emptyChunks) { + mOilFieldChunks.remove( tChunk ); + } return tOil.amount == 0 ? null : tOil; } } |
