mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 04:02:06 -07:00
Prevent duplicate raider in RaidSpawnWaveEvent list (#12040)
This commit is contained in:
@@ -99,42 +99,20 @@
|
||||
this.stop();
|
||||
return;
|
||||
}
|
||||
@@ -491,6 +_,10 @@
|
||||
@@ -486,7 +_,7 @@
|
||||
|
||||
private void spawnGroup(BlockPos pos) {
|
||||
boolean flag = false;
|
||||
- int i = this.groupsSpawned + 1;
|
||||
+ int i = this.groupsSpawned + 1; final int wave = i; // Paper - OBFHELPER
|
||||
this.totalHealth = 0.0F;
|
||||
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(raider); // 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(wave)), this.groupRaiderMap.get(wave)); // CraftBukkit
|
||||
}
|
||||
|
||||
public void joinRaid(int wave, Raider raider, @Nullable BlockPos pos, boolean isRecruited) {
|
||||
|
Reference in New Issue
Block a user