Forgero - [Fabric]

Forgero - [Fabric]

85k Downloads

Is there mod compatibility?

TheButterbrotMan opened this issue ยท 15 comments

commented

Is there mod compatibility? Like will it automatic add eg. axe heads for other mods? Or only vanilla stuff is covered?

commented

If any mods doesn't have compatibility/forgero doesn't add them. Where should I report this issue here or at the modauthors page?

commented

A lot of mods: https://www.curseforge.com/minecraft/modpacks/deathdusk

Just throw Forgero in.

commented

KubeJS have this:

// In all recipes, replace Stick with Oak Sapling in output items
event.replaceOutput({}, 'minecraft:stick', 'minecraft:oak_sapling')

Maybe its possible to integrate this somehow automatically.

commented

If a recipe uses a tag for tools, like "tag":"c:stone_pickaxe", then I can integrate my tools with the tag, but if a recipe specifies the item, then I can't really do anything. Forgero tools use the identifier forgero:stone_pickaxe, and the vanilla uses minecraft:stone_pickaxe. It is possible to override all recipes to use tags, but that would be quite some work

commented

Which mods did you use in your examples? I'll have a look at them and see what I can do. Removing recipe dupes would be really nice.

commented

That looks promising, I'll have a look at it soon!

commented

It seems like the event.replaceInput() method from KubeJs has some issues. When using this method, it will replace all recipes that use the targeted identifier, even recipes that includes it as a tag. This invalidates all recipes that uses a tag which includes the desired item. I have been experimenting with this script, and numerous variations:

priority: 0

settings.logAddedRecipes = true
settings.logRemovedRecipes = true
settings.logSkippedRecipes = true
settings.logErroringRecipes = true

onEvent('recipes', event => {

    let vanillaMaterials = ['wooden', 'stone', 'iron', 'golden', 'diamond', 'netherite'];
    let vanillaTools = ['pickaxe', 'shovel', 'hoe', 'sword', 'axe'];

    for (let i = 0; i < vanillaMaterials.length; i++) {
        for (let j = 0; j < vanillaTools.length; j++) {
            event.replaceInput({type: 'minecraft:crafting_shapeless'}, 'minecraft:'.concat(vanillaMaterials[i], '_', vanillaTools[j])), '#c:'.concat(vanillaMaterials[i], '_', vanillaTools[j])
             event.replaceInput({type: 'minecraft:crafting_shaped'}, 'minecraft:'.concat(vanillaMaterials[i], '_', vanillaTools[j])), '#c:'.concat(vanillaMaterials[i], '_', vanillaTools[j])

        }
    }
})

You could also add true to the exact parameter, but then I can't get it to apply to any recipes. For some reason, it does not want to recognise recipes that uses e.g. minecraft:wooden_pickaxe. And this messes up my recipes because it overrides all recipes which uses a tag including the targeted identifier. It seems like it only works when the targeted item is included in another tag, which messes up all recipes using this tag. I couldn't get it to apply to recipes which only uses the items identifier (minecraft:stone_pickaxe -> #c:stone_pickaxe) only this works: (#fabric:pickaxes -> #c:stone_pickaxe). This really just seems like a bug to me.

I have added the #c:stone_pickaxe, #c:stone_sword, etc.. tags, and configured all the vanilla tools and forgero's to be included in these. This way, you can use #c:material_tool in recipes to target all tools, there's probably nobody using these tags, but at least they are available. I'll probably revisit this later for a fix, but I have spent far to much time debugging this now.

commented

Ok, i did some quick testing. Forgero is creating a new tool, but keeps the old ones also in REI. So i have now 2 stone pickaxes, 2 iron.

Is there anyway to fix this quickly? Without needing me to hide them all haha

commented

Example of my problem:
Vanilla:
image

Forgero:
image

It removes recipe of the tool, creates a new tool but dont convert recipes to new tool.

commented

Yes. All resources, materials, gems and schematics can be added by other mods in data packs. If a mod adds a new material, Forgero will automatically add all tool parts for this material.

I have only tested adding materials from other mods, with support for most materials added by Mythic Metals as a test, but I haven't added unique properties for them yet. In theory all resources from mods that are tagged properly should be picked up and generated by Forgero, the mod includes a datapack that covers the vanilla stuff by default.

I am also working on support for being able to create unique tools and tool parts using datapacks and the, but that is wip.

commented

Forgero's base tools looks almost identical to vanilla, but the functionality is completely different from vanilla tools. The tools are used as a container, which changes when nbt's change.

I could create a new tag for stone tools, like stone pickaxes, stone shovels etc, and use it for schematic recipes. That would remove the duplicated recipes.

I probably won't remove/override the vanilla tools, as that would probably break a lot of other mods/functionality. I might remove forgero's tools from the creative menu, if that does not cause inconvenience for me when developing.

There might be options for configuring Forgero for REI, but I haven't tested it.

commented

So is it possible for you to copy Uses (recipe) of a tool, to the new Forgero tool?

REI has an Option to Hide Things, i dont know if it has a API. But i can remove them also myself in KubeJS. My biggest problem at the moment is, that recipe use problem.

commented

Edit: Nvm, it still only changes recipes that use the targeted item inside tags.

Actually, this script seems to be working quite well:

priority: 1

settings.logAddedRecipes = true
settings.logRemovedRecipes = true
settings.logSkippedRecipes = false
settings.logErroringRecipes = true

onEvent('recipes', event => {

    let vanillaMaterials = ['wooden', 'stone', 'iron', 'golden', 'diamond', 'netherite'];
    let vanillaTools = ['pickaxe', 'shovel', 'hoe', 'sword', 'axe'];
    
    for (let i = 0; i < vanillaMaterials.length; i++) {
        for (let j = 0; j < vanillaTools.length; j++) {
            event.replaceInput({
                input: "minecraft:".concat(vanillaMaterials[i], '_', vanillaTools[j]),
                not: {output: "#forgero:head_schematics"}
            }, "minecraft:".concat(vanillaMaterials[i], '_', vanillaTools[j]), '#c:'.concat(vanillaMaterials[i], '_', vanillaTools[j]))
        }
    }
})

Could you perhaps test this script to see if it overrides your recipes?

commented

Most mod authors probably don't care that much about compatibility. You can suggest they create a recipe which uses the common tag, but they would have to make sure that they add the tag as well.

The best scenario would be to get the KubeJs script to work, and the second best would probably be a KubeJs script that replaces entire specific recipes with one that uses common tags. I wouldn't mind bundling this script along with Forgero in this repo, but I can't keep track of all of the recipes that needs changing. If you provide the recipes that needs to be overridden, I can probably create some scripts for converting them to common variants.

commented

Closing in favor of #211