From 8bff021a4007f63ce858e02d12f0cdd5b92663ba Mon Sep 17 00:00:00 2001 From: Encode42 Date: Sun, 12 Jan 2025 12:11:13 -0800 Subject: [PATCH] Config to remove curse of binding with weakness --- ...emove-curse-of-binding-with-weakness.patch | 39 ------------------- .../world/inventory/ArmorSlot.java.patch | 11 ++++++ .../purpurmc/purpur/PurpurWorldConfig.java | 2 + 3 files changed, 13 insertions(+), 39 deletions(-) delete mode 100644 patches/server/0194-Config-to-remove-curse-of-binding-with-weakness.patch create mode 100644 purpur-server/minecraft-patches/sources/net/minecraft/world/inventory/ArmorSlot.java.patch diff --git a/patches/server/0194-Config-to-remove-curse-of-binding-with-weakness.patch b/patches/server/0194-Config-to-remove-curse-of-binding-with-weakness.patch deleted file mode 100644 index 8358f7f72..000000000 --- a/patches/server/0194-Config-to-remove-curse-of-binding-with-weakness.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Encode42 -Date: Sun, 8 Aug 2021 16:59:21 -0400 -Subject: [PATCH] Config to remove curse of binding with weakness - - -diff --git a/net/minecraft/world/inventory/ArmorSlot.java b/net/minecraft/world/inventory/ArmorSlot.java -index db7caaa2e77b9b98adac8add3040131c673c036b..262d9b2507d37edf0ed9c0821059e518d1baa9e9 100644 ---- a/net/minecraft/world/inventory/ArmorSlot.java -+++ b/net/minecraft/world/inventory/ArmorSlot.java -@@ -44,7 +44,7 @@ class ArmorSlot extends Slot { - @Override - public boolean mayPickup(Player playerEntity) { - ItemStack itemStack = this.getItem(); -- return (itemStack.isEmpty() || playerEntity.isCreative() || !EnchantmentHelper.has(itemStack, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE)) -+ return (itemStack.isEmpty() || playerEntity.isCreative() || (!EnchantmentHelper.has(itemStack, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE) || playerEntity.level().purpurConfig.playerRemoveBindingWithWeakness && playerEntity.hasEffect(net.minecraft.world.effect.MobEffects.WEAKNESS))) - && super.mayPickup(playerEntity); - } - -diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 84c01175dd4d65b1cb8b185f03d93a4cea0e0656..8f90dbc4395381f712befbbf09b6ae94887843e7 100644 ---- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -@@ -399,6 +399,7 @@ public class PurpurWorldConfig { - public int playerBurpDelay = 10; - public boolean playerBurpWhenFull = false; - public boolean playerRidableInWater = false; -+ public boolean playerRemoveBindingWithWeakness = false; - private void playerSettings() { - if (PurpurConfig.version < 19) { - boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer); -@@ -422,6 +423,7 @@ public class PurpurWorldConfig { - playerBurpDelay = getInt("gameplay-mechanics.player.burp-delay", playerBurpDelay); - playerBurpWhenFull = getBoolean("gameplay-mechanics.player.burp-when-full", playerBurpWhenFull); - playerRidableInWater = getBoolean("gameplay-mechanics.player.ridable-in-water", playerRidableInWater); -+ playerRemoveBindingWithWeakness = getBoolean("gameplay-mechanics.player.curse-of-binding.remove-with-weakness", playerRemoveBindingWithWeakness); - } - - public boolean silkTouchEnabled = false; diff --git a/purpur-server/minecraft-patches/sources/net/minecraft/world/inventory/ArmorSlot.java.patch b/purpur-server/minecraft-patches/sources/net/minecraft/world/inventory/ArmorSlot.java.patch new file mode 100644 index 000000000..c7b2ace18 --- /dev/null +++ b/purpur-server/minecraft-patches/sources/net/minecraft/world/inventory/ArmorSlot.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/inventory/ArmorSlot.java ++++ b/net/minecraft/world/inventory/ArmorSlot.java +@@ -42,7 +_,7 @@ + @Override + public boolean mayPickup(Player player) { + ItemStack item = this.getItem(); +- return (item.isEmpty() || player.isCreative() || !EnchantmentHelper.has(item, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE)) ++ return (item.isEmpty() || player.isCreative() || (!EnchantmentHelper.has(item, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE) || player.level().purpurConfig.playerRemoveBindingWithWeakness && player.hasEffect(net.minecraft.world.effect.MobEffects.WEAKNESS))) // Purpur - Config to remove curse of binding with weakness + && super.mayPickup(player); + } + diff --git a/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java index 389bdff94..19ce852d8 100644 --- a/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -398,6 +398,7 @@ public class PurpurWorldConfig { public int playerBurpDelay = 10; public boolean playerBurpWhenFull = false; public boolean playerRidableInWater = false; + public boolean playerRemoveBindingWithWeakness = false; private void playerSettings() { if (PurpurConfig.version < 19) { boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer); @@ -421,6 +422,7 @@ public class PurpurWorldConfig { playerBurpDelay = getInt("gameplay-mechanics.player.burp-delay", playerBurpDelay); playerBurpWhenFull = getBoolean("gameplay-mechanics.player.burp-when-full", playerBurpWhenFull); playerRidableInWater = getBoolean("gameplay-mechanics.player.ridable-in-water", playerRidableInWater); + playerRemoveBindingWithWeakness = getBoolean("gameplay-mechanics.player.curse-of-binding.remove-with-weakness", playerRemoveBindingWithWeakness); } public boolean silkTouchEnabled = false;