Fix position logic in AdvMiner.checkRecipe (again)

This commit is contained in:
David Vierra 2017-01-23 03:18:21 -10:00
parent 9353ef19bd
commit 52c42c2d63

View file

@ -140,7 +140,6 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas
List<ItemStack> tDrops = new ArrayList(); List<ItemStack> tDrops = new ArrayList();
Block tMineBlock = null; Block tMineBlock = null;
BlockPos mle = null; BlockPos mle = null;
int posX, posY, posZ, offX, offY, offZ;
while ((tMineBlock==null || tMineBlock == Blocks.AIR) && !mMineList.isEmpty()) { while ((tMineBlock==null || tMineBlock == Blocks.AIR) && !mMineList.isEmpty()) {
mle = mMineList.get(0); mle = mMineList.get(0);
mMineList.remove(0); mMineList.remove(0);
@ -148,26 +147,24 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas
} }
if (tMineBlock!=null && tMineBlock!=Blocks.AIR) { if (tMineBlock!=null && tMineBlock!=Blocks.AIR) {
posX = mle.getX() + getBaseMetaTileEntity().getXCoord(); BlockPos pos = new BlockPos(mle.getX() + getBaseMetaTileEntity().getXCoord(),
posY = mle.getY() + getBaseMetaTileEntity().getYCoord(); mle.getY() + getBaseMetaTileEntity().getYCoord(),
posZ = mle.getZ() + getBaseMetaTileEntity().getZCoord(); mle.getZ() + getBaseMetaTileEntity().getZCoord());
offX = mle.getX();
offY = mle.getY();
offZ = mle.getZ();
IBlockState metadata = getBaseMetaTileEntity().getWorldObj().getBlockState(mle);
boolean silkTouch = tMineBlock.canSilkHarvest(getBaseMetaTileEntity().getWorldObj(), new BlockPos(posX, posY, posZ), metadata, null); IBlockState blockState = getBaseMetaTileEntity().getWorldObj().getBlockState(pos);
boolean silkTouch = tMineBlock.canSilkHarvest(getBaseMetaTileEntity().getWorldObj(), pos, blockState, null);
if (silkTouch){ if (silkTouch){
ItemStack IS = new ItemStack(tMineBlock); ItemStack IS = new ItemStack(tMineBlock);
IS.setItemDamage(metadata.getBlock().getMetaFromState(metadata)); IS.setItemDamage(blockState.getBlock().getMetaFromState(blockState));
IS.stackSize=1; IS.stackSize=1;
tDrops.add(IS); tDrops.add(IS);
} }
else{ else{
tDrops = tMineBlock.getDrops(getBaseMetaTileEntity().getWorldObj(), new BlockPos(posX, posY, posZ), metadata, 1); tDrops = tMineBlock.getDrops(getBaseMetaTileEntity().getWorldObj(), pos, blockState, 1);
} }
getBaseMetaTileEntity().getWorldObj().setBlockToAir(getBaseMetaTileEntity().getWorldPos().add(posX, posY, posZ)); getBaseMetaTileEntity().getWorldObj().setBlockToAir(pos);
if (!tDrops.isEmpty()) { if (!tDrops.isEmpty()) {
ItemData tData = GT_OreDictUnificator.getItemData(tDrops.get(0).copy()); 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) {