diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java index 3d0c1a9ea1..6f7c16000e 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java @@ -45,6 +45,7 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; +import org.bukkit.loot.LootTable; import org.bukkit.loot.Lootable; import org.bukkit.material.Attachable; import org.bukkit.material.MaterialData; @@ -3215,6 +3216,24 @@ else if (PolygonTag.matches(attribute.getContext(1))) { return null; }); + // <--[tag] + // @attribute + // @returns ElementTag + // @mechanism LocationTag.clear_loot_table + // @description + // Returns an element indicating the minecraft key for the loot-table for the chest at this location (if any). + // --> + registerTag("loot_table_id", (attribute, object) -> { + BlockState state = object.getBlockStateForTag(attribute); + if (state instanceof Lootable) { + LootTable table = ((Lootable) state).getLootTable(); + if (table != null) { + return new ElementTag(table.getKey().toString()); + } + } + return null; + }); + // <--[tag] // @attribute // @returns ElementTag(Number) diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityHealth.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityHealth.java index 7c8f842a2e..16b83373a0 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityHealth.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityHealth.java @@ -143,7 +143,7 @@ public ObjectTag getObjectAttribute(Attribute attribute) { // <--[tag] // @attribute - // @returns ElementTag) + // @returns ElementTag // @mechanism EntityTag.health // @group attributes // @description