Record Class StructureModifiers.RemoveSpawnsStructureModifier
java.lang.Object
java.lang.Record
net.neoforged.neoforge.common.world.StructureModifiers.RemoveSpawnsStructureModifier
- Record Components:
structures- Biomes to remove mob spawns from.entityTypes- EntityTypes to remove from spawn lists.
- All Implemented Interfaces:
StructureModifier
- Enclosing class:
StructureModifiers
public static record StructureModifiers.RemoveSpawnsStructureModifier(HolderSet<Structure> structures, HolderSet<EntityType<?>> entityTypes)
extends Record
implements StructureModifier
Stock structure modifier that removes mob spawns from a structure.
Does not remove the override list itself;
see StructureModifiers.ClearSpawnsStructureModifier to remove override lists completely.
{
"type": "neoforge:remove_spawns", // Required
"structures": "#namespace:structure_tag", // Accepts a structure id, [list of structure ids], or #namespace:structure_tag
"entity_types": #namespace:entitytype_tag // Accepts an entity type, [list of entity types], or #namespace:entitytype_tag
}
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.neoforged.neoforge.common.world.StructureModifier
StructureModifier.Phase -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HolderSet<EntityType<?>> The field for theentityTypesrecord component.The field for thestructuresrecord component.Fields inherited from interface net.neoforged.neoforge.common.world.StructureModifier
DIRECT_CODEC, LIST_CODEC, REFERENCE_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionRemoveSpawnsStructureModifier(HolderSet<Structure> structures, HolderSet<EntityType<?>> entityTypes) Creates an instance of aRemoveSpawnsStructureModifierrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<? extends StructureModifier> codec()HolderSet<EntityType<?>> Returns the value of theentityTypesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.voidmodify(Holder<Structure> structure, StructureModifier.Phase phase, ModifiableStructureInfo.StructureInfo.Builder builder) Modifies the information via the provided structure builder.Returns the value of thestructuresrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
structures
The field for thestructuresrecord component. -
entityTypes
The field for theentityTypesrecord component.
-
-
Constructor Details
-
RemoveSpawnsStructureModifier
public RemoveSpawnsStructureModifier(HolderSet<Structure> structures, HolderSet<EntityType<?>> entityTypes) Creates an instance of aRemoveSpawnsStructureModifierrecord class.- Parameters:
structures- the value for thestructuresrecord componententityTypes- the value for theentityTypesrecord component
-
-
Method Details
-
modify
public void modify(Holder<Structure> structure, StructureModifier.Phase phase, ModifiableStructureInfo.StructureInfo.Builder builder) Description copied from interface:StructureModifierModifies 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:
modifyin interfaceStructureModifier- 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
- Specified by:
codecin interfaceStructureModifier- Returns:
- the codec which serializes and deserializes this structure modifier
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
structures
Returns the value of thestructuresrecord component.- Returns:
- the value of the
structuresrecord component
-
entityTypes
Returns the value of theentityTypesrecord component.- Returns:
- the value of the
entityTypesrecord component
-