Started by oiivu on Mon, 09/01/2025 - 17:28 Topic category: Help with Minecraft modding (Java Edition) Im trying to make a enchantment that automatically picks the block you break Jump to top this works but it might be a bit jank !((Player)entity).hasCorrectToolForDrops(blockstate, (ServerLevel)world, BlockPos.containing(x, y, z)) if (entity instanceof Player _player) { List<ItemStack> items = Block.getDrops(blockstate, (ServerLevel)world, BlockPos.containing(x, y, z), world .getBlockEntity(BlockPos.containing(x, y, z)), _player, _player.getMainHandItem()); for(ItemStack item: items) { _player.addItem(item); } } Jump to top Permalink Log in or register to post comments
this works but it might be a bit jank !((Player)entity).hasCorrectToolForDrops(blockstate, (ServerLevel)world, BlockPos.containing(x, y, z)) if (entity instanceof Player _player) { List<ItemStack> items = Block.getDrops(blockstate, (ServerLevel)world, BlockPos.containing(x, y, z), world .getBlockEntity(BlockPos.containing(x, y, z)), _player, _player.getMainHandItem()); for(ItemStack item: items) { _player.addItem(item); } } Jump to top Permalink Log in or register to post comments
this works but it might be a bit jank
!((Player)entity).hasCorrectToolForDrops(blockstate, (ServerLevel)world, BlockPos.containing(x, y, z))