aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjarne Koll <[email protected]>2024-05-31 17:50:30 +0200
committerBjarne Koll <[email protected]>2024-05-31 17:50:30 +0200
commit6f33a8db6764a4288b291e278445db6d2e63c627 (patch)
tree40aacd0684449d903f891aa4951bc455db5c3132
parentc58ec03dacf32f85cfd5c6abb1d1837c7eb06c8a (diff)
downloadPaper-6f33a8db6764a4288b291e278445db6d2e63c627.tar.gz
Paper-6f33a8db6764a4288b291e278445db6d2e63c627.zip
Split methods instead of overload
-rw-r--r--patches/server/0788-ItemStack-damage-API.patch30
-rw-r--r--patches/server/1015-Optimize-Hoppers.patch4
-rw-r--r--patches/server/1037-General-ItemMeta-fixes.patch4
3 files changed, 17 insertions, 21 deletions
diff --git a/patches/server/0788-ItemStack-damage-API.patch b/patches/server/0788-ItemStack-damage-API.patch
index b221270a4f..b43dbbac64 100644
--- a/patches/server/0788-ItemStack-damage-API.patch
+++ b/patches/server/0788-ItemStack-damage-API.patch
@@ -11,28 +11,24 @@ the logic associated with damaging them
public net.minecraft.world.entity.LivingEntity entityEventForEquipmentBreak(Lnet/minecraft/world/entity/EquipmentSlot;)B
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
-index acce1b72185d4687ef5a72dd4014d87149f4b092..b9b06bdabedbbe539eadbf04350e0ba946a4f995 100644
+index acce1b72185d4687ef5a72dd4014d87149f4b092..3883145d37af7bdf5c8d7f81c93a4acf4bd2b3cb 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
-@@ -705,11 +705,16 @@ public final class ItemStack implements DataComponentHolder {
- }
-
- public void hurtAndBreak(int amount, LivingEntity entity, EquipmentSlot slot) {
-+ // Paper start - itemstack damage API
-+ this.hurtAndBreak(amount, entity, slot, false);
-+ }
-+ public void hurtAndBreak(int amount, LivingEntity entity, @org.checkerframework.checker.nullness.qual.Nullable EquipmentSlot slot, boolean force) {
-+ // Paper end - itemstack damage API
- if (!entity.level().isClientSide) {
- if (entity instanceof net.minecraft.world.entity.player.Player) {
- net.minecraft.world.entity.player.Player entityhuman = (net.minecraft.world.entity.player.Player) entity;
-
-- if (entityhuman.hasInfiniteMaterials()) {
-+ if (!force && entityhuman.hasInfiniteMaterials()) { // Paper end - itemstack damage API - damage items in creative mode too if called via API
+@@ -713,7 +713,13 @@ public final class ItemStack implements DataComponentHolder {
return;
}
}
-@@ -726,7 +731,7 @@ public final class ItemStack implements DataComponentHolder {
++ // Paper start - ItemStack damage API - split hurtAndBreak to skip pre-checks like creative mode
++ }
+
++ }
++ public void hurtAndBreakWithoutChecks(int amount, LivingEntity entity, @org.checkerframework.checker.nullness.qual.Nullable EquipmentSlot slot) {
++ {
++ // Paper end - ItemStack damage API - split hurtAndBreak to skip pre-checks like creative mode
+ RandomSource randomsource = entity.getRandom();
+ ServerPlayer entityplayer;
+
+@@ -726,7 +732,7 @@ public final class ItemStack implements DataComponentHolder {
}
this.hurtAndBreak(amount, randomsource, entity, () -> { // Paper - Add EntityDamageItemEvent
diff --git a/patches/server/1015-Optimize-Hoppers.patch b/patches/server/1015-Optimize-Hoppers.patch
index 25ac425db2..270241346c 100644
--- a/patches/server/1015-Optimize-Hoppers.patch
+++ b/patches/server/1015-Optimize-Hoppers.patch
@@ -62,10 +62,10 @@ index 4f076eae3a9c597e41f4520dae8378ec429d9f69..810b6099e734a5524e696beb3f25d6ca
this.profiler.push(() -> {
String s = String.valueOf(worldserver);
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
-index 5b66723189c0585c783d6993a16f6473b9706f6b..1f007067224f2bcbc2ac87143db8d7446b3a2ef2 100644
+index 8000e5415976c737ca56003d1198ea07d1848cc9..a3325dda33372d8995effaefa244d2841e83b9a8 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
-@@ -799,10 +799,16 @@ public final class ItemStack implements DataComponentHolder {
+@@ -800,10 +800,16 @@ public final class ItemStack implements DataComponentHolder {
}
public ItemStack copy() {
diff --git a/patches/server/1037-General-ItemMeta-fixes.patch b/patches/server/1037-General-ItemMeta-fixes.patch
index 19f715d3ae..bfae3c7f92 100644
--- a/patches/server/1037-General-ItemMeta-fixes.patch
+++ b/patches/server/1037-General-ItemMeta-fixes.patch
@@ -10,7 +10,7 @@ public org/bukkit/craftbukkit/block/CraftBlockStates getBlockState(Lorg/bukkit/W
public net/minecraft/world/level/block/entity/BlockEntity saveId(Lnet/minecraft/nbt/CompoundTag;)V
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
-index 1f007067224f2bcbc2ac87143db8d7446b3a2ef2..e0a73b0debcad516bb3f8519341664f4708d14ca 100644
+index a3325dda33372d8995effaefa244d2841e83b9a8..549ba156be055ec9bf4af035e986a95fa2e3f7d3 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -414,7 +414,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -22,7 +22,7 @@ index 1f007067224f2bcbc2ac87143db8d7446b3a2ef2..e0a73b0debcad516bb3f8519341664f4
int newCount = this.getCount();
this.setCount(oldCount);
this.restorePatch(oldData);
-@@ -1256,6 +1256,11 @@ public final class ItemStack implements DataComponentHolder {
+@@ -1257,6 +1257,11 @@ public final class ItemStack implements DataComponentHolder {
public void setItem(Item item) {
this.bukkitStack = null; // Paper
this.item = item;