Greymerk / minecraft-roguelike

This is a mod for minecraft that adds randomly generated dungeon complexes.
GNU General Public License v3.0
130 stars 53 forks source link

Custom loot failing to appear. #180

Closed JustLiam040 closed 5 months ago

JustLiam040 commented 5 years ago

Loot Tables.zip

Attached is a zip file for my loot tables as i figured you wouldnt want them all posted individually; as stated in the title even though i have edited the loot tables as described, they refuse to spawn the items i have chosen. I am fairly certain i have got the coding correct as i am using notepad ++ which allows me to see whether ive failed to close a bracket, have trailing commas etc.

However any suggestions as to why these modded items are refusing to spawn would be greatly appreciated. I had a look through the github and saw a few vaguely related topics, though none had been commented on. I'll paste in my Loot_all.json however this is also included in the zip. - Imitially i thought it may have been due to weight, however as you can see i tried to bump up the weight of the items i wanted quite significantly, yet still had no luck seeing those items.

{ "name" : "demo:loot_all", "loot_rules" : [ { "level" : [0, 1, 2, 3, 4], "type" : "FOOD", "loot" : [ {"data" : {"name" : "minecraft:cookie", "min" : 2, "max" : 8}, "weight" : 1}, {"data" : {"name" : "minecraft:bread", "min" : 1, "max" : 3}, "weight" : 5}, {"data" : {"name" : "minecraft:apple"}, "weight" : 1}, {"data" : {"name" : "minecraft:cooked_porkchop"}, "weight" : 2}, {"data" : {"name" : "minecraft:cooked_chicken"}, "weight" : 2}, {"data" : {"name" : "minecraft:cooked_beef"}, "weight" : 2}, {"data" : {"name" : "minecraft:cooked_rabbit"}, "weight" : 1}, {"data" : {"name" : "minecraft:cooked_fish"}, "weight" : 1}, {"data" : {"name" : "minecraft:baked_potato"}, "weight" : 1}, {"data" : {"name" : "minecraft:rabbit_stew"}, "weight" : 1}, {"data" : {"name" : "twilightforest:maze_wafer"}, "weight" : 10}, {"data" : {"name" : "botania:tinypotato"}, "weight" : 10}, {"data" : {"name" : "twilightforest:cooked_venison"}, "weight" : 10}, {"data" : {"name" : "actuallyadditions:item_food:10"}, "weight" : 10}, {"data" : {"name" : "actuallyadditions:item_food:19"}, "weight" : 10}, {"data" : {"name" : "minecraft:mushroom_stew"}, "weight" : 1} ], "each" : true, "quantity" : 3 }, { "level" : [0, 1, 2, 3, 4], "type" : "POTIONS", "loot" : [ {"data" : {"type" : "potion", "name" : "strength"}, "weight" : 2}, {"data" : {"type" : "potion", "name" : "regeneration"}, "weight" : 2}, {"data" : {"type" : "potion", "name" : "leaping"}, "weight" : 2}, {"data" : {"type" : "potion", "name" : "night_vision"}, "weight" : 1}, {"data" : {"type" : "potion", "name" : "fire_resistance"}, "weight" : 1}, {"data" : {"type" : "potion", "name" : "swiftness"}, "weight" : 1}, {"data" : {"type" : "potion", "name" : "harming"}, "weight" : 8}, {"data" : {"type" : "potion", "name" : "starvation"}, "weight" : 10}, {"data" : {"type" : "potion", "name" : "extension"}, "weight" : 6}, {"data" : {"type" : "potion", "name" : "mending"}, "weight" : 8}

        ],
        "each" : true,
        "quantity" : 4
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "MUSIC",
        "loot" : [
            {"data" : {"name" : "minecraft:record_cat"}, "weight" : 1},
            {"data" : {"name" : "jurassicraft:disc_jurassicraft_theme"}, "weight" : 8},
            {"data" : {"name" : "minecraft:record_strad"}, "weight" : 10},
            {"data" : {"name" : "thebetweenlands:mysterious_record"}, "weight" : 10},
            {"data" : {"name" : "minecraft:record_ward"}, "weight" : 8},
            {"data" : {"name" : "botania:recordgaia1"}, "weight" : 8},
            {"data" : {"name" : "biomesoplenty:record_wanderer"}, "weight" : 10}
        ],
        "each" : true,
        "quantity" : 1
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "SUPPLIES",
        "loot" : [
            {"data" : {"name" : "minecraft:wheat_seeds"}, "weight" : 1},
            {"data" : {"name" : "minecraft:wooden_hoe"}, "weight" : 1},
            {"data" : {"name" : "minecraft:pumpkin_seeds"}, "weight" : 1},
            {"data" : {"name" : "minecraft:melon_seeds"}, "weight" : 1},
            {"data" : {"name" : "minecraft:lead"}, "weight" : 1},
            {"data" : {"name" : "minecraft:wheat"}, "weight" : 1},
            {"data" : {"name" : "minecraft:beetroot_seeds"}, "weight" : 1},
            {"data" : {"name" : "minecraft:sapling"}, "weight" : 1},
            {"data" : {"name" : "immersiveengineering:seed:0", "min" : 5, "max" : 20}, "weight" : 6},
            {"data" : {"name" : "botania:grassseeds:0", "min" : 5, "max" : 20}, "weight" : 6},
            {"data" : {"name" : "actuallyadditions:item_canola_seeds", "min" : 5, "max" : 20}, "weight" : 8},
            {"data" : {"name" : "actuallyadditions:item_coffee_seeds", "min" : 5, "max" : 20}, "weight" : 8},
            {"data" : {"name" : "minecraft:torch", "min" : 5, "max" : 20}, "weight" : 3}
        ],
        "each" : true,
        "quantity" : 2
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "SMITH",
        "loot" : [
            {"data" : {"type" : "specialty", "equipment": "sword", "quality" : "iron", "level" : 1}, "weight" : 1},
            {"data" : {"type" : "specialty", "equipment": "axe", "quality" : "stone", "level" : 2}, "weight" : 1},
            {"data" : {"type" : "specialty", "equipment": "shovel", "quality" : "wooden", "level" : 1}, "weight" : 1},
            {"data" : {"type" : "specialty", "equipment": "hoe", "quality" : "iron", "level" : 1}, "weight" : 1},
            {"data" : {"type" : "specialty", "equipment": "pickaxe", "quality" : "golden", "level" : 1}, "weight" : 1}
        ],
        "each" : true,
        "quantity" : 1
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "STARTER",
        "loot" : [
            {"data" : {"type" : "mixture", "name" : "coffee"}, "weight" : 1}
        ],
        "each" : true,
        "quantity" : 1
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "STARTER",
        "loot" : [
            {"data" : {"type" : "specialty", "equipment" : "legs", "quality" : "wood", "level" : 1}, "weight" : 1},
            {"data" : {"type" : "specialty", "equipment" : "chestplate", "quality" : "stone", "level" : 1}, "weight" : 1},
            {"data" : {"type" : "specialty", "equipment" : "helmet", "quality" : "iron", "level" : 1}, "weight" : 1},
            {"data" : {"type" : "specialty", "equipment" : "boots", "quality" : "wood", "level" : 1}, "weight" : 1}
        ],
        "each" : true,
        "quantity" : 2
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "STARTER",
        "loot" : [
            {"data" : {"type" : "tool", "level" : 1}, "weight" : 1}
        ],
        "each" : true,
        "quantity" : 2
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "STARTER",
        "loot" : [
            {"data" : {"type" : "weapon", "level" : 1}, "weight" : 1}
        ],
        "each" : true,
        "quantity" : 2
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "STARTER",
        "loot" : [
            {"data" : {"name" : "minecraft:stick", "nbt" : "{display:{Name:\"Twig\",Lore:[\"A little twiggy\"]}}"}, "weight" : 1}
            {"data" : {"name" : "minecraft:cobblestone", "nbt" : "{display:{Name:\"Rock\",Lore:[\"Rock on!\"]}}"}, "weight" : 1}
        ],
        "each" : true,
        "quantity" : 1
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "BLOCKS",
        "loot" : [
            {"data" : {"name" : "minecraft:cobblestone", "min" : 20, "max" : 40}, "weight" : 1},
            {"data" : {"name" : "minecraft:stone", "min" : 20, "max" : 40}, "weight" : 1},
            {"data" : {"name" : "minecraft:dirt:0", "min" : 20, "max" : 40}, "weight" : 1},
            {"data" : {"name" : "minecraft:glass", "min" : 20, "max" : 40}, "weight" : 1}
        ],
        "each" : true,
        "quantity" : 1
    },      
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "BREWING",
        "loot" : [
            {"data" : {"name" : "minecraft:blaze_powder"}, "weight" : 1},
            {"data" : {"name" : "minecraft:fermented_spider_eye"}, "weight" : 1},
            {"data" : {"name" : "minecraft:spider_eye"}, "weight" : 1},
            {"data" : {"name" : "minecraft:magma_cream"}, "weight" : 1},
            {"data" : {"name" : "minecraft:speckled_melon"}, "weight" : 1},
            {"data" : {"name" : "botania:avatar"}, "weight" : 10},
            {"data" : {"name" : "botania:teruterubozu"}, "weight" : 6},
            {"data" : {"name" : "darkutils:material:0"}, "weight" : 8},
            {"data" : {"name" : "minecraft:ghast_tear"}, "weight" : 1}
        ],
        "each" : true,
        "quantity" : 8
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "BREWING",
        "loot" : [
            {"data" : {"name" : "minecraft:glass_bottle", "min" : 2, "max" : 7}, "weight" : 1}
        ],
        "each" : true,
        "quantity" : 2
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "ENCHANTING",
        "loot" : [
            {"data" : {"name" : "minecraft:experience_bottle", "min" : 5, "max" : 15}, "weight" : 2},
            {"data" : {"name" : "minecraft:book", "min" : 1, "max" : 3}, "weight" : 1},
            {"data" : {"name" : "ebwizardry:spell_book", "min" : 1, "max" : 2}, "weight" : 10}
        ],
        "each" : true,
        "quantity" : 1
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "WEAPONS",
        "loot" : [
            {"data" : {"type" : "potion", "name" : "strong_strength"}, "weight" : 1}
        ],
        "each" : true,
        "quantity" : 1
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "type" : "ARMOUR",
        "loot" : [
            {"data" : {"type" : "potion", "name" : "long_regeneration"}, "weight" : 1}
        ],
        "each" : true,
        "quantity" : 1
    },
    {
        "level" : [0, 1, 2, 3, 4],
        "loot" : [
            {"data" : {"name" : "minecraft:stick"}, "weight" : 2},
            {"data" : {"name" : "minecraft:slime_ball"}, "weight" : 1},
            {"data" : {"name" : "minecraft:clay_ball"}, "weight" : 1},
            {"data" : {"name" : "minecraft:bone"}, "weight" : 1},
            {"data" : {"name" : "minecraft:string"}, "weight" : 1},
            {"data" : {"name" : "minecraft:snowball"}, "weight" : 1},
            {"data" : {"name" : "minecraft:feather"}, "weight" : 1},
            {"data" : {"name" : "megaloot:upgradecharm_common"}, "weight" : 10},
            {"data" : {"name" : "megaloot:upgradecharm_rare"}, "weight" : 8},
            {"data" : {"name" : "megaloot:upgradecharm_epic"}, "weight" : 6},
            {"data" : {"name" : "megaloot:weaponcase_common"}, "weight" : 10},
            {"data" : {"name" : "megaloot:weaponcase_epic"}, "weight" : 8},
            {"data" : {"name" : "megaloot:weaponcase_rare"}, "weight" : 6},
            {"data" : {"name" : "megaloot:shard_common", "min" : 1, "max" : 4}, "weight" : 10},
            {"data" : {"name" : "megaloot:shard_rare", "min" : 1, "max" : 2}, "weight" : 8},
            {"data" : {"name" : "megaloot:shard_epic", "min" : 1, "max" : 2}, "weight" : 6},
            {"data" : {"name" : "minecraft:torch", "min" : 1, "max" : 6}, "weight" : 3}
        ],
        "each" : true,
        "quantity" : 4
    }
]

}

