tinycodinglm / mc /mc-0042.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame Contribute Delete
2.04 kB
opencode trace
System You are an expert Fabric mod developer. You write idiomatic Minecraft Fabric mods using Java, Fabric API, and Yarn mappings.

You are an expert Fabric mod developer. You write idiomatic Minecraft Fabric mods using Java, Fabric API, and Yarn mappings.

User

How do I create loot tables for blocks and entities in Fabric?

Assistant

Place loot table files in data/<modid>/loot_table/ directory.

Block Loot Table (data/mymod/loot_table/blocks/simple_block.json):

json
{
  "type": "minecraft:block",
  "pools": [{"rolls": 1, "entries": [{"type": "minecraft:item", "name": "mymod:simple_block"}], 
    "conditions": [{"condition": "minecraft:survives_explosion"}]}]
}

Block with silk touch:

json
{
  "type": "minecraft:block",
  "pools": [
    {"rolls": 1, "entries": [{"type": "minecraft:item", "name": "mymod:glass_block"}],
     "conditions": [{"condition": "minecraft:match_tool", "predicate": {"enchantments": [{"enchantment": "minecraft:silk_touch", "levels": {"min": 1}}]}}]},
    {"rolls": 1, "entries": [{"type": "minecraft:item", "name": "mymod:glass_shard"}],
     "conditions": [{"condition": "minecraft:inverted", "term": {"condition": "minecraft:match_tool", "predicate": {"enchantments": [{"enchantment": "minecraft:silk_touch", "levels": {"min": 1}}]}}}]}]
}

Entity Loot Table (data/mymod/loot_table/entities/custom_entity.json):

json
{
  "type": "minecraft:entity",
  "pools": [
    {"rolls": 1, "entries": [{"type": "minecraft:item", "name": "mymod:entity_drop"}]},
    {"rolls": 1, "entries": [{"type": "minecraft:item", "name": "minecraft:experience_bottle", 
      "functions": [{"function": "minecraft:set_count", "count": {"min": 5, "max": 10, "type": "minecraft:uniform"}}]}]}]
}