public class LocationWeightedAlgorithm extends java.lang.Object implements SelectionAlgorithm
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 and Description |
---|
LocationWeightedAlgorithm() |
Modifier and Type | Method and Description |
---|---|
java.util.List<SpawnAction<? extends net.minecraft.entity.Entity>> |
calculateSpawnActions(AbstractSpawner spawner,
java.util.List<SpawnSet> spawnSets,
java.util.List<SpawnLocation> spawnLocations)
|
java.util.Map<SpawnInfo,java.lang.Float> |
getAdjustedRarities(AbstractSpawner spawner,
java.util.Map<SpawnLocation,java.util.List<SpawnInfo>> possibleSpawns)
Gets the adjusted rarities of the given mapping from
SpawnLocation to list of SpawnInfo s. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
choose, chooseViaPercentage, getPercentages
public java.util.List<SpawnAction<? extends net.minecraft.entity.Entity>> calculateSpawnActions(AbstractSpawner spawner, java.util.List<SpawnSet> spawnSets, java.util.List<SpawnLocation> spawnLocations)
SelectionAlgorithm
calculateSpawnActions
in interface SelectionAlgorithm
public java.util.Map<SpawnInfo,java.lang.Float> getAdjustedRarities(AbstractSpawner spawner, java.util.Map<SpawnLocation,java.util.List<SpawnInfo>> possibleSpawns)
SelectionAlgorithm
SpawnLocation
to list of SpawnInfo
s.getAdjustedRarities
in interface SelectionAlgorithm