Package cz.jeme.bestium.api.inject.biome
Record Class SpawnData
java.lang.Object
java.lang.Record
cz.jeme.bestium.api.inject.biome.SpawnData
- Record Components:
weight
- Relative spawn probability. Higher values increase spawn frequency compared to other entities in the same biome. To configure this accurately, compare values of other mobs in the biome. For vanilla biomes, refer to: Minecraft Wiki - Plains.minGroupSize
- Minimum number of mobs that can spawn together in a group.maxGroupSize
- Maximum number of mobs that can spawn together in a group.cost
- Optional spawn cost. SeeSpawnData.MobCost
for details.
public record SpawnData(int weight, int minGroupSize, int maxGroupSize, @Nullable SpawnData.MobCost cost)
extends Record
Configuration for how often and in what group sizes a mob should spawn within a biome.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
Represents additional spawn constraints introduced in Minecraft 1.16 ("The Nether Update"). -
Constructor Summary
ConstructorsConstructorDescriptionSpawnData
(int weight, int groupSize) Creates spawn data with an exact group size (min and max will be the same).SpawnData
(int weight, int minGroupSize, int maxGroupSize) Creates spawn data without a mob cost.SpawnData
(int weight, int minGroupSize, int maxGroupSize, @Nullable SpawnData.MobCost cost) Creates an instance of aSpawnData
record class. -
Method Summary
Modifier and TypeMethodDescriptioncost()
Returns the value of thecost
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
Returns the value of themaxGroupSize
record component.int
Returns the value of theminGroupSize
record component.net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData
toSpawnerData
(net.minecraft.world.entity.EntityType<?> type) Converts thisSpawnData
intoMobSpawnSettings.SpawnerData
.final String
toString()
Returns a string representation of this record class.int
weight()
Returns the value of theweight
record component.
-
Constructor Details
-
SpawnData
public SpawnData(int weight, int minGroupSize, int maxGroupSize) Creates spawn data without a mob cost.- Parameters:
weight
- spawn weightminGroupSize
- minimum group sizemaxGroupSize
- maximum group size
-
SpawnData
public SpawnData(int weight, int groupSize) Creates spawn data with an exact group size (min and max will be the same).- Parameters:
weight
- spawn weightgroupSize
- fixed group size
-
SpawnData
Creates an instance of aSpawnData
record class.- Parameters:
weight
- the value for theweight
record componentminGroupSize
- the value for theminGroupSize
record componentmaxGroupSize
- the value for themaxGroupSize
record componentcost
- the value for thecost
record component
-
-
Method Details
-
toSpawnerData
@Internal public net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData toSpawnerData(net.minecraft.world.entity.EntityType<?> type) Converts thisSpawnData
intoMobSpawnSettings.SpawnerData
.- Parameters:
type
- the entity type to bind this spawn data to- Returns:
- the NMS representation of this spawn data
-
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
weight
public int weight()Returns the value of theweight
record component.- Returns:
- the value of the
weight
record component
-
minGroupSize
public int minGroupSize()Returns the value of theminGroupSize
record component.- Returns:
- the value of the
minGroupSize
record component
-
maxGroupSize
public int maxGroupSize()Returns the value of themaxGroupSize
record component.- Returns:
- the value of the
maxGroupSize
record component
-
cost
Returns the value of thecost
record component.- Returns:
- the value of the
cost
record component
-