Update to Minecraft 1.20.5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-04-24 01:15:00 +10:00
parent 4deda9501f
commit 65bc2541a3
524 changed files with 7788 additions and 6181 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/raid/EntityRaider.java
+++ b/net/minecraft/world/entity/raid/EntityRaider.java
@@ -43,6 +43,10 @@
@@ -45,6 +45,10 @@
import net.minecraft.world.level.WorldAccess;
import net.minecraft.world.phys.Vec3D;
@@ -11,7 +11,7 @@
public abstract class EntityRaider extends EntityMonsterPatrolling {
protected static final DataWatcherObject<Boolean> IS_CELEBRATING = DataWatcher.defineId(EntityRaider.class, DataWatcherRegistry.BOOLEAN);
@@ -165,7 +169,7 @@
@@ -166,7 +170,7 @@
MobEffect mobeffect1 = new MobEffect(MobEffects.BAD_OMEN, 120000, i, false, false, true);
if (!this.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_RAIDS)) {
@@ -20,7 +20,7 @@
}
}
}
@@ -256,7 +260,7 @@
@@ -275,7 +279,7 @@
this.onItemPickup(entityitem);
this.setItemSlot(enumitemslot, itemstack);
this.take(entityitem, itemstack.getCount());
@@ -29,16 +29,25 @@
this.getCurrentRaid().setLeader(this.getWave(), this);
this.setPatrolLeader(true);
} else {
@@ -305,7 +309,7 @@
@@ -324,7 +328,7 @@
private final T mob;
- public b(EntityRaider entityraider) {
+ public b(T entityraider) { // CraftBukkit - decompile error
this.mob = entityraider;
- public b(final EntityRaider entityraider, final EntityRaider entityraider1) {
+ public b(final EntityRaider entityraider, final T entityraider1) { // CraftBukkit - decompile error
this.mob = entityraider1;
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
}
@@ -521,7 +525,7 @@
@@ -517,7 +521,7 @@
private final float hostileRadiusSqr;
public final PathfinderTargetCondition shoutTargeting = PathfinderTargetCondition.forNonCombat().range(8.0D).ignoreLineOfSight().ignoreInvisibilityTesting();
- public a(final EntityRaider entityraider, final EntityIllagerAbstract entityillagerabstract, final float f) {
+ public a(final EntityIllagerAbstract entityillagerabstract, final float f) { // CraftBukkit - decompile error
this.mob = entityillagerabstract;
this.hostileRadiusSqr = f * f;
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK));
@@ -540,7 +544,7 @@
while (iterator.hasNext()) {
EntityRaider entityraider = (EntityRaider) iterator.next();
@@ -47,7 +56,7 @@
}
}
@@ -538,7 +542,7 @@
@@ -557,7 +561,7 @@
while (iterator.hasNext()) {
EntityRaider entityraider = (EntityRaider) iterator.next();

View File

@@ -1,37 +1,27 @@
--- a/net/minecraft/world/entity/raid/PersistentRaid.java
+++ b/net/minecraft/world/entity/raid/PersistentRaid.java
@@ -121,19 +121,33 @@
boolean flag = false;
@@ -115,11 +115,23 @@
if (!raid.isStarted()) {
+ /* CraftBukkit - moved down
if (!this.raidMap.containsKey(raid.getId())) {
this.raidMap.put(raid.getId(), raid);
}
+ */
Raid raid = this.getOrCreateRaid(entityplayer.serverLevel(), blockposition2);
flag = true;
- } else if (raid.getBadOmenLevel() < raid.getMaxBadOmenLevel()) {
+ // CraftBukkit start - fixed a bug with raid: players could add up Bad Omen level even when the raid had finished
+ } else if (raid.isInProgress() && raid.getBadOmenLevel() < raid.getMaxBadOmenLevel()) {
flag = true;
+ // CraftBukkit end
} else {
entityplayer.removeEffect(MobEffects.BAD_OMEN);
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, (byte) 43));
+ /* CraftBukkit - moved down
if (!raid.isStarted() && !this.raidMap.containsKey(raid.getId())) {
this.raidMap.put(raid.getId(), raid);
}
+ */
if (flag) {
- if (!raid.isStarted() || raid.getRaidOmenLevel() < raid.getMaxRaidOmenLevel()) {
+ if (!raid.isStarted() || (raid.isInProgress() && raid.getRaidOmenLevel() < raid.getMaxRaidOmenLevel())) { // CraftBukkit - fixed a bug with raid: players could add up Bad Omen level even when the raid had finished
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callRaidTriggerEvent(raid, entityplayer)) {
+ entityplayer.removeEffect(MobEffects.BAD_OMEN);
+ entityplayer.removeEffect(net.minecraft.world.effect.MobEffects.RAID_OMEN);
+ return null;
+ }
+
+ if (!this.raidMap.containsKey(raid.getId())) {
+ if (!raid.isStarted() && !this.raidMap.containsKey(raid.getId())) {
+ this.raidMap.put(raid.getId(), raid);
+ }
+ // CraftBukkit end
raid.absorbBadOmen(entityplayer);
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, (byte) 43));
if (!raid.hasFirstWaveSpawned()) {
raid.absorbRaidOmen(entityplayer);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/raid/Raid.java
+++ b/net/minecraft/world/entity/raid/Raid.java
@@ -176,6 +176,12 @@
@@ -180,6 +180,12 @@
return this.status == Raid.Status.LOSS;
}
@@ -13,7 +13,7 @@
public float getTotalHealth() {
return this.totalHealth;
}
@@ -272,6 +278,7 @@
@@ -284,6 +290,7 @@
this.active = this.level.hasChunkAt(this.center);
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL) {
@@ -21,7 +21,7 @@
this.stop();
return;
}
@@ -291,13 +298,16 @@
@@ -303,13 +310,16 @@
if (!this.level.isVillage(this.center)) {
if (this.groupsSpawned > 0) {
this.status = Raid.Status.LOSS;
@@ -38,7 +38,7 @@
this.stop();
return;
}
@@ -371,6 +381,7 @@
@@ -383,6 +393,7 @@
}
if (j > 3) {
@@ -46,7 +46,7 @@
this.stop();
break;
}
@@ -383,6 +394,7 @@
@@ -395,6 +406,7 @@
this.status = Raid.Status.VICTORY;
Iterator iterator = this.heroesOfTheVillage.iterator();
@@ -54,7 +54,7 @@
while (iterator.hasNext()) {
UUID uuid = (UUID) iterator.next();
Entity entity = this.level.getEntity(uuid);
@@ -397,10 +409,12 @@
@@ -409,10 +421,12 @@
entityplayer.awardStat(StatisticList.RAID_WIN);
CriterionTriggers.RAID_WIN.trigger(entityplayer);
@@ -67,7 +67,7 @@
}
}
@@ -408,6 +422,7 @@
@@ -420,6 +434,7 @@
} else if (this.isOver()) {
++this.celebrationTicks;
if (this.celebrationTicks >= 600) {
@@ -75,7 +75,7 @@
this.stop();
return;
}
@@ -544,6 +559,10 @@
@@ -556,6 +571,10 @@
int j = araid_wave.length;
int k = 0;
@@ -86,7 +86,7 @@
while (k < j) {
Raid.Wave raid_wave = araid_wave[k];
int l = this.getDefaultNumSpawns(raid_wave, i, flag1) + this.getPotentialBonusSpawns(raid_wave, this.random, i, difficultydamagescaler, flag1);
@@ -559,9 +578,11 @@
@@ -571,9 +590,11 @@
entityraider.setPatrolLeader(true);
this.setLeader(i, entityraider);
flag = true;
@@ -98,7 +98,7 @@
if (raid_wave.entityType == EntityTypes.RAVAGER) {
EntityRaider entityraider1 = null;
@@ -580,6 +601,7 @@
@@ -592,6 +613,7 @@
this.joinRaid(i, entityraider1, blockposition, false);
entityraider1.moveTo(blockposition, 0.0F, 0.0F);
entityraider1.startRiding(entityraider);
@@ -106,7 +106,7 @@
}
}
@@ -597,6 +619,7 @@
@@ -609,6 +631,7 @@
++this.groupsSpawned;
this.updateBossbar();
this.setDirty();
@@ -114,8 +114,8 @@
}
public void joinRaid(int i, EntityRaider entityraider, @Nullable BlockPosition blockposition, boolean flag) {
@@ -612,7 +635,7 @@
entityraider.finalizeSpawn(this.level, this.level.getCurrentDifficultyAt(blockposition), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null);
@@ -624,7 +647,7 @@
entityraider.finalizeSpawn(this.level, this.level.getCurrentDifficultyAt(blockposition), EnumMobSpawn.EVENT, (GroupDataEntity) null);
entityraider.applyRaidBuffs(i, false);
entityraider.setOnGround(true);
- this.level.addFreshEntityWithPassengers(entityraider);
@@ -123,7 +123,7 @@
}
}
@@ -862,6 +885,12 @@
@@ -873,6 +896,12 @@
this.heroesOfTheVillage.add(entity.getUUID());
}