Closed Apollounknowndev closed 5 months ago
This is timely, since I was going to stabilize the API as soon as I figure out the End issue I'm working on. Also, it's pretty much all stuff that's been on my to-do list for some time. From a very quick review, I think it can be merged as-is followed by a few minor code style changes. I need to:
64
values to make sure they're all applied to noise which cannot exceed themI don't think Criteria
was necessarily wrong. The problem is a Criterion can be a container of multiple criteria. When you talk about the object it probably makes more sense for it to be called Criterion, but when you are passing them around as arguments it usually makes more sense to call them criteria... I think this is actually why I created the Matcher as a container of criteria in the first place. Then somebody had to ask for sub-containers........ :laughing:
I want to get this released soon and I have time today, so I'll just merge and adjust. But please feel free to ping me with any comments.
Especially after the addition of the
any_of
andall_of
criterion, the sub-biome criteria system has been a bit of a mess. This PR aims to resolve this by moving criteria types into a registry-like system and simplifying the process of using sub-biomes in both code and json.Internal Changes
The
SubBiomeMatcher
,SubBiomeMatcherImpl
, andSubBiomeMatcherMarshaller
classes were removed. The primary classes in their place are:Criterion
: An interface for a criterion instance. It has three methods:getType
for returning aCriterionType
,getCodec
for returning the criterion's codec, andmatches
for returning whether or not the criterion is matched. Anything that previously took aSubBiomeMatcher
now takes aCriterion
. Each criterion type now exists in its own class with its own codec in impl.CriterionType
: An interface for a criterion type. Used to make criterion type-specific codecs work and not need one codec to have every field for every criterion type. It has two methods:getCodec
for returning the criterion type's codec, andgetId
for returning the criterion type's identifier. Criterion types can be created usingCriterionType.createType(codec, id)
.CriterionTypes
: A class holding the map of identifiers to criteria types. Criterion types are registered here withCriterionTypes.add
. TheBiolithCriteria
class in impl registers all built-in criterion typesCriterionBuilder
: A helper class with several constructed criteria (BEACHSIDE
,RIVERSIDE
) and all the methods needed to build criteria in code.External Changes
Mods
Any references to the
SubBiomeMatcher
class itself should be changed toCriterionBuilder
. Any references to the class in method references should be changed toCriterion
. Examples of changes:SubBiomeMatcher.BEACHSIDE
->CriterionBuilder.BEACHSIDE
SubBiomeMatcher.of(Criterion...)
->CriterionBuilder.allOf(Criteria...)
BiomePlacement.addSubOverworld(RegistryKey, RegistryKey, SubBiomeMatcher)
->BiomePlacement.addSubOverworld(RegistryKey, RegistryKey, Criterion)
On top of this, theinverted
field in criterion has been removed. Invert criteria usingCritereonBuilder.not
.Datapacks
criteria
array is no longer wrapped in amatcher
object.criteria
field can be a single criteria object instead of an array.type
fields need to have their ids prepended withbiolith:
(e.g.value
->biolith:value
)Todo