-
-
Notifications
You must be signed in to change notification settings - Fork 479
Expand file tree
/
Copy path0056-Dispenser-curse-of-binding-protection.patch
More file actions
72 lines (64 loc) · 3.67 KB
/
Copy path0056-Dispenser-curse-of-binding-protection.patch
File metadata and controls
72 lines (64 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From d901d884e7242ab02972eff077cf363bd6f9f965 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
---
src/main/java/net/minecraft/server/EntityInsentient.java | 8 +++++++-
src/main/java/net/minecraft/server/ItemArmor.java | 3 ++-
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 5 +++++
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 89b45da1b..97081f6a4 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -914,9 +914,15 @@ public abstract class EntityInsentient extends EntityLiving {
}
+ // Purpur start
+ public static EnumItemSlot getSlotForDispenser(ItemStack itemstack) {
+ return EnchantmentManager.getEnchantmentLevel(Enchantments.BINDING_CURSE, itemstack) > 0 ? EnumItemSlot.MAINHAND : getSlotForItemStack(itemstack);
+ }
+ // Purpur end
+
+ public static EnumItemSlot getSlotForItemStack(ItemStack itemstack) { return h(itemstack); } // Purpur - OBFHELPER
public static EnumItemSlot h(ItemStack itemstack) {
Item item = itemstack.getItem();
-
return item != Blocks.CARVED_PUMPKIN.getItem() && (!(item instanceof ItemBlock) || !(((ItemBlock) item).getBlock() instanceof BlockSkullAbstract)) ? (item instanceof ItemArmor ? ((ItemArmor) item).b() : (item == Items.ELYTRA ? EnumItemSlot.CHEST : (item == Items.SHIELD ? EnumItemSlot.OFFHAND : EnumItemSlot.MAINHAND))) : EnumItemSlot.HEAD;
}
diff --git a/src/main/java/net/minecraft/server/ItemArmor.java b/src/main/java/net/minecraft/server/ItemArmor.java
index df8c42bfb..a4b3d0c29 100644
--- a/src/main/java/net/minecraft/server/ItemArmor.java
+++ b/src/main/java/net/minecraft/server/ItemArmor.java
@@ -31,7 +31,7 @@ public class ItemArmor extends Item {
return false;
} else {
EntityLiving entityliving = (EntityLiving) list.get(0);
- EnumItemSlot enumitemslot = EntityInsentient.h(itemstack);
+ EnumItemSlot enumitemslot = isourceblock.getWorld().purpurConfig.dispenserApplyCursedArmor ? EntityInsentient.getSlotForItemStack(itemstack) : EntityInsentient.getSlotForDispenser(itemstack); // Purpur
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
// CraftBukkit start
World world = isourceblock.getWorld();
@@ -79,6 +79,7 @@ public class ItemArmor extends Item {
BlockDispenser.a((IMaterial) this, ItemArmor.a);
}
+ public EnumItemSlot getEquipmentSlot() { return b(); } // Purpur - OBFHELPER
public EnumItemSlot b() {
return this.b;
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 0eb8f8bfa..38d85c638 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -103,6 +103,11 @@ public class PurpurWorldConfig {
campfiresGoOutInRain = getBoolean("campfires-go-out-in-rain", campfiresGoOutInRain);
}
+ public boolean dispenserApplyCursedArmor = true;
+ private void dispenserApplyCursedArmor() {
+ dispenserApplyCursedArmor = getBoolean("dispenser-apply-cursed-armor-slots", dispenserApplyCursedArmor);
+ }
+
public boolean allowMoistSoilFromWaterBelow = true;
private void allowMoistSoilFromWaterBelow() {
allowMoistSoilFromWaterBelow = getBoolean("allow-moist-soil-from-water-below", allowMoistSoilFromWaterBelow);
--
2.24.0