Skip to content

Commit

Permalink
LocationTag.loot_table_id
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 13, 2021
1 parent 206b7a9 commit bbc5064
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Expand Up @@ -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;
Expand Down Expand Up @@ -3215,6 +3216,24 @@ else if (PolygonTag.matches(attribute.getContext(1))) {
return null;
});

// <--[tag]
// @attribute <LocationTag.loot_table_id>
// @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 <LocationTag.tree_distance>
// @returns ElementTag(Number)
Expand Down
Expand Up @@ -143,7 +143,7 @@ public ObjectTag getObjectAttribute(Attribute attribute) {

// <--[tag]
// @attribute <EntityTag.health_data>
// @returns ElementTag)
// @returns ElementTag
// @mechanism EntityTag.health
// @group attributes
// @description
Expand Down

0 comments on commit bbc5064

Please sign in to comment.