Files
Purpur/patches/server/0090-Totems-work-in-inventory.patch
William Blake Galbreath 13b1d3715e Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
eaadb4a68f Fix Java toolchain configuration to work on arm macOS
8bebf48495 Mark sensor and behavior timings as verbose
6855505490 Fix some inconsistency issues with empty map items (#6304)
ed1dc272e6 Add System.out.println catcher (#6278)
112b6a508a Add force getter to ParticleBuilder (#6300)
a44f486694 Allow plugins to use Log4J to log (#6288)
8c28a33d4e Don't not shuffle visible chunks (#6283)
0e978ea45e Rewrite LogEvents to contain information about the source jar of stacktrace elements (#6142)
6e7f9aafd6 Prevent AFK kick while watching end credits (#6239). (#6265)

Tuinity Changes:
61c9a54783 Don't use CI build number for implementation version (#356)
dc9d19c984 Update packet limiter config to accept mojang or spigot packet class names (#322)
2021-08-02 16:11:12 -05:00

51 lines
3.0 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/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 795d454e46cfa39f80c5fc931f4931d8561b03b4..91fd6709e66ee9c999ba7be3bec2689a5a01528c 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1517,6 +1517,19 @@ public abstract class LivingEntity extends Entity {
}
}
+ // Purpur start
+ if (level.purpurConfig.totemOfUndyingWorksInInventory && this instanceof ServerPlayer && (itemstack == null || itemstack.getItem() != Items.TOTEM_OF_UNDYING)) {
+ ServerPlayer player = (ServerPlayer) this;
+ for (ItemStack item : player.getInventory().items) {
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) {
+ itemstack1 = item;
+ itemstack = item.cloneItemStack(false);
+ break;
+ }
+ }
+ }
+ // Purpur end
+
EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity());
event.setCancelled(itemstack == null);
this.level.getCraftServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 79e193fbf4e8f6cf42496f09debf88ccc99bf11b..8255fd95f0bfb45b3f2f714b0f624c12ff33a4a5 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -230,6 +230,7 @@ public class PurpurWorldConfig {
public String playerDeathExpDropEquation = "expLevel * 7";
public int playerDeathExpDropMax = 100;
public boolean teleportIfOutsideBorder = false;
+ public boolean totemOfUndyingWorksInInventory = false;
private void playerSettings() {
idleTimeoutKick = getBoolean("gameplay-mechanics.player.idle-timeout.kick-if-idle", idleTimeoutKick);
idleTimeoutTickNearbyEntities = getBoolean("gameplay-mechanics.player.idle-timeout.tick-nearby-entities", idleTimeoutTickNearbyEntities);
@@ -240,6 +241,7 @@ public class PurpurWorldConfig {
playerDeathExpDropEquation = getString("gameplay-mechanics.player.exp-dropped-on-death.equation", playerDeathExpDropEquation);
playerDeathExpDropMax = getInt("gameplay-mechanics.player.exp-dropped-on-death.maximum", playerDeathExpDropMax);
teleportIfOutsideBorder = getBoolean("gameplay-mechanics.player.teleport-if-outside-border", teleportIfOutsideBorder);
+ totemOfUndyingWorksInInventory = getBoolean("gameplay-mechanics.player.totem-of-undying-works-in-inventory", totemOfUndyingWorksInInventory);
}
public boolean silkTouchEnabled = false;