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".

  • Field Details

    • DIRECT_CODEC

      static final com.mojang.serialization.Codec<StructureModifier> DIRECT_CODEC
      Codec for (de)serializing structure modifiers inline. Mods can use this for data generation.
    • REFERENCE_CODEC

      static final com.mojang.serialization.Codec<Holder<StructureModifier>> REFERENCE_CODEC
      Codec for referring to structure modifiers by id in other datapack registry files. Can only be used with RegistryOps.
    • LIST_CODEC

      static final com.mojang.serialization.Codec<HolderSet<StructureModifier>> LIST_CODEC
      Codec for referring to structure modifiers by id, list of id, or tags. Can only be used with RegistryOps.
  • Method Details

    • modify

      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