Record Class StructureModifiers.ClearSpawnsStructureModifier

java.lang.Object
java.lang.Record
net.neoforged.neoforge.common.world.StructureModifiers.ClearSpawnsStructureModifier
Record Components:
structures - Structures to remove mob spawn overrides from.
categories - Set of mob categories to remove spawn overrides for.
All Implemented Interfaces:
StructureModifier
Enclosing class:
StructureModifiers

public static record StructureModifiers.ClearSpawnsStructureModifier(HolderSet<Structure> structures, Set<MobCategory> categories) extends Record implements StructureModifier

Stock biome modifier that removes mob spawns from a structure modifier. Does not remove the override list itself; see StructureModifiers.ClearSpawnsStructureModifier to remove override lists completely.

Has the following json format:

 {
   "type": "neoforge:clear_spawns", // Required
   "structures": "#namespace:structure_tag", // Accepts a structure id, [list of structure ids], or #namespace:structure_tag
   "categories": "monster" OR ["monster", "creature"] // Optional, one or more MobCategory; defaults to all categories if not specified.
 }
 
  • Field Details

  • Constructor Details

    • ClearSpawnsStructureModifier

      public ClearSpawnsStructureModifier(HolderSet<Structure> structures, Set<MobCategory> categories)
      Creates an instance of a ClearSpawnsStructureModifier record class.
      Parameters:
      structures - the value for the structures record component
      categories - the value for the categories record component
  • Method Details

    • modify

      Description copied from interface: StructureModifier
      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.
      Specified by:
      modify in interface StructureModifier
      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

      public com.mojang.serialization.MapCodec<? extends StructureModifier> codec()
      Specified by:
      codec in interface StructureModifier
      Returns:
      the codec which serializes and deserializes this structure modifier
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • structures

      public HolderSet<Structure> structures()
      Returns the value of the structures record component.
      Returns:
      the value of the structures record component
    • categories

      public Set<MobCategory> categories()
      Returns the value of the categories record component.
      Returns:
      the value of the categories record component