mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Dispenser curse of binding protection
This commit is contained in:
@@ -305,6 +305,11 @@ campfires-go-out-in-rain
|
||||
* **default**: true
|
||||
* **description**: Campfires burn out in the rain
|
||||
|
||||
dispenser-apply-cursed-armor-slots
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* **default**: true
|
||||
* **description**: Should dispensers apply armor to armor slots if enchanted with curse of binding
|
||||
|
||||
allow-moist-soil-from-water-below
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* **default**: true
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
From 55a3b704cb50d08070977ad3a5b6816979a1a571 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 47090db89..806dabbbc 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -895,9 +895,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 dec03e4ae..ce77b7e33 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemArmor.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemArmor.java
|
||||
@@ -33,7 +33,7 @@ public class ItemArmor extends Item {
|
||||
return ItemStack.a;
|
||||
} 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();
|
||||
@@ -81,6 +81,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 2ecf5f9eb..6958866a4 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -107,6 +107,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.23.0.rc1
|
||||
|
||||
Reference in New Issue
Block a user