-
Notifications
You must be signed in to change notification settings - Fork 115
Tree Packs
Tree packs are a new feature of Dynamic Trees for 1.16, allowing mod pack developers and the average user to add their own custom content like trees and species with just a set of Json files, as well as allowing add-on developers to add their content in the same way.
Tree packs work much like Vanilla's resource and data packs, but are both loaded on the initial game launch and reloaded when data packs are (on world load and when the /reload command is used). Below is the basis of the file structure:
trees/
namespace/
leaves_properties/
families/
species/
jo_codes/
world_gen/
A trees folder can be found in the Minecraft directory (subject to change), which is where the user/mod pack developer can create their custom entries. The namespace will be used for any entries (such as species) registered in sub-folders. This works exactly like it does in vanilla - for example, a Minecraft grass block has the registry name minecraft:grass_block - the minecraft part is the namespace. Therefore in dynamic trees an oak species will have the registry name dynamictrees:oak. Note that for mods this is also referred to as the mod ID.
DT will generate any blocks and items needed automatically and according to the configurations set. For example, a family will generate a branch block by default with registry name namespace:family_branch. When this happens, it will use need a registry handler. Only DT itself and add-on mods will have registry handlers, so if a namespace is used that doesn't have a registry handler - like minecraft - it will autocorrect the block and item registry names to dynamictrees by default. For this reason, it is recommended that tree packs exclusively use either dynamictrees as the namespace or the mod ID of an add-on that is known to be loaded/required. This is so that the species, family, and leaves properties registry names match the registry names of their equivalent blocks and items.
So, in short, you should generally only use dynamictrees as the namespace, or one of the add-on mod IDs if the tree pack is related to a specific add-on.
For guides on how to add leaves properties, families, etc, refer to the relevant guide on the side-bar.
When creating an add-on, tree packs are loaded automatically from the trees directory inside the resources directory. In order to be able to use your mod ID for us to register blocks and items, you will need to add the following code to your mod constructor, in which modid is your mod's ID, to setup a new RegistryHandler:
RegistryHandler.setup("modid");After this point you can use your mod ID as the namespace for the trees folder. Everything works like it does in a tree pack, using the same file structure as detailed above.