mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 10:27:44 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@eb60bff Create raw chat type as resource file instead of in source (#9226) PaperMC/Paper@99b311d [ci skip] Clarify where furnace-related events are called (#8753) PaperMC/Paper@83cfeb1 Improve java version check (#9692) PaperMC/Paper@deb92c2 Add ItemStack#isEmpty and related methods (#9664) PaperMC/Paper@0c8e84c Enforce sign line nullability when setting line with Adventure Method (#9689) PaperMC/Paper@ede9c06 Fix Projectile#setOwner(null) not clearing owner (#9715) PaperMC/Paper@e312ebb Add DISPLAY tracking range type (#9668) PaperMC/Paper@06a741d Fix leashed pets teleporting to owner when loaded (#9686) PaperMC/Paper@064fb50 Cleanup old async commands patch (#8895) PaperMC/Paper@d8af99a Fix silent equipment change for mobs (#9677) PaperMC/Paper@3cec9c9 [ci skip] Add missing javadoc links (#9497) PaperMC/Paper@ba0e1f5 Fix sapling observer detection and grow event (#9654) PaperMC/Paper@a856073 Fix two beacon bugs (#9675) PaperMC/Paper@581b683 Fix spigot's Forced-Stats (#9663)
61 lines
3.3 KiB
Diff
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 137b08608b2f19aa609c5e1ef47d9b964c47e109..2023ae88e6cb0565f8fe7b525dfe84279bf90dd6 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;
|
|
@@ -1173,6 +1174,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 d7a0cbde8f8c99276307502674c71463fbe7e89c..3500c56cb85d8c76b2acd77976d374eaf487b3b3 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 = Mob.getEquipmentSlotForItem(armor);
|
|
+ EquipmentSlot enumitemslot = pointer.getLevel().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.getLevel();
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index a559ab65bc3f2d78d79e22b0e70afb6affd1d6a3..a42f39fc79c6ab632ae9df59e76a719665fa4d88 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -228,6 +228,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);
|