Files
Purpur/patches/server/0068-Dispenser-curse-of-binding-protection.patch
William Blake Galbreath 2040a9ac8a Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
8fe5611 Fix Player#playerListName nullability annotation (#6089)
8827886 Add back linking to Adventure Javadoc (#6088)
6ea4da4 AbstractSkeleton should extend RangedEntity (#6087)
a831634 add Optimize Light Engine patch (#5863)
56fd1a2 Update to Minecraft 1.17.1 (#6097)
f8d6cbd Deobfuscate stacktraces in sync load info (#6103)

Tuinity Changes:
5065deb Make CollisionContext initialisation lazy
388bdf5 Optimise ActivationRange#activateEntities again
2310a94 Update to 1.17.1
2021-07-07 04:05:03 -05: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 6848b8a21a4ad3e7dc4cfdb4a73045bf918999b1..f7c915ababdacd0901787d6dd1c08accacadabe5 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -62,6 +62,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.BlockGetter;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.ItemLike;
@@ -1071,6 +1072,12 @@ public abstract class Mob extends LivingEntity {
}
+ // Purpur start
+ public static EquipmentSlot getSlotForDispenser(ItemStack itemstack) {
+ return EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BINDING_CURSE, itemstack) > 0 ? EquipmentSlot.MAINHAND : 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 aab4a63e61aced51b1b6c885fd8b8426a4f14408..ad095c6bc7e00d286c83e37f84d8ed5d4a2c6881 100644
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java
+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java
@@ -56,7 +56,7 @@ public class ArmorItem extends Item implements Wearable {
return false;
} else {
LivingEntity entityliving = (LivingEntity) list.get(0);
- EquipmentSlot enumitemslot = Mob.getEquipmentSlotForItem(armor);
+ EquipmentSlot enumitemslot = pointer.getLevel().purpurConfig.dispenserApplyCursedArmor ? Mob.getEquipmentSlotForItem(armor) : Mob.getSlotForDispenser(armor); // Purpur
ItemStack itemstack1 = armor.split(1);
// CraftBukkit start
Level world = pointer.getLevel();
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 622a73529972ff9906e0fdea43c43ee3d123f418..af4bf306c118fa109b8745e7ac8a0bcaa38a0fbc 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -218,6 +218,11 @@ public class PurpurWorldConfig {
voidDamageDealt = getDouble("gameplay-mechanics.void-damage-dealt", voidDamageDealt);
}
+ 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);