mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
51 lines
2.9 KiB
Diff
51 lines
2.9 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 c9dd775e01da040ac6c97c0ee0147828f1cc7fdd..6a72ce966db535d9f9996bebe23aeae889cde41e 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -1544,6 +1544,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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index addbc5f93292874717e5d394e9ebd7a7a0d69394..0f36235678efa995a10474e6f7652f1782e693d7 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -247,6 +247,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);
|
|
@@ -263,6 +264,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;
|