mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
48 lines
3.1 KiB
Diff
48 lines
3.1 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 c549618421c5d077c3d977d8d2064eca2acc438a..5972fa434847d24fa98b7895fd8386d20a636885 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/InventoryMenu.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/InventoryMenu.java
|
|
@@ -4,6 +4,7 @@ import com.mojang.datafixers.util.Pair;
|
|
import net.minecraft.network.chat.Component;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
import net.minecraft.world.Container;
|
|
+import net.minecraft.world.effect.MobEffects;
|
|
import net.minecraft.world.entity.EquipmentSlot;
|
|
import net.minecraft.world.entity.Mob;
|
|
import net.minecraft.world.entity.player.Inventory;
|
|
@@ -95,7 +96,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(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 91e254c6694cab5b720c5873d992db9f8812fcfc..3d51c69c652f398839e0dbb7b804205b56f1c3ea 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -409,6 +409,7 @@ public class PurpurWorldConfig {
|
|
public int playerPortalWaitTime = 80;
|
|
public int playerCreativePortalWaitTime = 1;
|
|
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);
|
|
@@ -436,6 +437,7 @@ public class PurpurWorldConfig {
|
|
playerPortalWaitTime = getInt("gameplay-mechanics.player.portal-wait-time", playerPortalWaitTime);
|
|
playerCreativePortalWaitTime = getInt("gameplay-mechanics.player.creative-portal-wait-time", playerCreativePortalWaitTime);
|
|
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;
|