-
-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91976a8
commit 60e6fa5
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: draycia <lonelyyordle@gmail.com> | ||
Date: Wed, 29 Apr 2020 00:45:58 -0700 | ||
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 3a2a45a65..3bd38d99f 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 { | ||
} | ||
} | ||
|
||
+ // Purpur start | ||
+ if (world.purpurConfig.totemOfUndyingWorksInInventory && itemstack == ItemStack.NULL_ITEM && this instanceof EntityPlayer) { | ||
+ EntityPlayer player = (EntityPlayer) this; | ||
+ for (ItemStack item : player.inventory.items) { | ||
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) { | ||
+ itemstack = item.cloneItemStack(); | ||
+ break; | ||
+ } | ||
+ } | ||
+ } | ||
+ // Purpur end | ||
+ | ||
EntityResurrectEvent event = new EntityResurrectEvent((LivingEntity) this.getBukkitEntity()); | ||
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 | ||
--- 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 { | ||
teleportIfOutsideBorder = getBoolean("gameplay-mechanics.player.teleport-if-outside-border", teleportIfOutsideBorder); | ||
} | ||
|
||
+ public boolean totemOfUndyingWorksInInventory = false; | ||
+ private void totemOfUndyingWorksInInventory() { | ||
+ totemOfUndyingWorksInInventory = getBoolean("gameplay-mechanics.player.totem-of-undying-works-in-inventory", totemOfUndyingWorksInInventory); | ||
+ } | ||
+ | ||
public boolean silkTouchEnabled = false; | ||
public List<Item> silkTouchTools = new ArrayList<>(); | ||
private void silkTouchSettings() { |