This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void handlePickBlock(@NotNull PlayerPickBlockEvent event) { | |
| var player = event.getPlayer(); | |
| if (player.getGameMode() != GameMode.CREATIVE) return; // Sanity | |
| var world = MapWorld.forPlayerOptional(player); | |
| if (world == null || !world.canEdit(player)) return; // Sanity | |
| // First try to get the block from the item registry | |
| var block = event.getBlock(); | |
| var itemStack = world.itemRegistry().getItemStack(block, event.isIncludeData()); |