mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
47 lines
2.4 KiB
Diff
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 bfbe9b82c14a525bffa96a8dfa071e8805ce6006..c22fa35197ae23526a29bcbf69f3022ffc0701e1 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -1327,6 +1327,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 03de0b6385193b3ba571fd0f8f0bb316a7f158d0..97bace9aac1d907730e991beb3fcd9aa7bbe480c 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -189,6 +189,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<>();
|