This Minecraft-style pseudocode seems to deal with mobs (raiders) being...
This Minecraft-style pseudocode seems to deal with mobs (raiders) being spawned and assigned to a raid event in the game. Here's a breakdown of what the code does:
-
Joining the Raid:
- The code starts by calling
this.joinRaid
, which appears to assign a specific raider entity (raider
) to a raid wave at leveli
. false
might indicate something like whether the entity should be spawned immediately or not during the raid.
- The code starts by calling
-
Special Handling for Ravagers:
- A check is performed to see if the
EntityType
of the current raider is aRAVAGER
. If so, it prepares to potentially add a secondary raider (raider1
) to ride or assist the primary raider.
- A check is performed to see if the
-
Difficulty-Based Conditional Spawning:
- Depending on the game's difficulty level and the current raid group (
i
), different types of entities (PILLAGER
,VINDICATOR
,EVOKER
,ILLUSIONER
) are created asraider1
:- When difficulty is
EASY
andi
matches a specific raid group, aPILLAGER
is created. - For
NORMAL
, aVINDICATOR
is created. - On
HARD
, aPILLAGER
is created ifk < 1
(likely limiting the number of additional spawns). - For an undefined difficulty labeled
EXTREME
(not in vanilla Minecraft), additional conditions are checked, and multiple entities (EVOKER
,ILLUSIONER
,VINDICATOR
, andPILLAGER
) are potentially spawned asraider1
.
- When difficulty is
- Depending on the game's difficulty level and the current raid group (
-
Updating Spawn Count (
k
):- The variable
k
is incremented to track the number of additional raiders spawned or riders assigned.
- The variable
-
Adding the New Raider (
raider1
):- If a new entity (
raider1
) was created, it is also added to the raid usingthis.joinRaid
. - The entity is moved (
moveTo
) to a specified location (p_37756_
), aligning it with the current raid position.
- If a new entity (
-
Entity Riding Behavior:
raider1
starts riding the primary raider (raider
), suggesting the creation of a stacked entity (e.g., a Pillager riding a Ravager).
Summary:
This code manages the spawning of raid entities in a mob raid system, dynamically adjusting the types of entities spawned based on various factors like difficulty, raid wave, and predefined thresholds. It also handles assigning secondary raiders to ride larger mobs (like Ravagers). The code appears to be from a custom mod or a codebase extending Minecraft, given the use of non-standard difficulty (EXTREME
) and entity types like ILLUSIONER
(normally unused).