Files
Purpur/patches/server/0113-Totems-work-in-inventory.patch
William Blake Galbreath 8bc19e524a Updated Upstream (Paper & Tuinity)
Upstream has released updates that appears to apply and compile correctly

Paper Changes:
55e2de5c6 Improve per player mob spawning (#3971)
42433c262 Updated Upstream (Bukkit/CraftBukkit) (#3980)
e5ede546a Fix IDE Debug JVM Flag for 1.16 (#3983)
2712c6888 [Auto] Updated Upstream (Bukkit/CraftBukkit)
0901ffd04 Use title packet for actionbar methods (#3959)
2e11235d1 Expand MaterialTags (#3964)
cc25ae47c Amend last commit to fix decompile error forgot to commit
f503db37c Fix AdvancementDataPlayer leak due from quitting early in login
282763b88 Fix SPIGOT-5885 Unable to disable advancements
9b93d122e Fix SPIGOT-5824 Bukkit world-container is not used
bede4d304 Load config files early on

Tuinity Changes:
b0673b3 Merge dev/optimise-notify into ver/1.16
d3dc35c Name craft scheduler threads according to the plugin using them
2020-07-23 15:37:18 -05:00

46 lines
2.2 KiB
Diff

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 061906a56..3b5548f59 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() {