Use OBFHELPER in previous commit

This commit is contained in:
Shane Freeder 2019-01-06 17:48:24 +00:00
parent 5cdbb30e78
commit c608a94ff7
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
2 changed files with 13 additions and 5 deletions

View File

@ -1,4 +1,4 @@
From 236cd22b5c0bffc0d883deb468f857eaf72540a3 Mon Sep 17 00:00:00 2001 From 90cb0ca1d5b47eb2ce7ffa93f10a1cae149ddfad Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:55:47 -0400 Date: Mon, 28 Mar 2016 20:55:47 -0400
Subject: [PATCH] MC Utils Subject: [PATCH] MC Utils
@ -297,7 +297,7 @@ index b8abd6363..a07ee150c 100644
// Paper end // Paper end
} }
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 53511f0cc..00e230037 100644 index 53511f0cc..d1267f3d7 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java --- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -578,6 +578,17 @@ public final class ItemStack { @@ -578,6 +578,17 @@ public final class ItemStack {
@ -318,6 +318,14 @@ index 53511f0cc..00e230037 100644
public void setTag(@Nullable NBTTagCompound nbttagcompound) { public void setTag(@Nullable NBTTagCompound nbttagcompound) {
this.tag = nbttagcompound; this.tag = nbttagcompound;
} }
@@ -662,6 +673,7 @@ public final class ItemStack {
return this.tag != null && this.tag.hasKeyOfType("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false;
}
+ public void getOrCreateTagAndSet(String s, NBTBase nbtbase) { a(s, nbtbase);} // Paper - OBFHELPER
public void a(String s, NBTBase nbtbase) {
this.getOrCreateTag().set(s, nbtbase);
}
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
new file mode 100644 new file mode 100644
index 000000000..c97e116aa index 000000000..c97e116aa

View File

@ -1,4 +1,4 @@
From 0c0ee91d52bacd3d616fedf173cf2684a90d4c50 Mon Sep 17 00:00:00 2001 From 84094387063f1158ef9192709e67e222cb39c5ed Mon Sep 17 00:00:00 2001
From: Michael Himing <mhiming@gmail.com> From: Michael Himing <mhiming@gmail.com>
Date: Sun, 16 Dec 2018 13:07:33 +1100 Date: Sun, 16 Dec 2018 13:07:33 +1100
Subject: [PATCH] Fix PlayerEditBookEvent Subject: [PATCH] Fix PlayerEditBookEvent
@ -10,7 +10,7 @@ it impossible to properly cancel the event or modify the book meta
cancelled writing cancelled writing
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 74c570615..616dbb152 100644 index 74c570615..9741d3b23 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -816,10 +816,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -816,10 +816,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@ -22,7 +22,7 @@ index 74c570615..616dbb152 100644
- CraftEventFactory.handleEditBookEvent(player, enumitemslot, old, itemstack1); // CraftBukkit - CraftEventFactory.handleEditBookEvent(player, enumitemslot, old, itemstack1); // CraftBukkit
+ // Paper start - dont mutate players current item, set it from the event + // Paper start - dont mutate players current item, set it from the event
+ ItemStack newBook = itemstack1.cloneItemStack(); + ItemStack newBook = itemstack1.cloneItemStack();
+ newBook.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8)); + newBook.getOrCreateTagAndSet("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
+ this.player.setSlot(enumitemslot, CraftEventFactory.handleEditBookEvent(player, enumitemslot, itemstack1, newBook)); + this.player.setSlot(enumitemslot, CraftEventFactory.handleEditBookEvent(player, enumitemslot, itemstack1, newBook));
+ // Paper end + // Paper end
} }