fix silk touch logic that causes the drops to be eaten when the block wont drop anything unless silked
@@ -3,6 +3,7 @@ package mekanism.common.util;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -38,10 +39,10 @@ public final class MinerUtils
if(block == null || block.isAir(state, world, obj.getPos()))
{
- return new LinkedList<>();
+ return Collections.EMPTY_LIST;
}
- if(silk && block.canSilkHarvest(world, obj.getPos(), state, null))
+ if(silk && (block.canSilkHarvest(world, obj.getPos(), state, null) || specialSilkIDs.contains(block)))
{
List<ItemStack> ret = new ArrayList<>();
if (getSilkTouchDrop != null)
@@ -64,16 +65,12 @@ public final class MinerUtils
}
if (ret.size() > 0)
- {
- List<ItemStack> blockDrops = block.getDrops(world, obj.getPos(), state, 0);
-
- if(specialSilkIDs.contains(block) || (blockDrops != null && blockDrops.size() > 0))
{
net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(ret, world, obj.getPos(), state, 0, 1.0f, true, null);
return ret;
}
- }
} else {
+ @SuppressWarnings("deprecation")
List<ItemStack> blockDrops = block.getDrops(world, obj.getPos(), state, 0);
if (blockDrops.size() > 0)
{
@@ -82,7 +79,7 @@ public final class MinerUtils
return blockDrops;
}
- return new LinkedList<>();
+ return Collections.emptyList();
}
private static void fallbackGetSilkTouch(Block block, IBlockState state, List<ItemStack> ret){
