Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulu13022002 committed Jan 28, 2025
1 parent 6eda87a commit 8913db7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,42 +99,11 @@
this.stop();
return;
}
@@ -491,6 +_,10 @@
DifficultyInstance currentDifficultyAt = this.level.getCurrentDifficultyAt(pos);
boolean shouldSpawnBonusGroup = this.shouldSpawnBonusGroup();

+ // CraftBukkit start
+ Raider leader = null;
+ List<Raider> raiders = new java.util.ArrayList<>();
+ // CraftBukkit end
for (Raid.RaiderType raiderType : Raid.RaiderType.VALUES) {
int i1 = this.getDefaultNumSpawns(raiderType, i, shouldSpawnBonusGroup)
+ this.getPotentialBonusSpawns(raiderType, this.random, i, currentDifficultyAt, shouldSpawnBonusGroup);
@@ -506,9 +_,11 @@
raider.setPatrolLeader(true);
this.setLeader(i, raider);
flag = true;
+ leader = raider; // CraftBukkit
}

this.joinRaid(i, raider, pos, false);
+ raiders.add(raider); // CraftBukkit
if (raiderType.entityType == EntityType.RAVAGER) {
Raider raider1 = null;
if (i == this.getNumGroups(Difficulty.NORMAL)) {
@@ -526,6 +_,7 @@
this.joinRaid(i, raider1, pos, false);
raider1.moveTo(pos, 0.0F, 0.0F);
raider1.startRiding(raider);
+ raiders.add(raider1); // CraftBukkit
}
}
}
@@ -535,6 +_,7 @@
this.groupsSpawned++;
this.updateBossbar();
this.setDirty();
+ org.bukkit.craftbukkit.event.CraftEventFactory.callRaidSpawnWaveEvent(this, leader, raiders); // CraftBukkit
+ org.bukkit.craftbukkit.event.CraftEventFactory.callRaidSpawnWaveEvent(this, java.util.Objects.requireNonNull(this.getLeader(i)), this.groupRaiderMap.get(i)); // CraftBukkit
}

public void joinRaid(int wave, Raider raider, @Nullable BlockPos pos, boolean isRecruited) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -87,7 +88,6 @@
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.entity.CraftRaider;
import org.bukkit.craftbukkit.entity.CraftSpellcaster;
import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
Expand Down Expand Up @@ -2015,7 +2015,7 @@ public static void callRaidStopEvent(Raid raid, RaidStopEvent.Reason reason) {
Bukkit.getPluginManager().callEvent(event);
}

public static void callRaidSpawnWaveEvent(Raid raid, net.minecraft.world.entity.raid.Raider leader, List<net.minecraft.world.entity.raid.Raider> raiders) {
public static void callRaidSpawnWaveEvent(Raid raid, net.minecraft.world.entity.raid.Raider leader, Set<net.minecraft.world.entity.raid.Raider> raiders) {
Raider bukkitLeader = (Raider) leader.getBukkitEntity();
List<Raider> bukkitRaiders = new ArrayList<>(raiders.size());
for (net.minecraft.world.entity.raid.Raider raider : raiders) {
Expand Down

0 comments on commit 8913db7

Please sign in to comment.