Files
Purpur/patches/server/0078-Dispenser-curse-of-binding-protection.patch
William Blake Galbreath 67be68c780 Updated Upstream (Tuinity)
Upstream has released updates that appears to apply and compile correctly

Tuinity Changes:
3b008f5 Optimisations
200f825 Actually unload POI data
db64f14 Make sure to despawn entities if they are outside the player general
89276ac Fix villagers aggressively looking at people
8830cef Remove streams for poi searching in some zombie pathfinding
a17dc2c Attempt to fix incorrect nearest village distance tracker updating
ef8cd34 Fix NPE
3e45700Do not return complex parts for entity by class lookup
2110847 Rewrite getClosestEntity
460581d Fix getClosestEntity not working
2cb36ca Optimise non-flush packet sending
784b838 Some fixes
e2dcdd1 Correct return value for ChunkCache#getCubes
968512b Add Velocity natives for encryption and compression (#188)
102d60b Rebuild patches
57fed71 Fix decompression with Velocity natives
442890b Fix decompression with Velocity natives (#191)
0179ea8 Re-Add region manager and notify patch
cbffdcc Do not mark entities in unloaded chunks as being in blocks
f2eef4a Fixup dev branch patches and store reverted patches in revert folder
2020-11-05 18:14:13 -06:00

62 lines
3.0 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/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 84ac5112a2..202ccf2a7f 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -992,6 +992,13 @@ 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 j(itemstack); } // Purpur - OBFHELPER
public static EnumItemSlot j(ItemStack itemstack) {
Item item = itemstack.getItem();
diff --git a/src/main/java/net/minecraft/server/ItemArmor.java b/src/main/java/net/minecraft/server/ItemArmor.java
index 669a504118..7cd2e871b5 100644
--- a/src/main/java/net/minecraft/server/ItemArmor.java
+++ b/src/main/java/net/minecraft/server/ItemArmor.java
@@ -35,7 +35,7 @@ public class ItemArmor extends Item implements ItemWearable {
return false;
} else {
EntityLiving entityliving = (EntityLiving) list.get(0);
- EnumItemSlot enumitemslot = EntityInsentient.j(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();
@@ -94,6 +94,7 @@ public class ItemArmor extends Item implements ItemWearable {
this.m = builder.build();
}
+ 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 286a2a986b..cc78145aed 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -164,6 +164,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);