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

Paper Changes:
PaperMC/Paper@eda3d53 [ci skip] Improve PlayerChatEvent Deprecation Message (#9956)
PaperMC/Paper@e1cd9e5 Update paperweight to 1.5.10 and Gradle to 8.4 (#9957)
PaperMC/Paper@96d5e6c Code Generation for TypedKeys (#9233)
PaperMC/Paper@ed753d3 Re-add missing vanilla safeMode arg
PaperMC/Paper@334b2f2 Fix max nearby entities class check (#9967)
PaperMC/Paper@faa2f47 Lazily create LootContext for criterions (#9969)
PaperMC/Paper@8280211 Fix yaw being ignored for first spawn pos (#9959)
PaperMC/Paper@8eac3e1 Don't fire EntityPotionEffectEvent during worldgen (#9965)
PaperMC/Paper@0b20f94 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9953)
PaperMC/Paper@f9938d3 Fix plugin bootstrap dependency tree population (#9963)
PaperMC/Paper@b37bbcf Use ? super in Consumer/Predicate API (#9939)
2023-11-26 22:27:45 -08:00

50 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 642ffbd2632c9cb0438447ca83f598b1df37bd9b..5e701bd6ce6db9ef3cebbc24ce80e00aa1e558d7 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1631,6 +1631,18 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
+ // Purpur start
+ if (level().purpurConfig.totemOfUndyingWorksInInventory && this instanceof ServerPlayer player && (itemstack == null || itemstack.getItem() != Items.TOTEM_OF_UNDYING) && player.getBukkitEntity().hasPermission("purpur.inventory_totem")) {
+ for (ItemStack item : player.getInventory().items) {
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) {
+ itemstack1 = item;
+ itemstack = item.copy();
+ break;
+ }
+ }
+ }
+ // Purpur end
+
org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
event.setCancelled(itemstack == null);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 8f085e8ba40d3bd9fca27b18b9ee156bbffe6bc3..538c6f1cec00ef0ce8e793a5d205875d2d9aac92 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -243,6 +243,7 @@ public class PurpurWorldConfig {
public String playerDeathExpDropEquation = "expLevel * 7";
public int playerDeathExpDropMax = 100;
public boolean teleportIfOutsideBorder = false;
+ public boolean totemOfUndyingWorksInInventory = false;
private void playerSettings() {
if (PurpurConfig.version < 19) {
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
@@ -257,6 +258,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;