mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 09:57:43 +01:00
Fix #38 Vic's totem patch
This commit is contained in:
@@ -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
|
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
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||||
+++ b/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
|
+ // 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;
|
+ EntityPlayer player = (EntityPlayer) this;
|
||||||
+ for (ItemStack item : player.inventory.items) {
|
+ for (ItemStack item : player.inventory.items) {
|
||||||
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) {
|
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) {
|
||||||
|
+ itemstack1 = item;
|
||||||
+ itemstack = item.cloneItemStack();
|
+ itemstack = item.cloneItemStack();
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
@@ -28,7 +29,7 @@ index 061906a56..3b5548f59 100644
|
|||||||
event.setCancelled(itemstack == null);
|
event.setCancelled(itemstack == null);
|
||||||
this.world.getServer().getPluginManager().callEvent(event);
|
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
|
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
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
@@ -185,6 +185,11 @@ public class PurpurWorldConfig {
|
@@ -185,6 +185,11 @@ public class PurpurWorldConfig {
|
||||||
|
|||||||
Reference in New Issue
Block a user