Alan19 commented 5 years ago

One issue I see is that the item metadata shouldn't be specified in the item name, but instead should me specified in the "meta" field. For example, {"data" : {"name" : "immersiveengineering:seed:0", "min" : 5, "max" : 20}, "weight" : 6} should be {"data" : {"name" : "immersiveengineering:seed", "meta":0, "min" : 5, "max" : 20}, "weight" : 6}. However, you don't need to have the item metadata when it is 0.

Also, I think loot tables will override the loot specified in the Roguelike Dungeon jsons so you don't want to have both.

chaslinger-tgm commented 5 years ago

@Alan19 as it seems you are quite familiar with the structure of the setting .json files. I am writing here because I will probably don't get an answer of the creator. I am struggling with the "nbt": tag in my loot files. I have already tried several constellations, but still nothing. No error, but it only spawns the basic item without the tag. Please you are my last hope, nobody else answered my posts on Reddit and other platforms.

Code:


`      {
            "level" : 0,
            "loot" : [
                {"data" : {"name" : "lucraftcore:instruction"}, "weight" : 5},
                {"data" : {"name" : "lucraftcore:injection"}, "nbt":{"type":"String", "value":"mightiestheroes:shazam"}, "weight" : 100},
                {"data" : {"name" : "ironman:suit_spawner"}, "weight" : 5},
                {"data" : {"name" : "speedsterheroes:ring"}, "weight" : 5}
            ],
            "each" : true,
            quantity" : 1
    }```
