mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
call the fallback silk touch function on exception
This commit is contained in:
1 parent
32af79f8f6
commit
74decf0b6c
1 file changed
+11
-6
@@ -55,16 +55,12 @@ public final class MinerUtils
|
||||
}
|
||||
} catch (InvocationTargetException|IllegalAccessException e){
|
||||
Mekanism.logger.error("Block.getSilkTouchDrop errored", e);
|
||||
fallbackGetSilkTouch(block, state, ret);
|
||||
}
|
||||
}
|
||||
else//fallback to old method
|
||||
{
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
if (item != null && item != Items.AIR)
|
||||
{
|
||||
int meta = item.getHasSubtypes() ? block.getMetaFromState(state) : 0;
|
||||
ret.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
fallbackGetSilkTouch(block, state, ret);
|
||||
}
|
||||
|
||||
if (ret.size() > 0)
|
||||
@@ -88,4 +84,13 @@ public final class MinerUtils
|
||||
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
private static void fallbackGetSilkTouch(Block block, IBlockState state, List<ItemStack> ret){
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
if (item != null && item != Items.AIR)
|
||||
{
|
||||
int meta = item.getHasSubtypes() ? block.getMetaFromState(state) : 0;
|
||||
ret.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user