Record Class BiomeModifiers.AddSpawnsBiomeModifier
java.lang.Object
java.lang.Record
net.neoforged.neoforge.common.world.BiomeModifiers.AddSpawnsBiomeModifier
- Record Components:
biomes- Biomes to add mob spawns to.spawners- List of SpawnerDatas specifying EntityType, weight, and pack size.
- All Implemented Interfaces:
BiomeModifier
- Enclosing class:
BiomeModifiers
public static record BiomeModifiers.AddSpawnsBiomeModifier(HolderSet<Biome> biomes, List<MobSpawnSettings.SpawnerData> spawners)
extends Record
implements BiomeModifier
Stock biome modifier that adds a mob spawn to a biome. Has the following json format:
{
"type": "neoforge:add_spawns", // Required
"biomes": "#namespace:biome_tag", // Accepts a biome id, [list of biome ids], or #namespace:biome_tag
"spawners":
{
"type": "namespace:entity_type", // Type of mob to spawn
"weight": 100, // int, spawn weighting
"minCount": 1, // int, minimum pack size
"maxCount": 4, // int, maximum pack size
}
}
Optionally accepts a list of spawner objects instead of a single spawner:
{
"type": "neoforge:add_spawns", // Required
"biomes": "#namespace:biome_tag", // Accepts a biome id, [list of biome ids], or #namespace:biome_tag
"spawners":
[
{
"type": "namespace:entity_type", // Type of mob to spawn
"weight": 100, // int, spawn weighting
"minCount": 1, // int, minimum pack size
"maxCount": 4, // int, maximum pack size
},
{
// additional spawner object
}
]
}
-
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 List<MobSpawnSettings.SpawnerData> The field for thespawnersrecord component.Fields inherited from interface net.neoforged.neoforge.common.world.BiomeModifier
DIRECT_CODEC, LIST_CODEC, REFERENCE_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionAddSpawnsBiomeModifier(HolderSet<Biome> biomes, List<MobSpawnSettings.SpawnerData> spawners) Creates an instance of aAddSpawnsBiomeModifierrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbiomes()Returns the value of thebiomesrecord component.com.mojang.serialization.MapCodec<? extends BiomeModifier> codec()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.singleSpawn(HolderSet<Biome> biomes, MobSpawnSettings.SpawnerData spawner) Convenience method for using a single MobSpawnSettings.SpawnerDatas.spawners()Returns the value of thespawnersrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
Constructor Details
-
Method Details
-
singleSpawn
public static BiomeModifiers.AddSpawnsBiomeModifier singleSpawn(HolderSet<Biome> biomes, MobSpawnSettings.SpawnerData spawner) Convenience method for using a single MobSpawnSettings.SpawnerDatas.- Parameters:
biomes- Biomes to add mob spawns to.spawner- SpawnerData specifying EntityTYpe, weight, and pack size.- Returns:
- AddSpawnsBiomeModifier that adds a single spawn entry to the specified biomes.
-
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
-
spawners
Returns the value of thespawnersrecord component.- Returns:
- the value of the
spawnersrecord component
-