From ee2abbd3f2d2e06cceada780c531b6342c5b1af7 Mon Sep 17 00:00:00 2001 From: Techlone Date: Wed, 22 Jun 2016 01:30:27 +0500 Subject: [PATCH] AdvMinerII: check that ore block still exists; consider chance output --- .../machines/multi/GT_MetaTileEntity_AdvMiner2.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 f9c9f965..3ea1ff7b 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 @@ -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 {