From e1ebdd82f87e923b31993235c9d63f7eb27522d8 Mon Sep 17 00:00:00 2001 From: Dream-Master Date: Wed, 22 Jun 2016 23:11:45 +0200 Subject: [PATCH] e8936bf8d9779bd56947d6fcad5232dd8f68fcf7 AdvMinerII: check that ore block still exists; consider chance output --- build.properties | 2 +- .../multi/GT_MetaTileEntity_AdvMiner2.java | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/build.properties b/build.properties index bd691eb1..5216be07 100644 --- a/build.properties +++ b/build.properties @@ -1,7 +1,7 @@ minecraft.version=1.7.10 forge.version=10.13.4.1566-1.7.10 -gt.version=5.09.22.1 +gt.version=5.09.22.2 ae2.version=rv2-beta-33 applecore.version=1.7.10-1.2.1+107.59407 diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AdvMiner2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AdvMiner2.java index 735c7dd1..1f072569 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AdvMiner2.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AdvMiner2.java @@ -62,7 +62,7 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas } public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "Advanced_Miner2.png"); + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DrillingRig.png"); } @Override @@ -71,15 +71,15 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas ArrayList tItems = getStoredInputs(); for (ItemStack tStack : tItems) { if (tStack.isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L))) { - tStack.stackSize--; + tStack.stackSize--; if (tStack.stackSize < 1) { tStack = null; } - if (mInventory[1] == null) { - mInventory[1] = GT_ModHandler.getIC2Item("miningPipe", 1L); - } else { - mInventory[1].stackSize++; - } + if (mInventory[1] == null) { + mInventory[1] = GT_ModHandler.getIC2Item("miningPipe", 1L); + } else { + mInventory[1].stackSize++; + } } } @@ -119,10 +119,13 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas } }else{return false;} } - ArrayList tDrops = new ArrayList(); if (!mMineList.isEmpty()) { ChunkPosition oreBlockOffsetPos = mMineList.get(0); - tDrops = ((GT_TileEntity_Ores) getBaseMetaTileEntity().getTileEntityOffset(oreBlockOffsetPos.chunkPosX, oreBlockOffsetPos.chunkPosY, oreBlockOffsetPos.chunkPosZ)).getDrops(1); + ArrayList tDrops = new ArrayList(); + GT_TileEntity_Ores oreBlockTileEntity = (GT_TileEntity_Ores) getBaseMetaTileEntity().getTileEntityOffset(oreBlockOffsetPos.chunkPosX, oreBlockOffsetPos.chunkPosY, oreBlockOffsetPos.chunkPosZ); + if (oreBlockTileEntity != null) { + tDrops = oreBlockTileEntity.getDrops(1); + } if (!tDrops.isEmpty()) { ItemData tData = GT_OreDictUnificator.getItemData(tDrops.get(0).copy()); if (tData.mPrefix != OrePrefixes.crushed&& tData.mMaterial.mMaterial != Materials.Oilsands) { @@ -131,7 +134,9 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas this.mOutputItems = new ItemStack[tRecipe.mOutputs.length]; for (int g = 0; g < mOutputItems.length; g++) { mOutputItems[g] = tRecipe.mOutputs[g].copy(); - mOutputItems[g].stackSize = mOutputItems[g].stackSize * (getBaseMetaTileEntity().getRandomNumber(4) + 1); + if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(g)) { + mOutputItems[g].stackSize *= getBaseMetaTileEntity().getRandomNumber(4) + 1; + } } } } else {