mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 18:07:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@bcf52fe Delete some old patches PaperMC/Paper@348c855 Readd last API patch (with TODO) PaperMC/Paper@b630564 More patches PaperMC/Paper@3cb16c9 Add back per player mob spawning PaperMC/Paper@fe7b741 Another one PaperMC/Paper@12ed021 Update material tags and entity effect PaperMC/Paper@02bca1e Remove timings impl PaperMC/Paper@4d87302 Fix NPE and StackOverflowError for dispensers PaperMC/Paper@f8f230a Remove unnecessary AT PaperMC/Paper@29bf7be Fix unused parameter in PlayerList#remove PaperMC/Paper@9e35192 Execute spark tasks during tick sleep (#11525) PaperMC/Paper@e35f199 Use declaration order for state holder property iteration PaperMC/Paper@6288adb Remove leftover missed timings calls (#11527)
62 lines
4.3 KiB
Diff
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 a43ea83dbbd5946096cdde31af766674bda6c3be..8077334c24c3bf17404f24a8c5f22134ea01274d 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.split(1);
|
|
|
|
// 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 4fc0aa48e4e0e291ba3f8291a2dfa671fbe553e5..bc21cac3af01dd2cca1d4431a1b651e8c71accae 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -4669,7 +4669,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;
|
|
}
|
|
@@ -4694,6 +4694,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 cd90555354713be9a26c0a0abed43535a61281e8..680a89bff31861c25d76bf7ab59d87232228b34c 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -219,6 +219,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);
|