Similar fixes to last commit, for grass horn and exchange rod

This commit is contained in:
Vincent Lee committed 2018-09-03 20:26:20 -05:00
1 parent 3154b8aa80
commit 27cb04cbbb
2 files changed
+2 -10

No files matched your search

@@ -129,18 +129,14 @@ public class ItemGrassHorn extends ItemMod {
BlockPos currCoords = coords.get(i);
IBlockState state = world.getBlockState(currCoords);
Block block = state.getBlock();
NonNullList<ItemStack> items = NonNullList.create();
block.getDrops(items, world, currCoords, state, 0);
if(block instanceof IHornHarvestable && ((IHornHarvestable) block).hasSpecialHornHarvest(world, currCoords, stack, type))
((IHornHarvestable) block).harvestByHorn(world, currCoords, stack, type);
else {
block.dropBlockAsItem(world, currCoords, state, 0);
world.setBlockToAir(currCoords);
if(ConfigHandler.blockBreakParticles)
world.playEvent(2001, currCoords, Block.getStateId(state));
for(ItemStack stack_ : items)
world.spawnEntity(new EntityItem(world, currCoords.getX() + 0.5, currCoords.getY() + 0.5, currCoords.getZ() + 0.5, stack_));
}
}
}
@@ -224,14 +224,10 @@ public class ItemExchangeRod extends ItemMod implements IManaUsingItem, IWirefra
Block blockAt = stateAt.getBlock();
if(!blockAt.isAir(world.getBlockState(pos), world, pos) && stateAt.getPlayerRelativeBlockHardness(player, world, pos) > 0 && stateAt != state) {
if(!world.isRemote) {
world.destroyBlock(pos, !player.capabilities.isCreativeMode);
if(!player.capabilities.isCreativeMode) {
NonNullList<ItemStack> drops = NonNullList.create();
blockAt.getDrops(drops, world, pos, stateAt, 0);
for(ItemStack drop : drops)
world.spawnEntity(new EntityItem(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, drop));
removeFromInventory(player, stack, state.getBlock(), state.getBlock().getMetaFromState(state), true);
}
world.playEvent(2001, pos, Block.getStateId(state));
world.setBlockState(pos, state, 1 | 2);
state.getBlock().onBlockPlacedBy(world, pos, state, player, placeStack);
}