mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@70b0e84 Properly apply damage tick after absorption (#11043)
53 lines
3.4 KiB
Diff
53 lines
3.4 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/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index 298ec8aace088d1817a2b4b8b481b5ebfa73949e..a84f45e930751ffbaa60bae47654e50965c44996 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -4536,6 +4536,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
return EquipmentSlot.MAINHAND;
|
|
}
|
|
|
|
+ // 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/net/minecraft/world/item/ArmorItem.java b/src/main/java/net/minecraft/world/item/ArmorItem.java
|
|
index 647a4601deace52f8d855f512a73671f82b4762a..d05b1e129eee07434d162e1b949fd5633418ef66 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java
|
|
@@ -60,7 +60,7 @@ public class ArmorItem extends Item implements Equipable {
|
|
return false;
|
|
} else {
|
|
LivingEntity entityliving = (LivingEntity) list.get(0);
|
|
- EquipmentSlot enumitemslot = entityliving.getEquipmentSlotForItem(armor);
|
|
+ EquipmentSlot enumitemslot = pointer.level().purpurConfig.dispenserApplyCursedArmor ? entityliving.getEquipmentSlotForItem(armor) : entityliving.getEquipmentSlotForDispenserItem(armor); if (enumitemslot == null) return false; // Purpur - Dispenser curse of binding protection
|
|
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 022cebe27d305073a05475cb045e863135de5446..68ab094b44d693612dd0858d5a2caa2aae63c75a 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -225,6 +225,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);
|