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

Paper Changes:
PaperMC/Paper@487109f Readd 0414 use distance map to optimise entity tracker (#9868)
PaperMC/Paper@230682d Add raw iron & raw copper blocks to anti xray defaults (#7622)
PaperMC/Paper@44057da Remove duplicate water-sensitivity damage for unaware mobs (#9908)
PaperMC/Paper@f78d7ce Remove "fix-curing-zombie-villager-discount" exploit option (#9895)
PaperMC/Paper@aa6c4c1 Include packet class name in packet encoding error messages (#9907)
PaperMC/Paper@6592fed Use a server impl for hopper event to track get/setItem calls (#9905)
PaperMC/Paper@bffb08c Deprecate Player#boostElytra (#9899)
PaperMC/Paper@43c3432 Add entity API for getting the combined gene of a Panda (#9891)
PaperMC/Paper@15a0de2 Make Team extend ForwardingAudience (#9852)
PaperMC/Paper@0cdce89 Fix a bunch of stuff with player spawn locations (#9887)
PaperMC/Paper@8a3980c Add API to get the collision shape of a block before it's placed (#9821)
PaperMC/Paper@23860da Add predicate for block when raytracing (#9691)
PaperMC/Paper@75d04e9 Broadcast take item packets with collector as source (#9884)
PaperMC/Paper@2553f30 fix secure profile with proxy online mode (#9700)
PaperMC/Paper@e289acc Add more API to LingeringPotionSplashEvent (#9901)
PaperMC/Paper@8cafc07 Added missing enchantables to material tags (#9888)
2023-11-04 20:29:02 -07:00

61 lines
3.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/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 67820c9a971d9c0c24b6d7e6d10dd0b761f24345..de635f425a69ac4f21a80a2c723adf0362501d1f 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -65,6 +65,7 @@ import net.minecraft.world.item.ProjectileWeaponItem;
import net.minecraft.world.item.SpawnEggItem;
import net.minecraft.world.item.SwordItem;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
+import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.Level;
@@ -1174,6 +1175,12 @@ public abstract class Mob extends LivingEntity implements Targeting {
}
+ // Purpur start
+ public static @Nullable EquipmentSlot getSlotForDispenser(ItemStack itemstack) {
+ return EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BINDING_CURSE, itemstack) > 0 ? null : getEquipmentSlotForItem(itemstack);
+ }
+ // Purpur end
+
@Nullable
public static Item getEquipmentForSlot(EquipmentSlot equipmentSlot, int equipmentLevel) {
switch (equipmentSlot) {
diff --git a/src/main/java/net/minecraft/world/item/ArmorItem.java b/src/main/java/net/minecraft/world/item/ArmorItem.java
index 42d87800a328f71c5127ce5599ca4c71cc9bb1cd..7868c2f7b563792f8902d9a77dca46e0dcb82194 100644
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java
+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java
@@ -61,7 +61,7 @@ public class ArmorItem extends Item implements Equipable {
return false;
} else {
LivingEntity entityliving = (LivingEntity) list.get(0);
- EquipmentSlot enumitemslot = Mob.getEquipmentSlotForItem(armor);
+ EquipmentSlot enumitemslot = pointer.level().purpurConfig.dispenserApplyCursedArmor ? Mob.getEquipmentSlotForItem(armor) : Mob.getSlotForDispenser(armor); if (enumitemslot == null) return false; // Purpur
ItemStack itemstack1 = armor.copyWithCount(1); // Paper - shrink below and single item in event
// CraftBukkit start
Level world = pointer.level();
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 9311e620a821bbd46d962dd01ef9b0c1ec99555f..2e2a347d341ef831aaf1a6b01fa2aeb82e76b810 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -224,6 +224,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);