aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/common/tileentities')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AdvMiner2.java11
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java32
2 files changed, 13 insertions, 30 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 f9c9f9654b..3ea1ff7b36 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<ItemStack> 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<ItemStack> tDrops = new ArrayList<ItemStack>();
+ 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 {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
index 036709e038..1ea1711a0c 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
@@ -168,34 +168,12 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
if (mInventory[1].getUnlocalizedName().endsWith("5")) {
tTier = 5;
}
- for (int i = 0; i < tInputList.size() - 1; i++) {
- for (int j = i + 1; j < tInputList.size(); j++) {
- if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) {
- if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) {
- tInputList.remove(j--);
- } else {
- tInputList.remove(i--);
- break;
- }
- }
- }
- }
- ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2);
+
+ ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]);
ArrayList<FluidStack> tFluidList = getStoredFluids();
- for (int i = 0; i < tFluidList.size() - 1; i++) {
- for (int j = i + 1; j < tFluidList.size(); j++) {
- if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) {
- if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) {
- tFluidList.remove(j--);
- } else {
- tFluidList.remove(i--);
- break;
- }
- }
- }
- }
- FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1);
+
+ FluidStack[] tFluids = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]);
if (tInputList.size() > 0 || tFluids.length > 0) {
GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
if (tRecipe != null) {
@@ -328,4 +306,4 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
public boolean explodesOnComponentBreak(ItemStack aStack) {
return false;
}
-} \ No newline at end of file
+}