Last active
September 30, 2018 13:45
-
-
Save LexManos/2a11d4f7aa9d680d861dae4faf9dcfa6 to your computer and use it in GitHub Desktop.
1.12 Recipe enhancements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Basic loading. | |
To be done on ServerInit. This means things will load multiple times on the client. | |
Benifits: | |
Allows us to just nuke the custom recipes every server init | |
Allows us to have save leve overrides. | |
Primes us for syncing recipe types/contents S->C {Not gunna happen in 1.12, but I expect Mojang to work twards this in 1.13+} | |
Cons: | |
Increases single player server load time. No known stats at the moment but shouldn't be TO bad | |
Loading Process: | |
BootStrap: Vanilla loads their internal recipes, we'll freeze this registry and revert to it at the beginning of ServerInit | |
Gather Factories: | |
Gather a list of IRecipe, and Ingredient factories. | |
Loop through all mod jars/directories and load /assets/MODID/recipes/_factories.json | |
Names will automatically be prefixed with modid domains. Error if name contains : to dissallow overriding other's factories | |
Gather Constants: | |
Done as a second pass to allow modders to depend on other mods ingredient factories | |
Loop through all mods, loading /assets/MODID/recipes/_constants.json | |
Add to a central dictionary as modid:name, so mods can't overlap eachother. Again, error if people try to overwrite other's | |
Load jsons from Mod Jars: | |
Loop through all mods, loading /assets/MODID/recipes/[!_factories && !_constants].json | |
Register to central regirsty as modid:jsonFileName like vanilla does | |
Fire RegistryEvent.Register<IRecipe>: | |
Fire code event to allow people to create recipes in code? | |
Loading from modpack/config folder? | |
Check Forge config for a 'recipes_folder', or explicitly check GameDir/custom_recipes and load all recipes there. | |
Loads from all asset domains, automatically skipping the ones that do not match a loaded modid. | |
This should behave the same as loading from a single jar file. | |
Should we add a global FACTORIES/CONSTANTS json? | |
Loading from world folder? | |
Same as loading from modpacks folder but happens afterwords so that worlds override both modpacks and jars. | |
Conditions: | |
Simple conditions to determine if we should load the recipe, or set the constant. | |
All entries must return true. | |
Allow custom condition types defined in FACTORIES? | |
Types to add: | |
mod_loaded: modid | |
item_exists: itemname | |
not: [conditions] -- Inverts a condition, can be nested | |
or: condition1, condition2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"conditions": [ | |
{ | |
"type": "mod_loaded", | |
"mod": "minecraft" | |
} | |
], | |
"name" : "PLANKS", | |
"ingredient" : { | |
"type" : "ore_dict", | |
"ore" : "planks" | |
} | |
}, | |
{ | |
"conditions": [ | |
{ | |
"type": "mod_loaded", | |
"mod": "xycraft" | |
} | |
], | |
"name": "PLANKS", | |
"ingredient" : { | |
"item" : "xycraft:planks" | |
} | |
}, | |
{ | |
"name": "OAK_OR_SPRUCE", | |
"ingredient": [ | |
{ | |
"item": "minecraft:log", | |
"data" : 0 | |
}, | |
{ | |
"item": "minecraft:log", | |
"data" : 2 | |
} | |
], | |
}, | |
{ | |
"name": "MIXED", | |
"ingredient": [ | |
{ | |
"type": "ore_dict", | |
"ore": "stick" | |
}, | |
{ | |
"item": "minecraft:torch" | |
} | |
] | |
}, | |
{ | |
"name": "PigEgg", | |
"ingredient": { | |
"type": "itemstack_nbt", | |
"item": "minecraft:mobegg", | |
"nbt": { | |
"entityId": "pig" | |
} | |
} | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ingredients" : { | |
"ore_dict": "net.minecraftforge.oredict.OreIngredientFactory", | |
"itemstack_nbt": "net.minecraftforge.util.NBTIngredientFactory", | |
}, | |
"recipes" : { | |
"shapeless_ore" : "net.minecraftforge.oredict.ShapelessOreRecipeFactory", | |
"shaped_ore" : "net.minecraftforge.oredict.ShapedOreRecipeFactory" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"conditions": [ | |
{ | |
"type": "mod_loaded", | |
"mod": "minecraft" | |
} | |
], | |
"type": "minecraft:crafting_shaped", | |
"group": "random_things", | |
"pattern": [ | |
"###", | |
"XXX" | |
], | |
"key": { | |
"#": { | |
"item": "#PLANKS" | |
}, | |
"X": [ | |
{ | |
"item": "#PLANKS" | |
}, | |
{ | |
"item": "#MIXED", | |
}, | |
{ | |
"item": "minecraft:planks", | |
"data": 2 | |
} | |
] | |
}, | |
"result": { | |
"item": "minecraft:bed", | |
"data": 15 | |
} | |
} |
alright, RegistryEvent you are my friend
Thanks for leaving RegistryEvent option :P
Don't expect it as of 1.13, Its only in because I know people will bitch if its removed directly.
This is a first round of the json format. Its not perfect but its functional for 99% of use cases.
i might be a bit late, but is there a way to set the amount of results? (e.g pumpkin -> pumpkin seeds)
Is there any update on the correct procedure for removing a vanilla recipe in 1.12?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I actually made a different recipes format as well; perhaps you could look into it, it may be of use to you too.
https://github.com/FVbico/MinecraftData/tree/master/minecraft/assets/server/recipes