Spelunkery

Spelunkery

80.4k Downloads

Allow Name-Named Items to Be Differentiated in Grindstone Loot Tables

CraftyZombie opened this issue ยท 4 comments

commented

Feature:

With the recipe system for grindstones, it was possible to have two different items with the same namespace, yet different IDs grind into different things. As the loot tables only recognize name, and not mod id, this is no longer possible. Could you consider finding some way to return this?

Example:
minecraft:emerald --> minecraft:grass_block
foo:emerald --> minecraft:diamond_block

commented

Yeah, this would be awesome.

commented

doable with sth. like this
(should be easier than putting the namespace in the loot table filename itself due to modis potentially containing underscores etc.)
actually the modids wouldn't cause any issues but this probably is easier to read (since it's more clear which item would come from which mod)

        ResourceLocation resource = Utils.getID(itemStack.getItem());
        String directory = resource.getNamespace();
        String file = resource.getPath();

        if (!level.isClientSide()) {
            //find loot table for held item
            String prefix = "gameplay/" + (diamondGrindstone && !depleted ? "diamond_" : "");
            var tablePath = Spelunkery.res(prefix + "grindstone_polishing/" + directory + "/" + file);

and move the existing loot tables in the corresponding directories (e.g. rough_lazurite.json would go into /spelunkery/rough_lazurite.json)

commented

do you have a specific usecase where you have two items from different mods that use the same name that you want to give distinct grinding recipes to?

commented

No specific use case at the moment, but it could be helpful for example, if two mods with similar features were trying to make an integration.