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 8096276b..59aaead8 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,8 @@ 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 @@ -103,10 +104,20 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas for (int i = -48; i < 49; i++) { for (int f = -48; f < 49; f++) { Block tBlock = getBaseMetaTileEntity().getBlockOffset(i, yLevel - getBaseMetaTileEntity().getYCoord(), f); + int tMetaID = getBaseMetaTileEntity().getMetaIDOffset(i, yLevel - getBaseMetaTileEntity().getYCoord(), f); if (tBlock == GregTech_API.sBlockOres1) { TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(i, yLevel - getBaseMetaTileEntity().getYCoord(), f); - if ((tTileEntity instanceof GT_TileEntity_Ores) && ((GT_TileEntity_Ores) tTileEntity).mNatural == true && !mMineList.contains(new ChunkPosition(i, yLevel - getBaseMetaTileEntity().getYCoord(), f))) { - mMineList.add(new ChunkPosition(i, yLevel - getBaseMetaTileEntity().getYCoord(), f)); + if ((tTileEntity!=null) && (tTileEntity instanceof GT_TileEntity_Ores) && ((GT_TileEntity_Ores) + tTileEntity).mNatural == true && !mMineList.contains(new ChunkPosition(i, yLevel - getBaseMetaTileEntity().getYCoord(), f))) { + } + } + else { + ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); + if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { + ChunkPosition cp = new ChunkPosition(i, yLevel - getBaseMetaTileEntity().getYCoord(), f); + if (!mMineList.contains(cp)) { + mMineList.add(cp); + } } } } @@ -117,18 +128,33 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas if (mEnergyHatches.size() > 0 && mEnergyHatches.get(0).getEUVar() > (512 + getMaxInputVoltage() * 4)) { moveOneDown(); } - }else{return false;} - } - if (!mMineList.isEmpty()) { - ChunkPosition oreBlockOffsetPos = mMineList.get(0); - 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); + }else{ + return false; } + } + ArrayList tDrops = new ArrayList(); + if (!mMineList.isEmpty()) { + + ChunkPosition mle = mMineList.get(0); + mMineList.remove(0); + Block tMineBlock = getBaseMetaTileEntity().getBlockOffset(mle.chunkPosX, mle.chunkPosY, mle.chunkPosZ); + int metadata = getBaseMetaTileEntity().getMetaIDOffset(mle.chunkPosX, mle.chunkPosY, mle.chunkPosZ); + boolean silkTouch = tMineBlock.canSilkHarvest(getBaseMetaTileEntity().getWorld(), null, mle.chunkPosX, mle.chunkPosY, mle.chunkPosZ, metadata); + if (silkTouch){ + ItemStack IS = new ItemStack(tMineBlock); + IS.setItemDamage(metadata); + IS.stackSize=1; + tDrops.add(IS); + } + else{ + tDrops = tMineBlock.getDrops(getBaseMetaTileEntity().getWorld(), mle.chunkPosX, mle.chunkPosY, mle.chunkPosZ, metadata, 1); + } + + getBaseMetaTileEntity().getWorld().setBlockToAir(mle.chunkPosX + getBaseMetaTileEntity().getXCoord(), mle.chunkPosY + getBaseMetaTileEntity().getYCoord(), mle.chunkPosZ + getBaseMetaTileEntity().getZCoord()); if (!tDrops.isEmpty()) { ItemData tData = GT_OreDictUnificator.getItemData(tDrops.get(0).copy()); - if (tData.mPrefix != OrePrefixes.crushed&& tData.mMaterial.mMaterial != Materials.Oilsands) { + if (tData.mPrefix != OrePrefixes.crushed && tData.mMaterial.mMaterial != Materials.Oilsands) { + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(getBaseMetaTileEntity(), false, tVoltage, null, tDrops.get(0).copy()); if (tRecipe != null) { this.mOutputItems = new ItemStack[tRecipe.mOutputs.length]; @@ -138,6 +164,11 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas mOutputItems[g].stackSize *= getBaseMetaTileEntity().getRandomNumber(4) + 1; } } + } else { + this.mOutputItems = new ItemStack[tDrops.size()]; + for (int g = 0; g < mOutputItems.length; g++) { + mOutputItems[g] = tDrops.get(g).copy(); + } } } else { this.mOutputItems = null; @@ -149,8 +180,7 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas mOutputItems = tStack; } } - getBaseMetaTileEntity().getWorld().setBlockToAir(oreBlockOffsetPos.chunkPosX + getBaseMetaTileEntity().getXCoord(), oreBlockOffsetPos.chunkPosY + getBaseMetaTileEntity().getYCoord(), oreBlockOffsetPos.chunkPosZ + getBaseMetaTileEntity().getZCoord()); - mMineList.remove(0); + } } @@ -297,4 +327,4 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas return new GT_MetaTileEntity_AdvMiner2(this.mName); } -} \ No newline at end of file +}