Update BlockController.java

Can try it like this, just edited on the webpage editor so not tested, but since the controller dont have a inventory to drop there should not be a need to use a list and drop inventory content, above should work for silktouch and not silk
This commit is contained in:
tomevoll
2016-04-05 15:39:57 +02:00
parent a3ade6667e
commit 5733a553a2

View File

@@ -106,29 +106,9 @@ public class BlockController extends BlockBase {
player.addStat(StatList.func_188055_a(this)); player.addStat(StatList.func_188055_a(this));
player.addExhaustion(0.025F); player.addExhaustion(0.025F);
if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.silkTouch, stack) > 0)
{
java.util.List<ItemStack> items = new java.util.ArrayList<ItemStack>();
ItemStack itemstack = this.createStackedBlock(state);
if (itemstack != null)
{
items.add(itemstack);
}
net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player);
for (ItemStack item : items)
{
spawnAsEntity(worldIn, pos, item);
}
}
else
{
harvesters.set(player); harvesters.set(player);
int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.fortune, stack); int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.fortune, stack);
if ((te instanceof TileController)) { if ((te instanceof TileController)) {
List<ItemStack> ls = new ArrayList<ItemStack>();
TileController controller = (TileController) te; TileController controller = (TileController) te;
ItemStack item = new ItemStack(getItemDropped(state, null, 0), 1, damageDropped(state)); ItemStack item = new ItemStack(getItemDropped(state, null, 0), 1, damageDropped(state));
NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound tag = new NBTTagCompound();
@@ -139,10 +119,8 @@ public class BlockController extends BlockBase {
spawnAsEntity(worldIn, pos, item); spawnAsEntity(worldIn, pos, item);
} }
} }
//this.dropBlockAsItem(worldIn, pos, state, i);
harvesters.set(null); harvesters.set(null);
} }
}
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack itemStack) { public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack itemStack) {