Cant get into how you do ore control. Help? #28
-
|
Hello! I'm trying to create my own ore control plugin. I've analyzed your source a lot, but I can't get into it to understand the base algorithm. Can I get help from you? This is like explaining the basics of the ore control you use. I will be very grateful! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Minecraft has for every ore it generates one or more different PlacedFeature's which holds the information what ore should be generated and where and how often it should generate. The where part is thereby calculated with multiple PlacementModifier's (PlacedFeature contains a list of those), during generation minecraft picks a block from the chunk it generates and passes it through every PlacementModifier present in the PlacedFeature. At the end it has a list of positions in the chunk where it generates the ore. Example list of some PlacementModifier's:
For the actual ore vein generation the PlacedFeature contains a ConfiguredFeature, which itself contains a Feature and a FeatureConfiguration. The Feature is thereby OreFeature with OreConfiguration as FeatureConfiguration. The OreConfiguration contains options to set the size of the vein, as well as the discard chance on air exposure (see here for more infos). It also contains a list of TargetBlockState which control which block should be replaced with which ore. For example, generated normal ore when replacing stone, but use the deepslate variant of the ore when replacing deepslate. To actually change the generation you now first create your own PlacedFeature with the parameters you want. Now you need to add your custom PlacedFeature to the biomes generation setting (which you can find the code of here) and also remove the ore you don't want to to have generated in the biome. For this you need to create a new List of HolderSet and set it to BiomeGenerationSettings#features and BiomeGenerationSettings#featureSet, but don't forget to also add the none ores features of the original BiomeGenerationSettings#features list and also make sure to preserver the current order of it. With that you have modified the ore generation. Note however, that this method is very hacky and can mess up the server (although I didn't have any problems with it so far). |
Beta Was this translation helpful? Give feedback.
Minecraft has for every ore it generates one or more different PlacedFeature's which holds the information what ore should be generated and where and how often it should generate.
The where part is thereby calculated with multiple PlacementModifier's (PlacedFeature contains a list of those), during generation minecraft picks a block from the chunk it generates and passes it through every PlacementModifier present in the PlacedFeature. At the end it has a list of positions in the chunk where it generates the ore.
Example list of some PlacementModifier's: