Files
Purpur/patches/server/0092-Totems-work-in-inventory.patch
BillyGalbreath d93887a156 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
5b20df6bf added PlayerNameEntityEvent
ff9c82444 Add worldborder events
616b1f3cd consider enchants for destroy speed
aaef1d5cc fix file conversion
674d8f7f7 Make discovered maps config work in treasure maps from loot tables too
be1687914 stop firing pressure plate EntityInteractEvent for ignored entities (fixes #4962)
7d56f38ed Do not use the bukkit singleton for the GUI (Fixes #5301)
4c9bdf53a Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5299)
8647bd130 Improve ServerGUI
fcc6d3359 Throw proper exception on empty JsonList file
17d2e1291 Fix interact event in adventure mode
964e0bf42 MC-29274: Fix Wither hostility towards players
9e24a5213 Fixed furnace cook-speed multiplier losing precision when calculating cook time
c7e42faa3 Do not create unnecessary copies of the passenger list
40881ad67 added tnt minecarts to the tnt height nerf
26be708f4 Remove streams from SensorNearest
5b5989b21 fix nullability of playerlist header/footer, closes #5290
45bc531dd Fix Material#getTranslationKey for Block Materials (#5294)
2021-03-04 21:45:44 -06:00

47 lines
2.4 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 a8cd7f0abf58e69d276e469bd7d5ef6ae619263d..4b7ff69eac4dd5fd5c9b0b26d133daeb128c445d 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1328,6 +1328,19 @@ public abstract class EntityLiving extends Entity {
}
}
+ // Purpur start
+ 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;
+ }
+ }
+ }
+ // 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 743d1fe2eab2157a1100d0ef13d65ce85b10dbaa..40a248746ea53640697395a155c18215fd2bbe51 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -201,6 +201,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 String silkTouchSpawnerName = "Spawner";
public List<String> silkTouchSpawnerLore = new ArrayList<>();