0
0
mirror of https://github.com/PaperMC/Paper.git synced 2025-05-26 00:50:36 +00:00
Files
Paper/paper-server/patches/sources/net/minecraft/world/item/EmptyMapItem.java.patch
2025-05-24 22:45:32 +02:00

20 lines
1.4 KiB
Diff

--- a/net/minecraft/world/item/EmptyMapItem.java
+++ b/net/minecraft/world/item/EmptyMapItem.java
@@ -17,10 +_,16 @@
public InteractionResult use(Level level, Player player, InteractionHand hand) {
ItemStack itemInHand = player.getItemInHand(hand);
if (level instanceof ServerLevel serverLevel) {
+ org.bukkit.inventory.ItemStack emptyMap = itemInHand.asBukkitCopy(); // Paper - PlayerMapFilledEvent
itemInHand.consume(1, player);
player.awardStat(Stats.ITEM_USED.get(this));
serverLevel.playSound(null, player, SoundEvents.UI_CARTOGRAPHY_TABLE_TAKE_RESULT, player.getSoundSource(), 1.0F, 1.0F);
ItemStack itemStack = MapItem.create(serverLevel, player.getBlockX(), player.getBlockZ(), (byte)0, true, false);
+ // Paper start - PlayerMapFilledEvent
+ io.papermc.paper.event.player.PlayerMapFilledEvent event = new io.papermc.paper.event.player.PlayerMapFilledEvent((org.bukkit.entity.Player) player.getBukkitEntity(), emptyMap, org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack));
+ event.callEvent();
+ itemStack = org.bukkit.craftbukkit.inventory.CraftItemStack.unwrap(event.getCreatedMap());
+ // Paper end - PlayerMapFilledEvent
if (itemInHand.isEmpty()) {
return InteractionResult.SUCCESS.heldItemTransformedTo(itemStack);
} else {