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. See SpawnData.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 Classes
    Modifier and Type
    Class
    Description
    static final record 
    Represents additional spawn constraints introduced in Minecraft 1.16 ("The Nether Update").
  • Constructor Summary

    Constructors
    Constructor
    Description
    SpawnData(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 a SpawnData record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the cost record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the maxGroupSize record component.
    int
    Returns the value of the minGroupSize record component.
    net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData
    toSpawnerData(net.minecraft.world.entity.EntityType<?> type)
    Converts this SpawnData into MobSpawnSettings.SpawnerData.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the weight record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SpawnData

      public SpawnData(int weight, int minGroupSize, int maxGroupSize)
      Creates spawn data without a mob cost.
      Parameters:
      weight - spawn weight
      minGroupSize - minimum group size
      maxGroupSize - 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 weight
      groupSize - fixed group size
    • SpawnData

      public SpawnData(int weight, int minGroupSize, int maxGroupSize, @Nullable SpawnData.MobCost cost)
      Creates an instance of a SpawnData record class.
      Parameters:
      weight - the value for the weight record component
      minGroupSize - the value for the minGroupSize record component
      maxGroupSize - the value for the maxGroupSize record component
      cost - the value for the cost record component
  • Method Details

    • toSpawnerData

      @Internal public net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData toSpawnerData(net.minecraft.world.entity.EntityType<?> type)
      Converts this SpawnData into MobSpawnSettings.SpawnerData.
      Parameters:
      type - the entity type to bind this spawn data to
      Returns:
      the NMS representation of this spawn data
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • weight

      public int weight()
      Returns the value of the weight record component.
      Returns:
      the value of the weight record component
    • minGroupSize

      public int minGroupSize()
      Returns the value of the minGroupSize record component.
      Returns:
      the value of the minGroupSize record component
    • maxGroupSize

      public int maxGroupSize()
      Returns the value of the maxGroupSize record component.
      Returns:
      the value of the maxGroupSize record component
    • cost

      Returns the value of the cost record component.
      Returns:
      the value of the cost record component