Hi !
I'm making a mod for the first time and I have some problems when initializing a block. In the crash report, it's said it has been caused an item. I don't understand why.
The crash report is attached to the post.
Thank you for your help !
The block class :
public class BlockCryingObsidian extends BlockBase {
public BlockCryingObsidian(String name, Material material) {
super(name, material);
setSoundType(SoundType.STONE);
setLightLevel(5);
setHardness(25.0F);
}
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
boolean activate = true;
if(playerIn.experienceLevel >= 10 || playerIn.isCreative()) {
playerIn.addExperienceLevel(-10);
playerIn.setSpawnPoint(playerIn.getPosition(), true);
worldIn.playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.BLOCK_NOTE_CHIME, SoundCategory.BLOCKS, 0.5F, 1F);
double rx = pos.getX() + worldIn.rand.nextFloat();
double ry = pos.getY() + worldIn.rand.nextFloat();
double rz = pos.getZ() + worldIn.rand.nextFloat();
for(int i = 0; i <= 50; i++) {
worldIn.spawnParticle(EnumParticleTypes.TOTEM, rx, ry, rz, worldIn.rand.nextFloat(), worldIn.rand.nextFloat(), worldIn.rand.nextFloat());
worldIn.spawnParticle(EnumParticleTypes.TOTEM, rx, ry, rz, -worldIn.rand.nextFloat(), worldIn.rand.nextFloat(), -worldIn.rand.nextFloat());
}
} else {
worldIn.playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.BLOCK_WOOD_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.5F, 1F);
activate = false;
}
return activate;
}
}
The item class
public class ItemXPInfusedAxe extends ItemAxe {
public static int MIN_XP_ORBS = 1;
public static int MAX_XP_ORBS = 3;
public ItemXPInfusedAxe() {
this(AstreaAPI.infusedIngotToolMaterial, AstreaNames.XP_INFUSED_AXE);
}
public ItemXPInfusedAxe(ToolMaterial toolMaterial, String name) {
super(toolMaterial);
setCreativeTab(AstreaTab.INSTANCE);
setRegistryName(new ResourceLocation(Reference.MOD_ID, name));
}
@Override
public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World world, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EntityLivingBase entity) {
if(state.getBlockHardness(world, pos) != 0F) {
ToolCommons.damageItem(stack, 1, entity);
}
if (world.isRemote) {
for (int i = 0 ; i < 10 ; i++) {
world.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, pos.getX() + 0.5f, pos.getY() + 0.5f, pos.getZ() + 0.5f, world.rand.nextGaussian() / 3.0f, world.rand.nextGaussian() / 3.0f, world.rand.nextGaussian() / 3.0f);
}
}
return true;
}
}
crash-2018-04-13_21.25.10-client.txt