Class RegisterStructureConversionsEvent
StructuresBecomeConfiguredFix
for converting old structure IDs in pre-1.18.2 worlds to their new equivalents, which can be differentiated per biome.
By default, structures whose old ID has a namespace which is not equal to "minecraft" will be assumed to belong to a modded structure and will be used as the new ID. Mods may choose to register structure conversions for their structures, if they wish to override this default behavior.
This event will only fire if StructuresBecomeConfiguredFix
is used, as a result of converting a
pre-1.18.2 world to the current version.
This event is not cancelable, and does not have a result.
This event is fired on the main Forge event bus, only on the logical server.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Map
<String, StructuresBecomeConfiguredFix.Conversion> -
Method Summary
Modifier and TypeMethodDescriptionvoid
register
(String oldStructureID, StructuresBecomeConfiguredFix.Conversion conversion) Registers a conversion for a structure.Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
Field Details
-
map
-
-
Method Details
-
register
Registers a conversion for a structure.A structure conversion can be of two kinds:
- A trivial conversion, created using
StructuresBecomeConfiguredFix.Conversion.trivial(String)
, contains only the new structure ID and simply converts all mentions of the old structure ID to the new structure ID. - A biome-mapped conversion, created using
StructuresBecomeConfiguredFix.Conversion.biomeMapped(Map, String)
, contains a fallback structure ID, and a biome-specific conversion map. Each entry in the map is composed of a list of biome IDs and the new structure ID.If a structure is in a biome which exists in the map, the structure ID in the corresponding entry is used as the new structure ID. If there is no such biome found, the new structure ID will be the fallback structure ID.
For example, the following registers a biome-mapped conversion for
exampleStructure
with the following logic:- If the structure is within either a
minecraft:desert
or aminecraft:jungle
biome, it is mapped toexamplemod:deserted_structure
. - If the structure is within a
minecraft:ocean
biome, it is mapped toexamplemod:flooded_structure
. - Otherwise, the structure is mapped to
examplemod:structure
.
event.register("exampleStructure", StructuresBecomeConfiguredFix.Conversion.biomeMapped(Map.of( List.of("minecraft:desert", "minecraft:jungle"), "examplemod:deserted_structure", List.of("minecraft:ocean"), "examplemod:flooded_structure" ), "examplemod:structure"));
- If the structure is within either a
- Parameters:
oldStructureID
- the old structure ID, in all lowercaseconversion
- the conversion data- Throws:
NullPointerException
- if the old structure ID, the conversion data, or the fallback structure ID in the conversion data is nullIllegalArgumentException
- if the old structure ID is not in full lowercase, or if a conversion for that structure ID has already been registered previously
- A trivial conversion, created using
-