Alan19 commented 5 years ago

If you have CraftTweaker, you can use /ct hand to get the nbt data of an item. Then you can copy and paste the NBT data from the output. However, since the NBT has a string value while the NBT output has strings as well, you need to escape the double quotes by adding a \ before the " so the strings in the NBT does not close the string prematurely.

Here's an example where I add a Tinkers' shuriken to a Roguelike:

"name":"tconstruct:shuriken",
"nbt":"{StatsOriginal: {AttackSpeedMultiplier: 1.0, Accuracy: 1.0, MiningSpeed: 6.755, FreeModifiers: 3, Durability: 934, HarvestLevel: 4, Attack: 5.855}, display: {Name: \"Pretty Scary Shuriken\"}, Stats: {AttackSpeedMultiplier: 1.1, Accuracy: 1.0, MiningSpeed: 6.755, FreeModifiers: 0, Durability: 934, HarvestLevel: 4, Attack: 5.855}, Special: {Categories: [\"tool\", \"no_melee\", \"projectile\"]}, TinkerData: {UsedModifiers: 3, Materials: [\"cobalt\", \"ardite\", \"netherrack\", \"manyullyn\"], Modifiers: [\"necrotic\", \"soulbound\", \"beheading\", \"smite\"]}, Modifiers: [{identifier: \"momentum\", color: -14122284, level: 1}, {identifier: \"lightweight\", color: -14122284, level: 1}, {identifier: \"stonebound\", color: -3063280, level: 1}, {identifier: \"petramor\", color: -3063280, level: 1}, {identifier: \"aridiculous\", color: -4698289, level: 1}, {identifier: \"hellish\", color: -4698289, level: 1}, {identifier: \"insatiable\", color: -6202120, level: 1}, {identifier: \"coldblooded\", color: -6202120, level: 1}, {identifier: \"necrotic\", color: 6160384, level: 1}, {identifier: \"soulbound\", color: 16120748}, {identifier: \"beheading\", color: 1070923, level: 1}, {identifier: \"smite\", current: 24, color: 15258880, level: 1, max: 24, extraInfo: \"23 / 24\"}], Traits: [\"momentum\", \"lightweight\", \"stonebound\", \"petramor\", \"aridiculous\", \"hellish\", \"insatiable\", \"coldblooded\", \"necrotic\", \"smite\"]}"
chaslinger-tgm commented 5 years ago

I love pal! You just solved a problem that took me way too long. I cannot thank you enough. I am so happy. Have a nice day and a perfect career as software engineer. You are a legend!