Record Class StructureModifierTest.TestModifier
java.lang.Object
java.lang.Record
net.neoforged.neoforge.oldtest.world.StructureModifierTest.TestModifier
- All Implemented Interfaces:
StructureModifier
- Enclosing class:
StructureModifierTest
public static record StructureModifierTest.TestModifier(HolderSet<Structure> structures, MobCategory category, MobSpawnSettings.SpawnerData spawn)
extends Record
implements StructureModifier
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.neoforged.neoforge.common.world.StructureModifier
StructureModifier.Phase -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MobCategoryThe field for thecategoryrecord component.private static final DeferredHolder<com.mojang.serialization.MapCodec<? extends StructureModifier>, com.mojang.serialization.MapCodec<? extends StructureModifier>> private final MobSpawnSettings.SpawnerDataThe field for thespawnrecord component.The field for thestructuresrecord component.Fields inherited from interface net.neoforged.neoforge.common.world.StructureModifier
DIRECT_CODEC, LIST_CODEC, REFERENCE_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionTestModifier(HolderSet<Structure> structures, MobCategory category, MobSpawnSettings.SpawnerData spawn) Creates an instance of aTestModifierrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncategory()Returns the value of thecategoryrecord component.com.mojang.serialization.MapCodec<? extends StructureModifier> codec()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.private static com.mojang.serialization.MapCodec<StructureModifierTest.TestModifier> voidmodify(Holder<Structure> structure, StructureModifier.Phase phase, ModifiableStructureInfo.StructureInfo.Builder builder) Modifies the information via the provided structure builder.spawn()Returns the value of thespawnrecord component.Returns the value of thestructuresrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
structures
The field for thestructuresrecord component. -
category
The field for thecategoryrecord component. -
spawn
The field for thespawnrecord component. -
SERIALIZER
private static final DeferredHolder<com.mojang.serialization.MapCodec<? extends StructureModifier>,com.mojang.serialization.MapCodec<? extends StructureModifier>> SERIALIZER
-
-
Constructor Details
-
TestModifier
public TestModifier(HolderSet<Structure> structures, MobCategory category, MobSpawnSettings.SpawnerData spawn) Creates an instance of aTestModifierrecord class.- Parameters:
structures- the value for thestructuresrecord componentcategory- the value for thecategoryrecord componentspawn- the value for thespawnrecord 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
-
makeCodec
-
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
-
category
Returns the value of thecategoryrecord component.- Returns:
- the value of the
categoryrecord component
-
spawn
Returns the value of thespawnrecord component.- Returns:
- the value of the
spawnrecord component
-