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 aMobCostrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoublecharge()Returns the value of thechargerecord component.doubleReturns the value of theenergyBudgetrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.world.level.biome.MobSpawnSettings.MobSpawnCostConverts thisSpawnData.MobCostto aMobSpawnSettings.MobSpawnCost.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MobCost
public MobCost(double charge, double energyBudget) Creates an instance of aMobCostrecord class.- Parameters:
charge- the value for thechargerecord componentenergyBudget- the value for theenergyBudgetrecord component
-
-
Method Details
-
toMobSpawnCost
@Internal public net.minecraft.world.level.biome.MobSpawnSettings.MobSpawnCost toMobSpawnCost()Converts thisSpawnData.MobCostto 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 thechargerecord component.- Returns:
- the value of the
chargerecord component
-
energyBudget
public double energyBudget()Returns the value of theenergyBudgetrecord component.- Returns:
- the value of the
energyBudgetrecord component
-