Interface SelectionAlgorithm
- All Known Implementing Classes:
FlatDistinctAlgorithm
,LocationWeightedAlgorithm
public interface SelectionAlgorithm
Interface for an algorithm used to select spawns from a list of possible spawns.
-
Method Summary
Modifier and TypeMethodDescriptionList<SpawnAction<? extends net.minecraft.world.entity.Entity>>
calculateSpawnActions
(AbstractSpawner spawner, List<SpawnSet> spawnSets, List<SpawnLocation> spawnLocations) default SpawnInfo
choose
(AbstractSpawner spawner, SpawnLocation spawnLocation, ArrayList<SpawnInfo> spawnInfos) Default method which chooses aSpawnInfo
from the given list by percentage if possible, then using normal rarity sum method.default SpawnInfo
chooseViaPercentage
(AbstractSpawner spawner, ArrayList<SpawnInfo> spawnInfos) Default method that chooses aSpawnInfo
from the given list based on theSpawnInfo.percentage
if possible.getAdjustedRarities
(AbstractSpawner spawner, Map<SpawnLocation, List<SpawnInfo>> possibleSpawns) Gets the adjusted rarities of the given mapping fromSpawnLocation
to list ofSpawnInfo
s.getPercentages
(AbstractSpawner spawner, Map<SpawnLocation, List<SpawnInfo>> possibleSpawns) Default method that converts a mapping ofSpawnLocation
to list ofSpawnInfo
into a mapping from label to percentage This callsgetAdjustedRarities(AbstractSpawner, Map)
, which is how this ends up getting implementation-specific results.
-
Method Details
-
calculateSpawnActions
List<SpawnAction<? extends net.minecraft.world.entity.Entity>> calculateSpawnActions(AbstractSpawner spawner, List<SpawnSet> spawnSets, List<SpawnLocation> spawnLocations) -
getAdjustedRarities
Map<SpawnInfo,Float> getAdjustedRarities(AbstractSpawner spawner, Map<SpawnLocation, List<SpawnInfo>> possibleSpawns) Gets the adjusted rarities of the given mapping fromSpawnLocation
to list ofSpawnInfo
s. -
getPercentages
default Map<String,Double> getPercentages(AbstractSpawner spawner, Map<SpawnLocation, List<SpawnInfo>> possibleSpawns) Default method that converts a mapping ofSpawnLocation
to list ofSpawnInfo
into a mapping from label to percentage This callsgetAdjustedRarities(AbstractSpawner, Map)
, which is how this ends up getting implementation-specific results. -
chooseViaPercentage
@Nullable default SpawnInfo chooseViaPercentage(AbstractSpawner spawner, ArrayList<SpawnInfo> spawnInfos) Default method that chooses aSpawnInfo
from the given list based on theSpawnInfo.percentage
if possible. -
choose
default SpawnInfo choose(AbstractSpawner spawner, SpawnLocation spawnLocation, ArrayList<SpawnInfo> spawnInfos) Default method which chooses aSpawnInfo
from the given list by percentage if possible, then using normal rarity sum method.
-