mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Updated Upstream (Bukkit/CraftBukkit) (#3980)
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 09f10fd9 SPIGOT-5950: Add PrepareSmithingEvent event CraftBukkit Changes:7c03d257
SPIGOT-6011: End Gateways do not work on Non-Main End Worldsd492e363
SPIGOT-6015: Small Armor Stand doesn't drop items5db13eea
SPIGOT-5950: Add PrepareSmithingEvent event
This commit is contained in:
parent
5021388bcf
commit
7673fda496
5 changed files with 81 additions and 20 deletions
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add PrepareResultEvent / PrepareGrindstoneEvent
|
|||
|
||||
Adds a new event for all crafting stations that generate a result slot item
|
||||
|
||||
Anvil and Grindstone now extend this event
|
||||
Anvil, Grindstone and Smithing now extend this event
|
||||
|
||||
Grindstone is a backwards compat from a previous PrepareGrindstoneEvent
|
||||
|
||||
|
@ -153,3 +153,59 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
+ */ // Paper
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.event.inventory;
|
||||
|
||||
+import com.destroystokyo.paper.event.inventory.PrepareResultEvent;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Called when an item is put in a slot for upgrade by a Smithing Table.
|
||||
*/
|
||||
-public class PrepareSmithingEvent extends InventoryEvent {
|
||||
+// Paper start - extend PrepareResultEvent
|
||||
+public class PrepareSmithingEvent extends PrepareResultEvent {
|
||||
|
||||
- private static final HandlerList handlers = new HandlerList();
|
||||
- private ItemStack result;
|
||||
+ //private static final HandlerList handlers = new HandlerList();
|
||||
+ //private ItemStack result;
|
||||
|
||||
public PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
||||
- super(inventory);
|
||||
- this.result = result;
|
||||
+ super(inventory, result);
|
||||
+ //this.result = result;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -0,0 +0,0 @@ public class PrepareSmithingEvent extends InventoryEvent {
|
||||
*/
|
||||
@Nullable
|
||||
public ItemStack getResult() {
|
||||
- return result;
|
||||
+ return super.getResult(); // Paper
|
||||
}
|
||||
|
||||
public void setResult(@Nullable ItemStack result) {
|
||||
- this.result = result;
|
||||
+ super.setResult(result); // Paper
|
||||
}
|
||||
|
||||
+ /* // Paper - comment out
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -0,0 +0,0 @@ public class PrepareSmithingEvent extends InventoryEvent {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+ */ // Paper
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add PrepareResultEvent
|
|||
|
||||
Adds a new event for all crafting stations that generate a result slot item
|
||||
|
||||
Anvil and Grindstone now extend this event
|
||||
Anvil, Grindstone and Smithing 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
|
||||
|
@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/ContainerSmithing.java
|
||||
+++ b/src/main/java/net/minecraft/server/ContainerSmithing.java
|
||||
@@ -0,0 +0,0 @@ public class ContainerSmithing extends ContainerAnvilAbstract {
|
||||
this.resultInventory.setItem(0, itemstack);
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack); // CraftBukkit
|
||||
}
|
||||
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper
|
||||
|
@ -125,6 +125,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ //return event; // Paper
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
- public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) {
|
||||
- PrepareSmithingEvent event = new PrepareSmithingEvent(view, CraftItemStack.asCraftMirror(item).clone());
|
||||
- event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
|
||||
+ // Paper start - disable this method, handled in callPrepareResultEvent
|
||||
+ public static void callPrepareSmithingEvent(InventoryView view, ItemStack item) { // Paper - verify nothing uses return - handled below in PrepareResult
|
||||
+ PrepareSmithingEvent event = new PrepareSmithingEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone
|
||||
+ //event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // Paper - 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 void callPrepareResultEvent(net.minecraft.server.Container container, int resultSlot) {
|
||||
|
@ -136,6 +149,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ event = new PrepareAnvilEvent(view, result);
|
||||
+ } else if (view.getTopInventory() instanceof org.bukkit.inventory.GrindstoneInventory) {
|
||||
+ event = new com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent(view, result);
|
||||
+ } else if (view.getTopInventory() instanceof org.bukkit.inventory.SmithingInventory) {
|
||||
+ event = new PrepareSmithingEvent(view, result);
|
||||
+ } else {
|
||||
+ event = new com.destroystokyo.paper.event.inventory.PrepareResultEvent(view, result);
|
||||
+ }
|
||||
|
|
|
@ -228,24 +228,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
int i;
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
boolean flag = this.lastDamageByPlayerTime > 0;
|
||||
|
||||
this.dropInventory(); // CraftBukkit - from below
|
||||
+ org.bukkit.event.entity.EntityDeathEvent deathEvent; // Paper
|
||||
if (this.cV() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
this.a(damagesource, flag);
|
||||
this.dropDeathLoot(damagesource, i, flag);
|
||||
// CraftBukkit start - Call death event
|
||||
- CraftEventFactory.callEntityDeathEvent(this, this.drops);
|
||||
- this.drops = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
+ deathEvent = CraftEventFactory.callEntityDeathEvent(this, this.drops); // Paper
|
||||
} else {
|
||||
- CraftEventFactory.callEntityDeathEvent(this);
|
||||
+ deathEvent = CraftEventFactory.callEntityDeathEvent(this); // Paper
|
||||
// CraftBukkit end
|
||||
}
|
||||
// CraftBukkit start - Call death event
|
||||
- CraftEventFactory.callEntityDeathEvent(this, this.drops);
|
||||
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, this.drops); // Paper
|
||||
+ this.postDeathDropItems(deathEvent); // Paper
|
||||
+ this.drops = new ArrayList<>(); // Paper
|
||||
this.drops = new ArrayList<>();
|
||||
// CraftBukkit end
|
||||
|
||||
// this.dropInventory();// CraftBukkit - moved up
|
||||
this.dropExperience();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f1e73b038b29211b199ff9b13bca576daeb660b2
|
||||
Subproject commit 09f10fd90008c556aafbfaaa256fd7199db45056
|
|
@ -1 +1 @@
|
|||
Subproject commit 8b831a965200a2ba7d1c01d720e265565ae9f4d4
|
||||
Subproject commit 7c03d257dda5e6d029d4a14a3d1e811801938efb
|
Loading…
Reference in a new issue