Line 14: |
Line 14: |
| Forge provides several [[#Builtin_Biome_Modifier_Types|builtin biome modifier types]], so some basic use cases such as adding features or mob spawns to biomes can be done without registering additional serializers. | | Forge provides several [[#Builtin_Biome_Modifier_Types|builtin biome modifier types]], so some basic use cases such as adding features or mob spawns to biomes can be done without registering additional serializers. |
| | | |
− | = Biome Modifier Types = | + | =Biome Modifier Types= |
− | | |
| To define a new type of biome modifier, begin by implementing a new class that extends <code>BiomeModifier</code>. BiomeModifiers can usually be implemented as records, to reduce boilerplate. | | To define a new type of biome modifier, begin by implementing a new class that extends <code>BiomeModifier</code>. BiomeModifiers can usually be implemented as records, to reduce boilerplate. |
| | | |
Line 45: |
Line 44: |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | Typically we also want to restrict biome modifiers to only apply to certain biomes. We can do that by accepting a HolderSet<Biome> in our constructor: | + | Typically we also want to restrict biome modifiers to only apply to certain biomes. We can do that by accepting a HolderSet<biome> in our constructor: |
| | | |
| <syntaxhighlight lang="java"> | | <syntaxhighlight lang="java"> |
Line 59: |
Line 58: |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | We can also accept Holders or HolderSets for other [[Registration#Data_Driven_Entries|datapack registry elements]], such as PlacedFeatures, which allows our BiomeModifier to refer to those elements, which can then be defined in their own JSON files. | + | We can also accept [[Holders]] or [[HolderSets]] for other [[Registration#Data_Driven_Entries|datapack registry elements]], such as PlacedFeatures, which allows our BiomeModifier to refer to those elements, which can then be defined in their own JSON files. |
| | | |
| <syntaxhighlight lang="java"> | | <syntaxhighlight lang="java"> |
Line 72: |
Line 71: |
| } | | } |
| } | | } |
− | </syntaxhighlight> | + | </syntaxhighlight></biome> |
| | | |
| = Biome Modifier Serializers = | | = Biome Modifier Serializers = |