Interface StructureModifier
- All Known Implementing Classes:
NoneStructureModifier
,StructureModifiers.AddSpawnsStructureModifier
,StructureModifiers.ClearSpawnsStructureModifier
,StructureModifiers.RemoveSpawnsStructureModifier
,StructureModifierTest.TestModifier
public interface StructureModifier
JSON-serializable structure modifier.
Requires a
Codec
to deserialize structure modifiers from structure modifier jsons.
Structure modifier jsons have the following json format:
{ "type": "yourmod:yourserializer", // Indicates a registered structure modifier serializer // Additional fields can be specified here according to the codec }
Datapacks can also disable a structure modifier by overriding the json and using "type": "neoforge:none"
.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec
<StructureModifier> Codec for (de)serializing structure modifiers inline.static final com.mojang.serialization.Codec
<HolderSet<StructureModifier>> Codec for referring to structure modifiers by id, list of id, or tags.static final com.mojang.serialization.Codec
<Holder<StructureModifier>> Codec for referring to structure modifiers by id in other datapack registry files. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec
<? extends StructureModifier> codec()
void
modify
(Holder<Structure> structure, StructureModifier.Phase phase, ModifiableStructureInfo.StructureInfo.Builder builder) Modifies the information via the provided structure builder.
-
Field Details
-
DIRECT_CODEC
Codec for (de)serializing structure modifiers inline. Mods can use this for data generation. -
REFERENCE_CODEC
Codec for referring to structure modifiers by id in other datapack registry files. Can only be used withRegistryOps
. -
LIST_CODEC
Codec for referring to structure modifiers by id, list of id, or tags. Can only be used withRegistryOps
.
-
-
Method Details
-
modify
void modify(Holder<Structure> structure, StructureModifier.Phase phase, ModifiableStructureInfo.StructureInfo.Builder builder) Modifies the information via the provided structure builder. Allows mob spawns and world-gen features to be added or removed, and climate and client effects to be modified.- Parameters:
structure
- the named structure being modified (with original data readable).phase
- structure modification phase. Structure modifiers apply in each phase in order of the enum constants.builder
- mutable structure info builder. Apply changes to this.
-
codec
com.mojang.serialization.MapCodec<? extends StructureModifier> codec()- Returns:
- the codec which serializes and deserializes this structure modifier
-