Don't drop xp orbs into world directly

This commit is contained in:
temp1011 committed 2018-03-24 01:52:15 +00:00
1 parent 54a9da917d
commit b0bc8429ac
1 file changed
+7 -5
@@ -10,6 +10,8 @@
******************************************************************************/
package forestry.core.blocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
@@ -59,14 +61,14 @@ public class BlockResourceOre extends Block implements IItemModelRegister, IBloc
}
@Override
public void dropBlockAsItemWithChance(World world, BlockPos pos, IBlockState state, float chance, int fortune) {
super.dropBlockAsItemWithChance(world, pos, state, chance, fortune);
public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) {
Random rand = world instanceof World ? ((World) world).rand : new Random();
if (state.getValue(ORE_RESOURCES) == EnumResourceType.APATITE) {
this.dropXpOnBlockBreak(world, pos, MathHelper.getInt(world.rand, 1, 4));
return MathHelper.getInt(rand, 1, 4);
}
return super.getExpDrop(state, world, pos, fortune);
}
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
EnumResourceType type = state.getValue(ORE_RESOURCES);