From a200e8bd2ffea5a93ec5a783ceb5c752d3c32e76 Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Tue, 29 Oct 2019 16:36:36 +0100 Subject: Revert "small Assembly Line fix" This reverts commit 8de068fbf425162c75793d795c6296d03003d49e. --- .../machines/multi/GT_MetaTileEntity_AssemblyLine.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java index 2a2cb978b7..20752dfad7 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -86,7 +86,7 @@ public class GT_MetaTileEntity_AssemblyLine if(GT_Values.D1) GT_FML_LOGGER.info("Stick accepted, " + tDataStickList.size() + " Data Sticks found"); - ItemStack[] tStack = new ItemStack[15]; + ItemStack tStack[] = new ItemStack[15]; FluidStack[] tFluids = new FluidStack[4]; boolean findRecipe = false; nextDS:for (ItemStack tDataStick : tDataStickList){ @@ -144,7 +144,7 @@ public class GT_MetaTileEntity_AssemblyLine continue nextDS; } FluidStack fluidInHatch = mInputHatches.get(i).mFluid; - if (!GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) { + if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) { if(GT_Values.D1) GT_FML_LOGGER.info(i+" not accepted"); continue nextDS; @@ -171,17 +171,11 @@ public class GT_MetaTileEntity_AssemblyLine continue; mEUt = tTag.getInteger("eu"); - if (Math.abs(this.mEUt) > this.getMaxInputVoltage()) { - if(GT_Values.D1) - GT_FML_LOGGER.info("Found avaiable recipe, but Voltage too low!"); - return false; - } if(GT_Values.D1)GT_FML_LOGGER.info("Find avaiable recipe"); findRecipe = true; break; } - if (!findRecipe) - return false; + if (!findRecipe) return false; if(GT_Values.D1)GT_FML_LOGGER.info("All checked start consuming inputs"); for (int i = 0; i < 15; i++) { -- cgit From 0690e90df4f98978e71bfdae7cffa3236fef4b8b Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Wed, 6 Nov 2019 21:50:07 +0100 Subject: Bricked Blast furnace wrong bricks in description #5082 https://github.com/GTNewHorizons/NewHorizons/issues/5082 --- .../machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java | 2 +- .../common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java index 6a6ed14663..95b45e2cc4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java @@ -31,7 +31,7 @@ public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_Pri "Controller has to be placed in the (front) center of the second layer", "Useable for Steel and general Pyrometallurgy", "Size(WxHxD): 3x4x3 (Hollow, with opening on top)", - "Built from 32 Fired Brick Blocks", + "Built from 32 Firebricks", "Causes 200 Pollution per second"}; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java index 46c9acd232..d6e31418f5 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java @@ -40,7 +40,7 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas "Controller Block for the Cleanroom", "Min(WxHxD): 3x4x3 (Hollow), Max(WxHxD): 15x15x15 (Hollow)", "Controller (Top center)", - "Top besides contoller and edges: Filter Casings", + "Top besides contoller and edges: Filter Machine Casing", "1 Reinforced Door (keep closed for 100% efficency)", "1x LV or 1x MV Energy Hatch, 1x Maintainance Hatch", "Up to 10 Machine Hull Item & Energy transfer through walls", -- cgit From 96db49fa7dd72899d2255a19b269e66e9acb8d19 Mon Sep 17 00:00:00 2001 From: Bass Date: Tue, 26 Nov 2019 06:54:00 +0000 Subject: Range config for single block miners Adds screwdriver range configuration to single block miners --- .../machines/basic/GT_MetaTileEntity_Miner.java | 49 +++++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java index 26024cafee..ed699d618d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -13,6 +13,7 @@ import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -35,9 +36,25 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { final static int[] SPEED = new int[]{160, 160, 80, 40, 20}; //Miner cycle time per tier final static int[] ENERGY = new int[]{8, 8, 32, 128, 512}; //Miner energy consumption per tier + private int radiusConfig = RADIUS[mTier]; //Miner configured radius + public GT_MetaTileEntity_Miner(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, new String[]{"Digging ore instead of you", ENERGY[aTier] + " EU/t, " + SPEED[aTier] / 20 + " sec per block", - "Work area " + (RADIUS[aTier] * 2 + 1) + "x" + (RADIUS[aTier] * 2 + 1), "Fortune bonus of " + aTier * 2}, 2, 2, "Miner.png", "", new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM"))); + super(aID, aName, aNameRegional, aTier, 1, + new String[]{ + "Digging ore instead of you", + "Use Screwdriver to regulate work area", + ENERGY[aTier] + " EU/t, " + SPEED[aTier] / 20 + " sec per block", + "Maximum work area " + (RADIUS[aTier] * 2 + 1) + "x" + (RADIUS[aTier] * 2 + 1), + "Fortune bonus of " + aTier * 2}, + 2, 2, "Miner.png", "", + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM"))); } public GT_MetaTileEntity_Miner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -67,6 +84,23 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { return true; } + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + if (aSide != getBaseMetaTileEntity().getFrontFacing() && aSide != mMainFacing) { + if (aPlayer.isSneaking()) { + if (radiusConfig > 1) { + radiusConfig--; + } + } else { + if (radiusConfig < RADIUS[mTier]) { + radiusConfig++; + } + } + GT_Utility.sendChatToPlayer(aPlayer, "Work area set to " + (radiusConfig * 2 + 1) + "x" + (radiusConfig * 2 + 1));//TODO Add translation support + } + } + @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); @@ -107,12 +141,12 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { moveOneDown(aBaseMetaTileEntity); return; } - if (drillZ > RADIUS[mTier]) { + if (drillZ > radiusConfig) { moveOneDown(aBaseMetaTileEntity); return; } - while (drillZ <= RADIUS[mTier]) { - while (drillX <= RADIUS[mTier]) { + while (drillZ <= radiusConfig) { + while (drillX <= radiusConfig) { Block block = aBaseMetaTileEntity.getBlockOffset(drillX, drillY, drillZ); int blockMeta = aBaseMetaTileEntity.getMetaIDOffset(drillX, drillY, drillZ); if (block instanceof GT_Block_Ores_Abstract) { @@ -130,7 +164,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { } drillX++; } - drillX = -RADIUS[mTier]; + drillX = -radiusConfig; drillZ++; } } @@ -141,6 +175,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { public long maxEUStore() { return mTier == 1 ? 4096 : V[mTier] * 64; } + public boolean moveOneDown(IGregTechTileEntity aBaseMetaTileEntity) { int xCoord = aBaseMetaTileEntity.getXCoord(); int zCoord = aBaseMetaTileEntity.getZCoord(); @@ -201,6 +236,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { aNBT.setInteger("drillX", drillX); aNBT.setInteger("drillY", drillY); aNBT.setInteger("drillZ", drillZ); + aNBT.setInteger("radiusConfig", radiusConfig); } @Override @@ -210,6 +246,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { drillX = aNBT.getInteger("drillX"); drillY = aNBT.getInteger("drillY"); drillZ = aNBT.getInteger("drillZ"); + radiusConfig = aNBT.getInteger("radiusConfig"); } private FakePlayer mFakePlayer = null; -- cgit From ce39aac7316e8d8c5d0f6f34b7aa8b8ff61bfba9 Mon Sep 17 00:00:00 2001 From: Bass Date: Tue, 26 Nov 2019 06:54:33 +0000 Subject: Range config for oil drilling rig Adds screwdriver range configuration to oil drilling rigs --- .../multi/GT_MetaTileEntity_OilDrillBase.java | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') 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 6e6c2c7922..c33dca9d97 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 @@ -4,6 +4,7 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -26,6 +27,8 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D private ArrayList mOilFieldChunks = new ArrayList(); private int mOilId = 0; + private int chunkRangeConfig = getRangeInChunks(); + public GT_MetaTileEntity_OilDrillBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -38,12 +41,14 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setInteger("mOilId", mOilId); + aNBT.setInteger("chunkRangeConfig", chunkRangeConfig); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); mOilId = aNBT.getInteger("mOilId"); + chunkRangeConfig = aNBT.getInteger("chunkRangeConfig"); } protected String[] getDescriptionInternal(String tierSuffix) { @@ -57,7 +62,8 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D "1x Output Hatch (One of base casings)", "1x Maintenance Hatch (One of base casings)", "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)", - "Working on " + getRangeInChunks() + " * " + getRangeInChunks() + " chunks", + "Working on " + getRangeInChunks() + "x" + getRangeInChunks() + " chunks", + "Use Screwdriver to configure range", "Use Programmed Circuits to ignore near exhausted oil field"}; } @@ -69,6 +75,21 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D protected abstract int getRangeInChunks(); + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + if (aPlayer.isSneaking()) { + if (chunkRangeConfig > 1) { + chunkRangeConfig--; + } + } else { + if (chunkRangeConfig < getRangeInChunks()) { + chunkRangeConfig++; + } + } + GT_Utility.sendChatToPlayer(aPlayer, "Set to work on " + chunkRangeConfig + "x" + chunkRangeConfig + " chunks");//TODO Add translation support + } + @Override protected boolean checkHatches() { return !mMaintenanceHatches.isEmpty() && !mOutputHatches.isEmpty() && !mEnergyHatches.isEmpty(); @@ -82,7 +103,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D this.mEUt = -7 << (tier << 1);//(1/4) A of current tier when at bottom (7/8) A of current tier while mining this.mMaxProgresstime = Math.max(1, (workState == STATE_AT_BOTTOM ? - (64 * (getRangeInChunks() * getRangeInChunks()))>>(getMinTier()-1) : + (64 * (chunkRangeConfig * chunkRangeConfig))>>(getMinTier()-1) : 120 ) >> tier); } @@ -123,7 +144,7 @@ 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 range = chunkRangeConfig; 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) { -- cgit From f2ec3f2852386f6ede9538ce72cd6acfdd96acb7 Mon Sep 17 00:00:00 2001 From: Bass Date: Tue, 26 Nov 2019 06:54:48 +0000 Subject: Range config for ore drilling rig Adds screwdriver range configuration to ore drilling rigs --- .../GT_MetaTileEntity_OreDrillingPlantBase.java | 36 ++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java index a528e39472..77f69946de 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -12,9 +12,11 @@ import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkPosition; import net.minecraftforge.fluids.FluidStack; @@ -28,6 +30,8 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile private final ArrayList oreBlockPositions = new ArrayList<>(); protected int mTier=1; + private int chunkRadiusConfig = getRadiusInChunks(); + public GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -36,11 +40,38 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile super(aName); } + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("chunkRadiusConfig", chunkRadiusConfig); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + chunkRadiusConfig = aNBT.getInteger("chunkRadiusConfig"); + } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OreDrillingPlant.png"); } + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + if (aPlayer.isSneaking()) { + if (chunkRadiusConfig > 1) { + chunkRadiusConfig--; + } + } else { + if (chunkRadiusConfig < getRadiusInChunks()) { + chunkRadiusConfig++; + } + } + GT_Utility.sendChatToPlayer(aPlayer, "Set to mine in a " + (chunkRadiusConfig << 4) + " radius");//TODO Add translation support + } + @Override protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { if (yHead != oldYHead) oreBlockPositions.clear(); @@ -156,7 +187,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile tryAddOreBlockToMineList(xPipe, yHead - 1, zPipe); if (yHead == yDrill) return; //skip controller block layer - int radius = getRadiusInChunks() << 4; + int radius = chunkRadiusConfig << 4; for (int xOff = -radius; xOff <= radius; xOff++) for (int zOff = -radius; zOff <= radius; zOff++) tryAddOreBlockToMineList(xDrill + xOff, yHead, zDrill + zOff); @@ -195,7 +226,8 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile "1x Output Bus (Any bottom layer casing)", "1x Maintenance Hatch (Any bottom layer casing)", "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)", - "Radius is " + (getRadiusInChunks() << 4) + " blocks", + "Use Screwdriver to configure block radius", + "Maximum radius is " + (getRadiusInChunks() << 4) + " blocks", "Fortune bonus of " + mTier * 5}; } } \ No newline at end of file -- cgit From 746d3fe043e49d7ced93ac25f3fde61ce71bd517 Mon Sep 17 00:00:00 2001 From: Bass Date: Tue, 26 Nov 2019 07:10:57 +0000 Subject: Range config for single block pump Adds screwdriver range configuration to single block pumps --- .../machines/basic/GT_MetaTileEntity_Pump.java | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java index dcb516efa5..8357dfe187 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java @@ -55,11 +55,13 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { public Block mPrimaryPumpedBlock = null; public Block mSecondaryPumpedBlock = null; + private int radiusConfig = getMaxDistanceForTier(mTier); //Pump configured radius + public GT_MetaTileEntity_Pump(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 3, new String[]{"The best way to empty Oceans! Outputs on top", - "Pumping Area: " + (GT_MetaTileEntity_Pump.getMaxDistanceForTier((byte)aTier) * 2 + 1) + "x" + - (GT_MetaTileEntity_Pump.getMaxDistanceForTier((byte)aTier) * 2 + 1)}); + "Maximum pumping area: " + (getMaxDistanceForTier((byte)aTier) * 2 + 1) + "x" + (getMaxDistanceForTier((byte)aTier) * 2 + 1), + "Use Screwdriver to regulate pumping area"}); } public GT_MetaTileEntity_Pump(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -84,17 +86,34 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { aNBT.setString("mPumpedBlock1", this.mPrimaryPumpedBlock == null ? "" : Block.blockRegistry.getNameForObject(this.mPrimaryPumpedBlock)); aNBT.setString("mPumpedBlock2", this.mSecondaryPumpedBlock == null ? "" : Block.blockRegistry.getNameForObject(this.mSecondaryPumpedBlock)); aNBT.setBoolean("wasPumping", wasPumping); + aNBT.setInteger("radiusConfig", radiusConfig); } public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); this.wasPumping = aNBT.getBoolean("wasPumping"); + this.radiusConfig = aNBT.getInteger("radiusConfig"); this.mPrimaryPumpedBlock = Block.getBlockFromName(aNBT.getString("mPumpedBlock1")); this.mSecondaryPumpedBlock = Block.getBlockFromName(aNBT.getString("mPumpedBlock2")); if (D1) { GT_Log.out.println("PUMP: NBT:Load - WasPumping - " + this.wasPumping + "(" + aNBT.getString("mPumpedBlock1") + ") " + this.mPrimaryPumpedBlock); } + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + if (aPlayer.isSneaking()) { + if (radiusConfig > 1) { + radiusConfig--; + } + } else { + if (radiusConfig < getMaxPumpableDistance()) { + radiusConfig++; + } + } + GT_Utility.sendChatToPlayer(aPlayer, "Pumping area set to " + (radiusConfig * 2 + 1) + "x" + (radiusConfig * 2 + 1));//TODO Add translation support } @@ -351,7 +370,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } private void rebuildPumpQueue(int aX, int yStart, int aZ, int yEnd) { - int mDist = this.getMaxPumpableDistance(); + int mDist = this.radiusConfig; doTickProfilingInThisTick = false; ArrayDeque fluidsToSearch = new ArrayDeque(); ArrayDeque fluidsFound = new ArrayDeque(); -- cgit From 76dd576d44e6230d06ddf940bd66175b4c5ff0f4 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 4 Dec 2019 21:26:49 +0100 Subject: Rebalanced Fortune on Miners +rebalanced Fortune to scale linear with tier +made circuit config wrapping +rewrote a bit of code to be more readable Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> --- .../machines/basic/GT_MetaTileEntity_Miner.java | 6 +-- .../multi/GT_MetaTileEntity_OilDrillBase.java | 9 ++-- .../GT_MetaTileEntity_OreDrillingPlantBase.java | 63 ++++++++++++---------- 3 files changed, 44 insertions(+), 34 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java index ed699d618d..5f4c60ca1f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -45,7 +45,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { "Use Screwdriver to regulate work area", ENERGY[aTier] + " EU/t, " + SPEED[aTier] / 20 + " sec per block", "Maximum work area " + (RADIUS[aTier] * 2 + 1) + "x" + (RADIUS[aTier] * 2 + 1), - "Fortune bonus of " + aTier * 2}, + "Fortune bonus of " + aTier}, 2, 2, "Miner.png", "", new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), @@ -151,7 +151,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { int blockMeta = aBaseMetaTileEntity.getMetaIDOffset(drillX, drillY, drillZ); if (block instanceof GT_Block_Ores_Abstract) { TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(drillX, drillY, drillZ); - if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) { + if (tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) { mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ); return; } @@ -226,7 +226,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { private ArrayList getBlockDrops(final Block oreBlock, int posX, int posY, int posZ) { final int blockMeta = getBaseMetaTileEntity().getMetaID(posX, posY, posZ); - return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier*2 + 1); + return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier); } @Override 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 c33dca9d97..109bcf91c3 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 @@ -13,7 +13,6 @@ 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; @@ -79,13 +78,17 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); if (aPlayer.isSneaking()) { - if (chunkRangeConfig > 1) { + if (chunkRangeConfig > 0) { chunkRangeConfig--; } + if (chunkRangeConfig == 0) + chunkRangeConfig = getRangeInChunks(); } else { - if (chunkRangeConfig < getRangeInChunks()) { + if (chunkRangeConfig <= getRangeInChunks()) { chunkRangeConfig++; } + if (chunkRangeConfig > getRangeInChunks()) + chunkRangeConfig = 1; } GT_Utility.sendChatToPlayer(aPlayer, "Set to work on " + chunkRangeConfig + "x" + chunkRangeConfig + " chunks");//TODO Add translation support } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java index 77f69946de..c621452a44 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -22,6 +22,9 @@ import net.minecraft.world.ChunkPosition; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; import static gregtech.api.enums.GT_Values.VN; @@ -32,11 +35,11 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile private int chunkRadiusConfig = getRadiusInChunks(); - public GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) { + GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } - public GT_MetaTileEntity_OreDrillingPlantBase(String aName) { + GT_MetaTileEntity_OreDrillingPlantBase(String aName) { super(aName); } @@ -61,13 +64,17 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); if (aPlayer.isSneaking()) { - if (chunkRadiusConfig > 1) { + if (chunkRadiusConfig > 0) { chunkRadiusConfig--; } + if (chunkRadiusConfig == 0) + chunkRadiusConfig = getRadiusInChunks(); } else { - if (chunkRadiusConfig < getRadiusInChunks()) { + if (chunkRadiusConfig <= getRadiusInChunks()) { chunkRadiusConfig++; } + if (chunkRadiusConfig > getRadiusInChunks()) + chunkRadiusConfig = 1; } GT_Utility.sendChatToPlayer(aPlayer, "Set to mine in a " + (chunkRadiusConfig << 4) + " radius");//TODO Add translation support } @@ -101,7 +108,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile return false; } if (oreBlock != null && oreBlock != Blocks.air) { - ArrayList oreBlockDrops = getBlockDrops(oreBlock, oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + Collection oreBlockDrops = getBlockDrops(oreBlock, oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); getBaseMetaTileEntity().getWorld().setBlockToAir(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); mOutputItems = getOutputByDrops(oreBlockDrops); } @@ -124,30 +131,26 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); } - private ItemStack[] getOutputByDrops(ArrayList oreBlockDrops) { + private ItemStack[] getOutputByDrops(Collection oreBlockDrops) { long voltage = getMaxInputVoltage(); - ArrayList outputItems = new ArrayList<>(); - while (!oreBlockDrops.isEmpty()) { - ItemStack currentItem = oreBlockDrops.remove(0).copy(); + Collection outputItems = new HashSet<>(); + oreBlockDrops.forEach(currentItem -> { if (!doUseMaceratorRecipe(currentItem)) { - multiplyStackSize(currentItem); - outputItems.add(currentItem); - continue; + outputItems.add(multiplyStackSize(currentItem)); + return; } - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(getBaseMetaTileEntity(), false, voltage, null, currentItem); if (tRecipe == null) { outputItems.add(currentItem); - continue; + return; } - for (int i = 0; i < tRecipe.mOutputs.length; i++) { ItemStack recipeOutput = tRecipe.mOutputs[i].copy(); if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i)) multiplyStackSize(recipeOutput); outputItems.add(recipeOutput); } - } + }); return outputItems.toArray(new ItemStack[0]); } @@ -160,17 +163,17 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile && itemData.mMaterial.mMaterial != Materials.Oilsands; } - private void multiplyStackSize(ItemStack itemStack) { + private ItemStack multiplyStackSize(ItemStack itemStack) { itemStack.stackSize *= getBaseMetaTileEntity().getRandomNumber(4) + 1; + return itemStack; } - private ArrayList getBlockDrops(final Block oreBlock, int posX, int posY, int posZ) { + private Collection getBlockDrops(final Block oreBlock, int posX, int posY, int posZ) { final int blockMeta = getBaseMetaTileEntity().getMetaID(posX, posY, posZ); if (oreBlock.canSilkHarvest(getBaseMetaTileEntity().getWorld(), null, posX, posY, posZ, blockMeta)) { - return new ArrayList() {{ - add(new ItemStack(oreBlock, 1, blockMeta)); - }}; - } else return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier*5+1); + return Collections.singleton(new ItemStack(oreBlock, 1, blockMeta)); + } else + return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier + 3); } private boolean tryConsumeDrillingFluid() { @@ -182,12 +185,15 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile } private void fillMineListIfEmpty(int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead) { - if (!oreBlockPositions.isEmpty()) return; + if (!oreBlockPositions.isEmpty()) + return; tryAddOreBlockToMineList(xPipe, yHead - 1, zPipe); - if (yHead == yDrill) return; //skip controller block layer + if (yHead == yDrill) + return; //skip controller block layer + + int radius = Math.min(Math.max(chunkRadiusConfig << 4, 1), getRadiusInChunks()); - int radius = chunkRadiusConfig << 4; for (int xOff = -radius; xOff <= radius; xOff++) for (int zOff = -radius; zOff <= radius; zOff++) tryAddOreBlockToMineList(xDrill + xOff, yHead, zDrill + zOff); @@ -197,10 +203,11 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile Block block = getBaseMetaTileEntity().getBlock(x, y, z); int blockMeta = getBaseMetaTileEntity().getMetaID(x, y, z); ChunkPosition blockPos = new ChunkPosition(x, y, z); - if (oreBlockPositions.contains(blockPos)) return; + if (oreBlockPositions.contains(blockPos)) + return; if (block instanceof GT_Block_Ores_Abstract) { TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntity(x, y, z); - if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) + if (tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) oreBlockPositions.add(blockPos); } else { ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta)); @@ -228,6 +235,6 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)", "Use Screwdriver to configure block radius", "Maximum radius is " + (getRadiusInChunks() << 4) + " blocks", - "Fortune bonus of " + mTier * 5}; + "Fortune bonus of " + (mTier + 3)}; } } \ No newline at end of file -- cgit From fc49ba668845fafa04dc17b1c2504aa94b32d79c Mon Sep 17 00:00:00 2001 From: Richard Hendricks Date: Sun, 15 Dec 2019 16:43:07 -0600 Subject: Prospector display improvements --- .../basic/GT_MetaTileEntity_AdvSeismicProspector.java | 2 +- .../machines/multi/GT_MetaTileEntity_AssemblyLine.java | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java index b52e57901b..65cab244ba 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java @@ -77,7 +77,7 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba "Near < " + near, "Middle < " + middle, "Far >= " + middle, - "Oil prospecting area 3x3 oilfields"}; + "Oil prospecting area 3x3 oilfields, each is 8x8 chunks"}; } protected GT_MetaTileEntity_AdvSeismicProspector(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java index 20752dfad7..98b8d3b005 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -44,15 +44,15 @@ public class GT_MetaTileEntity_AssemblyLine public String[] getDescription() { return new String[]{"Assembling Line", "Size: 3x(5-16)x4, variable length", - "Bottom: Steel Machine Casing(or Maintenance or Input Hatch),", - "Input Bus (Last Output Bus), Steel Machine Casing", - "Middle: Reinforced Glass, Assembly Line, Reinforced Glass", - "UpMiddle: Grate Machine Casing,", - " Assembler Machine Casing,", - " Grate Machine Casing (or Controller or Data Access Hatch)", - "Top: Steel Casing(or Energy Hatch)", - "Up to 16 repeating slices, last is Output Bus", - "Optional 1x Data Access Hatch next to the Controller"}; + "From Bottom to Top, Left to Right", + "Layer 1 - Solid Steel Machine Casing, Input Bus (last is Output Bus), Solid Steel Machine Casing", + " - Casings can be replaced by Maint or Input Hatch", + "Layer 2 - Reinforced Glass, Assembling Line Casing, Reinforced Glass", + "Layer 3 - Grate Machine Casing, Assembler Machine Casing, Grate Machine Casing", + "Layer 4 - Empty, Solid Steel Machine Casing, Empty - Casing can be replaced by Energy Hatch", + "Up to 16 repeating slices, First replaces 1 Grate with Assembly Line,", + "Last has Output Bus instead of Input Bus", + "Optional - Replace 1x Grate with Data Access Hatch next to the Controller"}; } public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { -- cgit From fabd85b1c0129e2f29c65cb0b6a3c0a114632962 Mon Sep 17 00:00:00 2001 From: Richard Hendricks Date: Mon, 16 Dec 2019 00:28:24 -0600 Subject: Updated Seismic Prospector ore and oil outputs to be more useful. --- .../GT_MetaTileEntity_AdvSeismicProspector.java | 60 ++++++++++------------ 1 file changed, 27 insertions(+), 33 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java index 65cab244ba..5c0e2cbf25 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java @@ -33,8 +33,6 @@ import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_BasicMachine { boolean ready = false; int radius; - int near; - int middle; int step; int cX; int cZ; @@ -55,9 +53,6 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER) }); radius = aRadius; - near = radius / 3; - near = near + near % 2; // making near value even; - middle = near * 2; step = aStep; } @@ -74,24 +69,19 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba + "x" + radius*2 + " ONLY blocks below prospector", - "Near < " + near, - "Middle < " + middle, - "Far >= " + middle, "Oil prospecting area 3x3 oilfields, each is 8x8 chunks"}; } protected GT_MetaTileEntity_AdvSeismicProspector(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, - String aGUIName, String aNEIName, int aNear, int aMiddle, int aRadius, int aStep) { + String aGUIName, String aNEIName, int aRadius, int aStep) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); radius = aRadius; - near = aNear; - middle = aMiddle; step = aStep; } public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_AdvSeismicProspector(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, - this.mGUIName, this.mNEIName, this.near, this.middle, this.radius, this.step); + this.mGUIName, this.mNEIName, this.radius, this.step); } @Override @@ -113,10 +103,9 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba this.ready = false; // prospecting ores - HashMap tNearOres = new HashMap(); - HashMap tMiddleOres = new HashMap(); - HashMap tFarOres = new HashMap(); - prospectOres(tNearOres, tMiddleOres, tFarOres); + HashMap tOres = new HashMap(36); + + prospectOres(tOres); // prospecting oils ArrayList tOils = new ArrayList(); @@ -129,10 +118,8 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId, tOils, - GT_Utility.sortByValueToList(tNearOres), - GT_Utility.sortByValueToList(tMiddleOres), - GT_Utility.sortByValueToList(tFarOres), - near, middle, radius); + GT_Utility.sortByValueToList(tOres), + radius); } } @@ -145,8 +132,8 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); int oilfieldSize = 8; - int xChunk = (tChunk.xPosition / oilfieldSize) * oilfieldSize - ((tChunk.xPosition < 0 && tChunk.xPosition % oilfieldSize != 0) ? oilfieldSize : 0); - int zChunk = (tChunk.zPosition / oilfieldSize) * oilfieldSize - ((tChunk.zPosition < 0 && tChunk.zPosition % oilfieldSize != 0) ? oilfieldSize : 0); + int xChunk = Math.floorDiv(tChunk.xPosition , oilfieldSize) * oilfieldSize - ((tChunk.xPosition < 0 && tChunk.xPosition % oilfieldSize != 0) ? oilfieldSize : 0); + int zChunk = Math.floorDiv(tChunk.zPosition , oilfieldSize) * oilfieldSize - ((tChunk.zPosition < 0 && tChunk.zPosition % oilfieldSize != 0) ? oilfieldSize : 0); LinkedHashMap tFluids = new LinkedHashMap<>(); int oilFieldCount = 0; @@ -186,28 +173,35 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba // aOils.put(x + "," + z + "," + (tFluid.amount / 5000) + "," + tFluid.getLocalizedName(), tFluid.amount / 5000); //} - private void prospectOres(Map aNearOres, Map aMiddleOres, Map aFarOres) { + private void prospectOres(Map aOres) { int tLeftXBound = this.getBaseMetaTileEntity().getXCoord() - radius; int tRightXBound = tLeftXBound + 2*radius; int tLeftZBound = this.getBaseMetaTileEntity().getZCoord() - radius; int tRightZBound = tLeftZBound + 2*radius; - for (int i = tLeftXBound; i <= tRightXBound; i += step) + for (int i = tLeftXBound; i <= tRightXBound; i += step) { + if ( (Math.abs(i)/16-1)%3!=0 ) { + continue; + } for (int k = tLeftZBound; k <= tRightZBound; k += step) { + if ( (Math.abs(k)/16-1)%3!=0 ) { + continue; + } + int di = Math.abs(i - this.getBaseMetaTileEntity().getXCoord()); int dk = Math.abs(k - this.getBaseMetaTileEntity().getZCoord()); - cX = (i/16)*16; - cZ = (k/16)*16; + cX = (Math.floorDiv(i,16))*16; + + cZ = (Math.floorDiv(k,16))*16; + + String separator = (cX +8)+ "," + (cZ + 8) + " --------"; + aOres.put(separator, 1); + prospectHole(i, k, aOres); - if (di <= near && dk <= near) - prospectHole(i, k, aNearOres); - else if (di <= middle && dk <= middle) - prospectHole(i, k, aMiddleOres); - else - prospectHole(i, k, aFarOres); } + } } private void prospectHole(int i, int k, Map aOres) { @@ -245,7 +239,7 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba } private static void countOre(Map map, String ore, int cCX, int cCZ) { - ore = ore + " at " + (cCX +8)+ "," + (cCZ + 8); + ore = (cCX +8)+ "," + (cCZ + 8) + " has " + ore; Integer oldCount = map.get(ore); oldCount = (oldCount == null) ? 0 : oldCount; -- cgit From 0716faf213c310493c75162e59a168626646ca89 Mon Sep 17 00:00:00 2001 From: Richard Hendricks Date: Mon, 16 Dec 2019 19:54:15 -0600 Subject: Fix for drill and pump not preserving default values, provided by bartimaeusnek --- .../machines/basic/GT_MetaTileEntity_Miner.java | 20 ++++++-- .../machines/basic/GT_MetaTileEntity_Pump.java | 56 +++++++++++++--------- 2 files changed, 50 insertions(+), 26 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java index 5f4c60ca1f..22bb275ea2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -36,7 +36,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { final static int[] SPEED = new int[]{160, 160, 80, 40, 20}; //Miner cycle time per tier final static int[] ENERGY = new int[]{8, 8, 32, 128, 512}; //Miner energy consumption per tier - private int radiusConfig = RADIUS[mTier]; //Miner configured radius + private int radiusConfig; //Miner configured radius public GT_MetaTileEntity_Miner(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 1, @@ -55,14 +55,17 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM"))); + radiusConfig = RADIUS[mTier]; } public GT_MetaTileEntity_Miner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); + radiusConfig = RADIUS[mTier]; } public GT_MetaTileEntity_Miner(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 2, 2, aGUIName, aNEIName); + radiusConfig = RADIUS[mTier]; } @@ -89,13 +92,17 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); if (aSide != getBaseMetaTileEntity().getFrontFacing() && aSide != mMainFacing) { if (aPlayer.isSneaking()) { - if (radiusConfig > 1) { + if (radiusConfig >= 0) { radiusConfig--; } + if (radiusConfig < 0) + radiusConfig = RADIUS[mTier]; } else { - if (radiusConfig < RADIUS[mTier]) { + if (radiusConfig <= RADIUS[mTier]) { radiusConfig++; } + if (radiusConfig > RADIUS[mTier]) + radiusConfig = 0; } GT_Utility.sendChatToPlayer(aPlayer, "Work area set to " + (radiusConfig * 2 + 1) + "x" + (radiusConfig * 2 + 1));//TODO Add translation support } @@ -229,6 +236,13 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier); } + @Override + public void setItemNBT(NBTTagCompound aNBT) { + super.setItemNBT(aNBT); + aNBT.setByte("mTier", mTier); + aNBT.setInteger("radiusConfig", radiusConfig); + } + @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java index 8357dfe187..bf11df1b7c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java @@ -25,12 +25,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.IFluidHandler; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; +import java.util.*; import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.enums.GT_Values.V; @@ -48,28 +43,31 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { return (16 * ((long) Math.pow(4, aTier))); } - public ArrayDeque mPumpList = new ArrayDeque(); + public ArrayDeque mPumpList = new ArrayDeque<>(); public boolean wasPumping = false; public int mPumpTimer = 0; public int mPumpCountBelow = 0; public Block mPrimaryPumpedBlock = null; public Block mSecondaryPumpedBlock = null; - private int radiusConfig = getMaxDistanceForTier(mTier); //Pump configured radius + private int radiusConfig; //Pump configured radius public GT_MetaTileEntity_Pump(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 3, new String[]{"The best way to empty Oceans! Outputs on top", - "Maximum pumping area: " + (getMaxDistanceForTier((byte)aTier) * 2 + 1) + "x" + (getMaxDistanceForTier((byte)aTier) * 2 + 1), + "Maximum pumping area: " + (getMaxDistanceForTier((byte) aTier) * 2 + 1) + "x" + (getMaxDistanceForTier((byte) aTier) * 2 + 1), "Use Screwdriver to regulate pumping area"}); + radiusConfig = getMaxDistanceForTier(mTier); } public GT_MetaTileEntity_Pump(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); + radiusConfig = getMaxDistanceForTier(mTier); } public GT_MetaTileEntity_Pump(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); + radiusConfig = getMaxDistanceForTier(mTier); } @Override @@ -101,17 +99,28 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } } + @Override + public void setItemNBT(NBTTagCompound aNBT) { + super.setItemNBT(aNBT); + aNBT.setInteger("radiusConfig", radiusConfig); + } + @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + int max = getMaxPumpableDistance(); if (aPlayer.isSneaking()) { - if (radiusConfig > 1) { + if (radiusConfig >= 0) { radiusConfig--; } + if (radiusConfig < 0) + radiusConfig = max; } else { - if (radiusConfig < getMaxPumpableDistance()) { + if (radiusConfig <= max) { radiusConfig++; } + if (radiusConfig > max) + radiusConfig = 0; } GT_Utility.sendChatToPlayer(aPlayer, "Pumping area set to " + (radiusConfig * 2 + 1) + "x" + (radiusConfig * 2 + 1));//TODO Add translation support @@ -372,9 +381,9 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { private void rebuildPumpQueue(int aX, int yStart, int aZ, int yEnd) { int mDist = this.radiusConfig; doTickProfilingInThisTick = false; - ArrayDeque fluidsToSearch = new ArrayDeque(); - ArrayDeque fluidsFound = new ArrayDeque(); - Set checked = new HashSet(); + ArrayDeque fluidsToSearch = new ArrayDeque<>(); + ArrayDeque fluidsFound = new ArrayDeque<>(); + Set checked = new HashSet<>(); this.clearQueue(false); for (int aY = yStart ; this.mPumpList.isEmpty() && aY >= yEnd ; aY--) { @@ -383,22 +392,23 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { fluidsToSearch.add(new ChunkPosition(aX, aY, aZ)); while (!fluidsToSearch.isEmpty()) { - Iterator i$ = fluidsToSearch.iterator(); - while(i$.hasNext()) { - ChunkPosition tPos = i$.next(); - + for (ChunkPosition tPos : fluidsToSearch) { // Look all around - if (tPos.chunkPosX < aX + mDist) queueFluid(tPos.chunkPosX + 1, tPos.chunkPosY, tPos.chunkPosZ, fluidsFound, checked); - if (tPos.chunkPosX > aX - mDist) queueFluid(tPos.chunkPosX - 1, tPos.chunkPosY, tPos.chunkPosZ, fluidsFound, checked); - if (tPos.chunkPosZ < aZ + mDist) queueFluid(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ + 1, fluidsFound, checked); - if (tPos.chunkPosZ > aZ - mDist) queueFluid(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ - 1, fluidsFound, checked); + if (tPos.chunkPosX < aX + mDist) + queueFluid(tPos.chunkPosX + 1, tPos.chunkPosY, tPos.chunkPosZ, fluidsFound, checked); + if (tPos.chunkPosX > aX - mDist) + queueFluid(tPos.chunkPosX - 1, tPos.chunkPosY, tPos.chunkPosZ, fluidsFound, checked); + if (tPos.chunkPosZ < aZ + mDist) + queueFluid(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ + 1, fluidsFound, checked); + if (tPos.chunkPosZ > aZ - mDist) + queueFluid(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ - 1, fluidsFound, checked); // And then look up queueFluid(tPos.chunkPosX, tPos.chunkPosY + 1, tPos.chunkPosZ, this.mPumpList, checked); } this.mPumpList.addAll(fluidsFound); fluidsToSearch = fluidsFound; - fluidsFound = new ArrayDeque(); + fluidsFound = new ArrayDeque<>(); } // Make sure we don't have the pipe location in the queue -- cgit From 27b0c691a892fe0a8f2dbbf9f41d6551c0e40438 Mon Sep 17 00:00:00 2001 From: Richard Hendricks Date: Tue, 17 Dec 2019 00:39:41 -0600 Subject: 4112 - update plasma turbine tooltip --- .../machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java index fb3f58efd5..645342109e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java @@ -42,6 +42,7 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)", "1x Plasma Input Hatch (Side centered)", "1x Maintenance Hatch (Side centered)", + "1x Output Hatch (Side centered, optional)", "1x Dynamo Hatch (Back centered)", "Tungstensteel Turbine Casings for the rest (24 at least!)", "Needs a Turbine Item (Inside controller GUI)"}; -- cgit From 19acdbddcc7c560890dde3eb8053cf66adc91b05 Mon Sep 17 00:00:00 2001 From: Richard Hendricks Date: Tue, 17 Dec 2019 00:40:20 -0600 Subject: 4412/4883 Solar Boiler rebalance and bugfix --- .../boilers/GT_MetaTileEntity_Boiler_Solar.java | 51 ++++++++++++++++++---- .../GT_MetaTileEntity_Boiler_Solar_Steel.java | 16 +++---- 2 files changed, 48 insertions(+), 19 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java index 8f8fa352a8..398bf4869c 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java @@ -8,14 +8,17 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_Boiler; import gregtech.common.gui.GT_GUIContainer_Boiler; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.nbt.NBTTagCompoun