Files
Purpur/patches/server/0201-Config-to-remove-curse-of-binding-with-weakness.patch
2023-12-07 16:04:02 -08:00

40 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Sun, 8 Aug 2021 16:59:21 -0400
Subject: [PATCH] Config to remove curse of binding with weakness
diff --git a/src/main/java/net/minecraft/world/inventory/InventoryMenu.java b/src/main/java/net/minecraft/world/inventory/InventoryMenu.java
index 9af1da3858d6cf79b8bfaf99dde1370ccc50d023..1acb41fab25bdbc4109913b111dbe3b0e106af3f 100644
--- a/src/main/java/net/minecraft/world/inventory/InventoryMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/InventoryMenu.java
@@ -95,7 +95,7 @@ public class InventoryMenu extends RecipeBookMenu<CraftingContainer> {
public boolean mayPickup(Player playerEntity) {
ItemStack itemstack = this.getItem();
- return !itemstack.isEmpty() && !playerEntity.isCreative() && EnchantmentHelper.hasBindingCurse(itemstack) ? false : super.mayPickup(playerEntity);
+ return !itemstack.isEmpty() && !playerEntity.isCreative() && EnchantmentHelper.hasBindingCurse(itemstack) ? playerEntity.level().purpurConfig.playerRemoveBindingWithWeakness && playerEntity.hasEffect(net.minecraft.world.effect.MobEffects.WEAKNESS) : super.mayPickup(playerEntity); // Purpur
}
@Override
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 80f13907f068fc6c52595ea3cf93c1a4d5d03b69..073bd3a0c0d06269738b406b8de08db99e914f8d 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -404,6 +404,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);
@@ -427,6 +428,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);
}
private static boolean projectileDespawnRateSettingsMigrated = false;