fix silk touch logic that causes the drops to be eaten when the block wont drop anything unless silked

This commit is contained in:
Xander committed 2017-11-08 21:58:25 +08:00
1 parent f4b4cede0b
commit f46bbb0635
1 file changed
+7 -10
@@ -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)
@@ -65,15 +66,11 @@ 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;
}
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){