Files
Purpur/patches/server/0054-Dispenser-curse-of-binding-protection.patch
granny 200178d7b3 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@7b13d93 Updated Upstream (Bukkit/CraftBukkit) (#11626)
PaperMC/Paper@4e2291e chore: refactor issue templates
PaperMC/Paper@bc4a705 [ci skip] chore: change paste.gg links to mclo.gs (#11629)
PaperMC/Paper@3480489 Update Alternate Current patch to 1.21.3 (#11602)
PaperMC/Paper@575c1c4 Update disableGameRuleLimits casing
PaperMC/Paper@11d708d [ci skip] Add missing feature patch identifiers
PaperMC/Paper@daf3113 Make logs less annoying
PaperMC/Paper@4e01ede Fix inverted global skip check
PaperMC/Paper@d8b66dd fix: move to jline-terminal-ffm on java 22+ and fall back to jni on 21, fixes #10405
PaperMC/Paper@6735c60 Fix enderchest opening animation (#11635)
PaperMC/Paper@de6173b Item DataComponent API (#10845)
PaperMC/Paper@8c5b837 Rework async chunk api implementation
PaperMC/Paper@37b9630 Do not create unneccessary callback in ChunkTaskScheduler#scheduleChunkLoad
PaperMC/Paper@878da16 Fix non block ticking chunks not sending block/light updates
PaperMC/Paper@fdef6d3 Add missing NotNull annotation for getChunksAtAsync cb param
PaperMC/Paper@01dd50f [ci skip] Rebuild patches
PaperMC/Paper@f9f964d Fix drops for shearing bogged (#11628)
PaperMC/Paper@21cc763 Fix drops for shearing mushroom cow (#11632)
PaperMC/Paper@57eab3e Add PlayerItemGroupCooldownEvent (#11625)
PaperMC/Paper@d0dcd7d Fix incorrect invulnerability damage reduction (#11599)
PaperMC/Paper@85bfdc0 Fix NPE when EntityResurrectEvent is uncancelled (#11636)
2024-11-19 03:55:58 -08:00

62 lines
4.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 25 Aug 2019 00:09:52 -0500
Subject: [PATCH] Dispenser curse of binding protection
diff --git a/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
index bf8c511739265c6a9cd277752e844481598f8966..ffe2399ab6b1f311536475d8216238b5b01c5dab 100644
--- a/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
@@ -41,7 +41,7 @@ public class EquipmentDispenseItemBehavior extends DefaultDispenseItemBehavior {
return false;
} else {
LivingEntity entityliving = (LivingEntity) list.getFirst();
- EquipmentSlot enumitemslot = entityliving.getEquipmentSlotForItem(stack);
+ EquipmentSlot enumitemslot = pointer.level().purpurConfig.dispenserApplyCursedArmor ? entityliving.getEquipmentSlotForItem(stack) : entityliving.getEquipmentSlotForDispenserItem(stack); if (enumitemslot == null) return false; // Purpur - Dispenser curse of binding protection
ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below and single item in event
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 952b498b3514205accf48104da37ff713074e484..2bf46dbc9afb2b19ef183b674c5be26f48af55d5 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4692,7 +4692,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (equippable != null && equippable.dispensable()) {
EquipmentSlot enumitemslot = equippable.slot();
- return this.canUseSlot(enumitemslot) && equippable.canBeEquippedBy(this.getType()) ? this.getItemBySlot(enumitemslot).isEmpty() && this.canDispenserEquipIntoSlot(enumitemslot) : false;
+ return this.canUseSlot(enumitemslot) && equippable.canBeEquippedBy(this.getType()) && this.getItemBySlot(enumitemslot).isEmpty() && this.canDispenserEquipIntoSlot(enumitemslot);
} else {
return false;
}
@@ -4717,6 +4717,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
return equippable == null ? slot == EquipmentSlot.MAINHAND && this.canUseSlot(EquipmentSlot.MAINHAND) : slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.getType());
}
+ // Purpur start - Dispenser curse of binding protection
+ public @Nullable EquipmentSlot getEquipmentSlotForDispenserItem(ItemStack itemstack) {
+ return EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.BINDING_CURSE, itemstack) > 0 ? null : this.getEquipmentSlotForItem(itemstack);
+ }
+ // Purpur end - Dispenser curse of binding protection
+
private static SlotAccess createEquipmentSlotAccess(LivingEntity entity, EquipmentSlot slot) {
return slot != EquipmentSlot.HEAD && slot != EquipmentSlot.MAINHAND && slot != EquipmentSlot.OFFHAND ? SlotAccess.forEquipmentSlot(entity, slot, (itemstack) -> {
return itemstack.isEmpty() || entity.getEquipmentSlotForItem(itemstack) == slot;
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 6668d186ff2f8e94ac7a7ce1de9fa0ee86757380..4a3fd89f79d539dd167fe3b616a0e0c539a9ac8f 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -221,6 +221,11 @@ public class PurpurWorldConfig {
});
}
+ public boolean dispenserApplyCursedArmor = true;
+ private void dispenserSettings() {
+ dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);
+ }
+
public boolean farmlandGetsMoistFromBelow = false;
private void farmlandSettings() {
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);