geforkt von Mirrors/Paper
4104545b11
"It was from a different time before books were as jank as they are now. As time has gone on they've only proven to be worse and worse."
35 Zeilen
1.9 KiB
Diff
35 Zeilen
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Wed, 25 Nov 2020 16:33:27 -0800
|
|
Subject: [PATCH] Added PlayerLoomPatternSelectEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
|
index 7e8b6e0e69876cb7bfd444a8dd72edf8289e6dd1..51579f642859fc99c715dfcd286482995012d84a 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
|
@@ -166,7 +166,22 @@ public class LoomMenu extends AbstractContainerMenu {
|
|
@Override
|
|
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
|
|
if (id > 0 && id <= BannerPattern.AVAILABLE_PATTERNS) {
|
|
- this.selectedBannerPatternIndex.set(id);
|
|
+ // Paper start
|
|
+ int enumBannerPatternTypeOrdinal = id;
|
|
+ io.papermc.paper.event.player.PlayerLoomPatternSelectEvent event = new io.papermc.paper.event.player.PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.block.banner.PatternType.getByIdentifier(BannerPattern.values()[id].getHashname()));
|
|
+ if (!event.callEvent()) {
|
|
+ ((Player) player.getBukkitEntity()).updateInventory();
|
|
+ return false;
|
|
+ }
|
|
+ for (BannerPattern nms : BannerPattern.values()) {
|
|
+ if (event.getPatternType().getIdentifier().equals(nms.getHashname())) {
|
|
+ enumBannerPatternTypeOrdinal = nms.ordinal();
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ ((Player) player.getBukkitEntity()).updateInventory();
|
|
+ this.selectedBannerPatternIndex.set(enumBannerPatternTypeOrdinal);
|
|
+ // Paper end
|
|
this.setupResultSlot();
|
|
return true;
|
|
} else {
|