This code defines a private method `getPotentialBonusSpawns` which determines the...
This code defines a private method getPotentialBonusSpawns
which determines the potential bonus spawns for a specific raider type within a raid in a game (presumably Minecraft or similar, as it uses references to mechanics such as raids, raider types, and difficulties). Here's what the code does:
-
It takes in five parameters:
p_219829_
: The raider type (e.g., VINDICATOR, PILLAGER, WITCH, etc.).p_219830_
: ARandomSource
instance used to generate random numbers.p_219831_
: An integer representing something about the game state (probably wave or level).p_219832_
: ADifficultyInstance
object representing the current difficulty level of the game.p_219833_
: Aboolean
flag that is unused in this method.
-
The method first determines the current difficulty level (
EASY
,NORMAL
,EXTREME
) by inspecting theDifficultyInstance
parameter (p_219832_
). -
For each specific
RaiderType
(provided viap_219829_
), it calculates the potential bonus spawns based on both:- The current difficulty level.
- The wave or level (
p_219831_
).
Behavior Per Raider Type:
VINDICATOR and PILLAGER:
- On
EASY
difficulty: Randomly spawn between 0 and 1 additional raiders. - On
NORMAL
difficulty: 1 extra raider is guaranteed. - On higher difficulties: 2 extra raiders are guaranteed.
EVOKER and ILLUSIONER:
- These raider types always return
0
(no bonus spawns possible).
WITCH:
- If the game is on
EASY
, or if the value ofp_219831_
corresponds to certain levels (<= 5
,== 8
,>= 11
), no bonus spawns are allowed. - Otherwise, 1 bonus spawn is possible.
- On
EXTREME
difficulty specifically, it always returns1
.
RAVAGER:
- If the game is on
EASY
, or ifp_219831_
indicates certain conditions (<= 3
or>= 6
), no bonus spawns are allowed. - Otherwise, 1 bonus spawn is possible.
- On
EXTREME
difficulty specifically, it always returns1
.
- Finally, the method either:
- Returns a random number between
0
andi
(inclusive), wherei
is the number of potential bonus spawns calculated. - Returns
0
if no bonus spawns are possible.
- Returns a random number between
Summary:
This code calculates and returns the potential number of bonus spawns for different raider types in a raid based on the difficulty level, the current wave (p_219831_
), and some other conditions. It also uses randomness (p_219830_
) to determine the actual number of these bonus spawns if they are eligible.