Class LocationWeightedAlgorithm
java.lang.Object
com.pixelmonmod.pixelmon.api.spawning.archetypes.algorithms.selection.LocationWeightedAlgorithm
- All Implemented Interfaces:
SelectionAlgorithm
The Location-Weighted Algorithm
This algorithm will favour the entities that are available at more locations. This
uses cumulative sums of rarities, such that if a SpawnInfo
occurs at two SpawnLocation
,
it is exactly twice as likely as a different SpawnInfo
with an identical rarity that
is only possible at one SpawnLocation
.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionList<SpawnAction<? extends net.minecraft.world.entity.Entity>>
calculateSpawnActions
(AbstractSpawner spawner, List<SpawnSet> spawnSets, List<SpawnLocation> spawnLocations) getAdjustedRarities
(AbstractSpawner spawner, Map<SpawnLocation, List<SpawnInfo>> possibleSpawns) Gets the adjusted rarities of the given mapping fromSpawnLocation
to list ofSpawnInfo
s.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.pixelmonmod.pixelmon.api.spawning.calculators.SelectionAlgorithm
choose, chooseViaPercentage, getPercentages
-
Constructor Details
-
LocationWeightedAlgorithm
public LocationWeightedAlgorithm()
-
-
Method Details
-
calculateSpawnActions
public List<SpawnAction<? extends net.minecraft.world.entity.Entity>> calculateSpawnActions(AbstractSpawner spawner, List<SpawnSet> spawnSets, List<SpawnLocation> spawnLocations) Description copied from interface:SelectionAlgorithm
- Specified by:
calculateSpawnActions
in interfaceSelectionAlgorithm
-
getAdjustedRarities
public Map<SpawnInfo,Float> getAdjustedRarities(AbstractSpawner spawner, Map<SpawnLocation, List<SpawnInfo>> possibleSpawns) Description copied from interface:SelectionAlgorithm
Gets the adjusted rarities of the given mapping fromSpawnLocation
to list ofSpawnInfo
s.- Specified by:
getAdjustedRarities
in interfaceSelectionAlgorithm
-