26 juil. 2020, 18:26

@jerem5 cadeau :beaming_face_with_smiling_eyes:

@Override
    public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();
        
        Random random = new Random();
        
        if(block.equals(Blocks.IRON_ORE) && !worldIn.isRemote)
        {
            worldIn.spawnEntity(new EntityItem(worldIn, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.IRON_INGOT, random.nextInt(2))));
            worldIn.setBlockToAir(pos);
            return EnumActionResult.SUCCESS;
        }
        else
        {
            return EnumActionResult.PASS;
        }
    }