geforkt von Mirrors/Paper
Ursprung
130bffdf85
Commit
7f78e35522
@ -7,6 +7,18 @@ Adds a new event for all crafting stations that generate a result slot item
|
||||
|
||||
Anvil and Grindstone now extend this event
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/Container.java
|
||||
+++ b/src/main/java/net/minecraft/server/Container.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Container {
|
||||
return nonnulllist;
|
||||
}
|
||||
|
||||
+ public void notifyListeners() { this.c(); } // Paper - OBFHELPER
|
||||
public void c() {
|
||||
int i;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
|
||||
@ -15,8 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
this.e();
|
||||
+
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(getBukkitView(), this.resultInventory.getItem(0), 2); // Paper
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@ -25,13 +36,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/ContainerAnvilAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/ContainerAnvilAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class ContainerAnvilAbstract extends Container {
|
||||
super.a(iinventory);
|
||||
if (iinventory == this.repairInventory) {
|
||||
this.e();
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper
|
||||
}
|
||||
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(getBukkitView(), this.resultInventory.getItem(0), 2); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/ContainerCartography.java b/src/main/java/net/minecraft/server/ContainerCartography.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ContainerCartography.java
|
||||
@ -40,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.a(itemstack, itemstack1, itemstack2);
|
||||
}
|
||||
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(getBukkitView(), this.resultInventory.getItem(0), 2); // Paper
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper
|
||||
}
|
||||
|
||||
private void a(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2) {
|
||||
@ -48,24 +59,11 @@ diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/m
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
||||
+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryGrindstone;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
import org.bukkit.entity.Player;
|
||||
// CraftBukkit end
|
||||
+// Paper start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent;
|
||||
+// Paper end
|
||||
|
||||
public class ContainerGrindstone extends Container {
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ContainerGrindstone extends Container {
|
||||
super.a(iinventory);
|
||||
if (iinventory == this.craftInventory) {
|
||||
this.e();
|
||||
+ // Paper start
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(getBukkitView(), this.resultInventory.getItem(0), 2); // Paper
|
||||
+ // Paper end
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper
|
||||
}
|
||||
|
||||
}
|
||||
@ -74,11 +72,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/ContainerLoom.java
|
||||
+++ b/src/main/java/net/minecraft/server/ContainerLoom.java
|
||||
@@ -0,0 +0,0 @@ public class ContainerLoom extends Container {
|
||||
}
|
||||
|
||||
this.j();
|
||||
this.c();
|
||||
+
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(getBukkitView(), this.resultInventory.getItem(0), 3); // Paper
|
||||
- this.c();
|
||||
+ //this.c(); // Paper - done below
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 3); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -90,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.resultInventory.setItem(0, itemstack);
|
||||
}
|
||||
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(getBukkitView(), this.resultInventory.getItem(0), 2); // Paper
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -102,7 +101,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.a(iinventory, itemstack);
|
||||
}
|
||||
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(getBukkitView(), this.resultInventory.getItem(0), 1); // Paper
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 1); // Paper
|
||||
}
|
||||
|
||||
private void a(IInventory iinventory, ItemStack itemstack) {
|
||||
@ -122,14 +121,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone
|
||||
+ //event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // disable event
|
||||
event.getInventory().setItem(2, event.getResult());
|
||||
- return event;
|
||||
+ //return event; // Paper
|
||||
+ }
|
||||
}
|
||||
+ // Paper end
|
||||
+
|
||||
+ // Paper start - support specific overrides for prepare result
|
||||
+ public static com.destroystokyo.paper.event.inventory.PrepareResultEvent callPrepareResultEvent(InventoryView view, ItemStack item, int resultSlot) {
|
||||
+ public static void callPrepareResultEvent(net.minecraft.server.Container container, int resultSlot) {
|
||||
+ com.destroystokyo.paper.event.inventory.PrepareResultEvent event;
|
||||
+ CraftItemStack result = CraftItemStack.asCraftMirror(item).clone();
|
||||
+ InventoryView view = container.getBukkitView();
|
||||
+ org.bukkit.inventory.ItemStack origItem = view.getTopInventory().getItem(resultSlot);
|
||||
+ CraftItemStack result = origItem != null ? CraftItemStack.asCraftCopy(origItem) : null;
|
||||
+ if (view.getTopInventory() instanceof org.bukkit.inventory.AnvilInventory) {
|
||||
+ event = new PrepareAnvilEvent(view, result);
|
||||
+ } else if (view.getTopInventory() instanceof org.bukkit.inventory.GrindstoneInventory) {
|
||||
@ -139,8 +141,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ event.callEvent();
|
||||
+ event.getInventory().setItem(resultSlot, event.getResult());
|
||||
return event;
|
||||
}
|
||||
+ container.notifyListeners();
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren