Package cz.jeme.bestium.api.inject.biome
Record Class SpawnData.MobCost
java.lang.Object
java.lang.Record
cz.jeme.bestium.api.inject.biome.SpawnData.MobCost
- Record Components:
charge
- how much charge this mob contributes to the spawn areaenergyBudget
- maximum total charge a spawn location can tolerate before blocking the spawn
- Enclosing class:
SpawnData
Represents additional spawn constraints introduced in Minecraft 1.16 ("The Nether Update").
Mob cost prevents entities from spawning too close to each other by assigning a charge and an energy budget.
Each mob contributes its charge
to nearby blocks (scaled by distance). When a new mob tries to spawn,
the cumulative charge of surrounding entities is calculated. If the total exceeds the energyBudget
, the mob
is not allowed to spawn. This creates natural spacing between mobs.
For example, in vanilla Minecraft, endermen in warped forests use mob costs to spawn less densely.
-
Constructor Summary
ConstructorsConstructorDescriptionMobCost
(double charge, double energyBudget) Creates an instance of aMobCost
record class. -
Method Summary
Modifier and TypeMethodDescriptiondouble
charge()
Returns the value of thecharge
record component.double
Returns the value of theenergyBudget
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.net.minecraft.world.level.biome.MobSpawnSettings.MobSpawnCost
Converts thisSpawnData.MobCost
to aMobSpawnSettings.MobSpawnCost
.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
MobCost
public MobCost(double charge, double energyBudget) Creates an instance of aMobCost
record class.- Parameters:
charge
- the value for thecharge
record componentenergyBudget
- the value for theenergyBudget
record component
-
-
Method Details
-
toMobSpawnCost
@Internal public net.minecraft.world.level.biome.MobSpawnSettings.MobSpawnCost toMobSpawnCost()Converts thisSpawnData.MobCost
to aMobSpawnSettings.MobSpawnCost
.- Returns:
- the NMS representation of this mob cost
-
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 with '=='. -
charge
public double charge()Returns the value of thecharge
record component.- Returns:
- the value of the
charge
record component
-
energyBudget
public double energyBudget()Returns the value of theenergyBudget
record component.- Returns:
- the value of the
energyBudget
record component
-