mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
62 lines
3.0 KiB
Diff
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 c87c95160..10735e8bd 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
@@ -985,6 +985,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 669a50411..7cd2e871b 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 7da85ba5a..f741218df 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -155,6 +155,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);
|