Fix #38 Vic's totem patch

This commit is contained in:
William Blake Galbreath
2020-07-30 18:45:41 -05:00
parent c543151676
commit f148002ffb

View File

@@ -5,18 +5,19 @@ Subject: [PATCH] Totems work in inventory
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 061906a56..3b5548f59 100644
index 061906a569..0b23d4f3e5 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1318,6 +1318,18 @@ public abstract class EntityLiving extends Entity {
@@ -1318,6 +1318,19 @@ public abstract class EntityLiving extends Entity {
}
}
+ // Purpur start
+ if (world.purpurConfig.totemOfUndyingWorksInInventory && itemstack == ItemStack.NULL_ITEM && this instanceof EntityPlayer) {
+ if (world.purpurConfig.totemOfUndyingWorksInInventory && this instanceof EntityPlayer && (itemstack == null || itemstack.getItem() != Items.TOTEM_OF_UNDYING)) {
+ EntityPlayer player = (EntityPlayer) this;
+ for (ItemStack item : player.inventory.items) {
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) {
+ itemstack1 = item;
+ itemstack = item.cloneItemStack();
+ break;
+ }
@@ -28,7 +29,7 @@ index 061906a56..3b5548f59 100644
event.setCancelled(itemstack == null);
this.world.getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 26964f062..cb7812741 100644
index 26964f0620..cb7812741e 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -185,6 +185,11 @@ public class PurpurWorldConfig {