diff options
author | xSkewer <43712386+xSkewer@users.noreply.github.com> | 2022-06-19 15:34:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-19 21:34:16 +0200 |
commit | 7d073371cbf74bad6641461fe6405ebc80da19be (patch) | |
tree | 1d56d0d82c312a68fb0fe92c7f413653ba8e0c80 /src/main/java/gregtech/common | |
parent | 1ce93bdd66863e22c7aba421a40de0cf80ea70a9 (diff) | |
download | GT5-Unofficial-7d073371cbf74bad6641461fe6405ebc80da19be.tar.gz GT5-Unofficial-7d073371cbf74bad6641461fe6405ebc80da19be.tar.bz2 GT5-Unofficial-7d073371cbf74bad6641461fe6405ebc80da19be.zip |
Allow wire cutters to toggle cobblestone replacing on MBM (#1083)
* Allow wire cutters to toggle cobblestone replacing
* Add NBT saving
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java | 26 |
1 files changed, 22 insertions, 4 deletions
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 fce4e3758c..9e910574c4 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 @@ -37,6 +37,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile private final ArrayList<ChunkPosition> oreBlockPositions = new ArrayList<>(); protected int mTier = 1; private int chunkRadiusConfig = getRadiusInChunks(); + private boolean replaceWithCobblestone = true; GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -50,13 +51,18 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setInteger("chunkRadiusConfig", chunkRadiusConfig); + aNBT.setBoolean("replaceWithCobblestone", replaceWithCobblestone); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - if (aNBT.hasKey("chunkRadiusConfig")) + if (aNBT.hasKey("chunkRadiusConfig")) { chunkRadiusConfig = aNBT.getInteger("chunkRadiusConfig"); + } + if (aNBT.hasKey("replaceWithCobblestone")) { + replaceWithCobblestone = aNBT.getBoolean("replaceWithCobblestone"); + } } @Override @@ -84,6 +90,13 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile } @Override + public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + replaceWithCobblestone = !replaceWithCobblestone; + GT_Utility.sendChatToPlayer(aPlayer, "Replace with cobblestone " + replaceWithCobblestone); + return true; + } + + @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(); @@ -133,7 +146,11 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile Collection<ItemStack> oreBlockDrops = getBlockDrops(oreBlock, x, y, z); ItemStack cobble = GT_Utility.getCobbleForOre(oreBlock, metaData); - getBaseMetaTileEntity().getWorld().setBlock(x, y, z, Block.getBlockFromItem(cobble.getItem()), cobble.getItemDamage(), 3); + if (replaceWithCobblestone) { + getBaseMetaTileEntity().getWorld().setBlock(x, y, z, Block.getBlockFromItem(cobble.getItem()), cobble.getItemDamage(), 3); + } else { + getBaseMetaTileEntity().getWorld().setBlockToAir(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + } mOutputItems = getOutputByDrops(oreBlockDrops); } return true; @@ -220,7 +237,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile GT_ChunkManager.requestChunkLoad((TileEntity)getBaseMetaTileEntity(), new ChunkCoordIntPair(nextChunkX, nextChunkZ)); return true; } - + @Override protected boolean checkHatches(){ return !mMaintenanceHatches.isEmpty() && !mInputHatches.isEmpty() && !mOutputBusses.isEmpty() && !mEnergyHatches.isEmpty(); @@ -349,13 +366,14 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile protected GT_Multiblock_Tooltip_Builder createTooltip(String tierSuffix) { String casings = getCasingBlockItem().get(0).getDisplayName(); - + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Miner") .addInfo("Controller Block for the Ore Drilling Plant " + (tierSuffix != null ? tierSuffix : "")) .addInfo("Use a Screwdriver to configure block radius") .addInfo("Maximum radius is " + (getRadiusInChunks() << 4) + " blocks") .addInfo("Use Soldering iron to turn off chunk mode") + .addInfo("Use Wire Cutter to toggle replacing mined blocks with cobblestone") .addInfo("In chunk mode, working area center is the chunk corner nearest to the drill") .addInfo("Gives ~3x as much crushed ore vs normal processing") .addInfo("Fortune bonus of " + (mTier + 3) + ". Only works on small ores") |