Record Class BiomeModifiers.AddSpawnCostsBiomeModifier
java.lang.Object
java.lang.Record
net.neoforged.neoforge.common.world.BiomeModifiers.AddSpawnCostsBiomeModifier
- Record Components:
biomes- Biomes to add spawn costs to.entityTypes- EntityTypes to add spawn costs for.spawnCost- MobSpawnCost to add for those entity types.
- All Implemented Interfaces:
BiomeModifier
- Enclosing class:
BiomeModifiers
public static record BiomeModifiers.AddSpawnCostsBiomeModifier(HolderSet<Biome> biomes, HolderSet<EntityType<?>> entityTypes, MobSpawnSettings.MobSpawnCost spawnCost)
extends Record
implements BiomeModifier
Stock biome modifier at adds spawn costs to a biome. Has the following json format:
{
"type": "neoforge:add_spawn_costs", // Required
"biomes": "#namespace:biome_tag", // Accepts a biome id, [list of biome ids], or #namespace:biome_tag
"entity_types": #namespace:entitytype_tag, // Accepts an entity type, [list of entity types], or #namespace:entitytype_tag
"spawn_cost": {
"energy_budget": 1.0, // double
"charge": 1.0 // double
}
}
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.neoforged.neoforge.common.world.BiomeModifier
BiomeModifier.Phase -
Field Summary
FieldsModifier and TypeFieldDescriptionThe field for thebiomesrecord component.private final HolderSet<EntityType<?>> The field for theentityTypesrecord component.private final MobSpawnSettings.MobSpawnCostThe field for thespawnCostrecord component.Fields inherited from interface net.neoforged.neoforge.common.world.BiomeModifier
DIRECT_CODEC, LIST_CODEC, REFERENCE_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionAddSpawnCostsBiomeModifier(HolderSet<Biome> biomes, HolderSet<EntityType<?>> entityTypes, MobSpawnSettings.MobSpawnCost spawnCost) Creates an instance of aAddSpawnCostsBiomeModifierrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbiomes()Returns the value of thebiomesrecord component.com.mojang.serialization.MapCodec<? extends BiomeModifier> 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<Biome> biome, BiomeModifier.Phase phase, ModifiableBiomeInfo.BiomeInfo.Builder builder) Modifies the information via the provided biome builder.Returns the value of thespawnCostrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
biomes
The field for thebiomesrecord component. -
entityTypes
The field for theentityTypesrecord component. -
spawnCost
The field for thespawnCostrecord component.
-
-
Constructor Details
-
AddSpawnCostsBiomeModifier
public AddSpawnCostsBiomeModifier(HolderSet<Biome> biomes, HolderSet<EntityType<?>> entityTypes, MobSpawnSettings.MobSpawnCost spawnCost) Creates an instance of aAddSpawnCostsBiomeModifierrecord class.- Parameters:
biomes- the value for thebiomesrecord componententityTypes- the value for theentityTypesrecord componentspawnCost- the value for thespawnCostrecord component
-
-
Method Details
-
modify
public void modify(Holder<Biome> biome, BiomeModifier.Phase phase, ModifiableBiomeInfo.BiomeInfo.Builder builder) Description copied from interface:BiomeModifierModifies the information via the provided biome builder. Allows mob spawns and world-gen features to be added or removed, and climate and client effects to be modified.- Specified by:
modifyin interfaceBiomeModifier- Parameters:
biome- the named biome being modified (with original data readable).phase- biome modification phase. Biome modifiers apply in each phase in order of the enum constants.builder- mutable biome info builder. Apply changes to this.
-
codec
- Specified by:
codecin interfaceBiomeModifier- Returns:
- the codec which serializes and deserializes this biome 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). -
biomes
Returns the value of thebiomesrecord component.- Returns:
- the value of the
biomesrecord component
-
entityTypes
Returns the value of theentityTypesrecord component.- Returns:
- the value of the
entityTypesrecord component
-
spawnCost
Returns the value of thespawnCostrecord component.- Returns:
- the value of the
spawnCostrecord component
-