1.21.6 dev

Co-authored-by: Bjarne Koll <git@lynxplay.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
Bjarne Koll
2025-05-28 13:23:32 +02:00
committed by Nassim Jahnke
parent 39203a65e0
commit a24f9b204c
788 changed files with 41006 additions and 6324 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
@@ -25,6 +_,7 @@
@@ -26,6 +_,7 @@
private static final EntityDataAccessor<Boolean> DATA_SHOW_BOTTOM = SynchedEntityData.defineId(EndCrystal.class, EntityDataSerializers.BOOLEAN);
private static final boolean DEFAULT_SHOW_BOTTOM = true;
public int time;
@@ -8,7 +8,7 @@
public EndCrystal(EntityType<? extends EndCrystal> entityType, Level level) {
super(entityType, level);
@@ -56,21 +_,37 @@
@@ -57,21 +_,37 @@
if (this.level() instanceof ServerLevel) {
BlockPos blockPos = this.blockPosition();
if (((ServerLevel)this.level()).getDragonFight() != null && this.level().getBlockState(blockPos).isAir()) {
@@ -34,21 +34,21 @@
}
@Override
protected void addAdditionalSaveData(CompoundTag compound) {
compound.storeNullable("beam_target", BlockPos.CODEC, this.getBeamTarget());
compound.putBoolean("ShowBottom", this.showsBottom());
+ compound.putBoolean("Paper.GeneratedByDragonFight", this.generatedByDragonFight); // Paper - Fix invulnerable end crystals
protected void addAdditionalSaveData(ValueOutput output) {
output.storeNullable("beam_target", BlockPos.CODEC, this.getBeamTarget());
output.putBoolean("ShowBottom", this.showsBottom());
+ output.putBoolean("Paper.GeneratedByDragonFight", this.generatedByDragonFight); // Paper - Fix invulnerable end crystals
}
@Override
protected void readAdditionalSaveData(CompoundTag compound) {
this.setBeamTarget(compound.read("beam_target", BlockPos.CODEC).orElse(null));
this.setShowBottom(compound.getBooleanOr("ShowBottom", true));
+ this.generatedByDragonFight = compound.getBooleanOr("Paper.GeneratedByDragonFight", false); // Paper - Fix invulnerable end crystals
protected void readAdditionalSaveData(ValueInput input) {
this.setBeamTarget(input.read("beam_target", BlockPos.CODEC).orElse(null));
this.setShowBottom(input.getBooleanOr("ShowBottom", true));
+ this.generatedByDragonFight = input.getBooleanOr("Paper.GeneratedByDragonFight", false); // Paper - Fix invulnerable end crystals
}
@Override
@@ -91,10 +_,24 @@
@@ -92,10 +_,24 @@
return false;
} else {
if (!this.isRemoved()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -87,6 +_,10 @@
@@ -88,6 +_,10 @@
private final Node[] nodes = new Node[24];
private final int[] nodeAdjacency = new int[24];
private final BinaryHeap openSet = new BinaryHeap();
@@ -11,7 +11,7 @@
public EnderDragon(EntityType<? extends EnderDragon> entityType, Level level) {
super(EntityType.ENDER_DRAGON, level);
@@ -102,6 +_,7 @@
@@ -103,6 +_,7 @@
this.setHealth(this.getMaxHealth());
this.noPhysics = true;
this.phaseManager = new EnderDragonPhaseManager(this);
@@ -19,8 +19,8 @@
}
public void setDragonFight(EndDragonFight dragonFight) {
@@ -120,6 +_,19 @@
return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 200.0);
@@ -121,6 +_,19 @@
return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 200.0).add(Attributes.CAMERA_DISTANCE, 16.0);
}
+ // Paper start - Allow changing the EnderDragon podium
@@ -39,7 +39,7 @@
@Override
public boolean isFlapping() {
float cos = Mth.cos(this.flapTime * (float) (Math.PI * 2));
@@ -211,7 +_,7 @@
@@ -212,7 +_,7 @@
}
Vec3 flyTargetLocation = currentPhase.getFlyTargetLocation();
@@ -48,7 +48,7 @@
double d = flyTargetLocation.x - this.getX();
double d1 = flyTargetLocation.y - this.getY();
double d2 = flyTargetLocation.z - this.getZ();
@@ -366,7 +_,12 @@
@@ -367,7 +_,12 @@
if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
@@ -62,7 +62,7 @@
}
}
@@ -396,7 +_,7 @@
@@ -397,7 +_,7 @@
double d2 = entity.getX() - d;
double d3 = entity.getZ() - d1;
double max = Math.max(d2 * d2 + d3 * d3, 0.1);
@@ -71,7 +71,7 @@
if (!this.phaseManager.getCurrentPhase().isSitting() && livingEntity.getLastHurtByMobTimestamp() < entity.tickCount - 2) {
DamageSource damageSource = this.damageSources().mobAttack(this);
entity.hurtServer(level, damageSource, 5.0F);
@@ -429,6 +_,7 @@
@@ -430,6 +_,7 @@
int floor5 = Mth.floor(box.maxZ);
boolean flag = false;
boolean flag1 = false;
@@ -79,7 +79,7 @@
for (int i = floor; i <= floor3; i++) {
for (int i1 = floor1; i1 <= floor4; i1++) {
@@ -437,7 +_,11 @@
@@ -438,7 +_,11 @@
BlockState blockState = level.getBlockState(blockPos);
if (!blockState.isAir() && !blockState.is(BlockTags.DRAGON_TRANSPARENT)) {
if (level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !blockState.is(BlockTags.DRAGON_IMMUNE)) {
@@ -92,7 +92,7 @@
} else {
flag = true;
}
@@ -446,6 +_,58 @@
@@ -447,6 +_,58 @@
}
}
@@ -151,7 +151,7 @@
if (flag1) {
BlockPos blockPos1 = new BlockPos(
floor + this.random.nextInt(floor3 - floor + 1),
@@ -503,7 +_,15 @@
@@ -504,7 +_,15 @@
@Override
public void kill(ServerLevel level) {
@@ -168,7 +168,7 @@
this.gameEvent(GameEvent.ENTITY_DIE);
if (this.dragonFight != null) {
this.dragonFight.updateDragon(this);
@@ -525,18 +_,41 @@
@@ -526,18 +_,41 @@
this.level().addParticle(ParticleTypes.EXPLOSION_EMITTER, this.getX() + f, this.getY() + 2.0 + f1, this.getZ() + f2, 0.0, 0.0, 0.0);
}
@@ -186,7 +186,7 @@
- if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
- ExperienceOrb.award(serverLevel, this.position(), Mth.floor(i * 0.08F));
+ if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
+ ExperienceOrb.award(serverLevel, this.position(), Mth.floor(i * 0.08F), org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, net.minecraft.Optionull.map(this.lastHurtByPlayer, lastHurtByPlayer -> lastHurtByPlayer.getEntity(this.level(), Player.class)), this); // Paper
+ ExperienceOrb.awardWithDirection(serverLevel, this.position(), net.minecraft.world.phys.Vec3.ZERO, Mth.floor(i * 0.08F), org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, net.minecraft.world.entity.EntityReference.get(this.lastHurtByPlayer, this.level(), Player.class), this); // Paper
}
if (this.dragonDeathTime == 1 && !this.isSilent()) {
@@ -213,14 +213,14 @@
}
}
@@ -549,15 +_,15 @@
@@ -550,15 +_,15 @@
}
if (this.dragonDeathTime == 200 && this.level() instanceof ServerLevel serverLevel1) {
- if (serverLevel1.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
- ExperienceOrb.award(serverLevel1, this.position(), Mth.floor(i * 0.2F));
+ if (true) { // Paper - SPIGOT-2420: Already checked for the game rule when calculating the xp
+ ExperienceOrb.award(serverLevel1, this.position(), Mth.floor(i * 0.2F), org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, net.minecraft.Optionull.map(this.lastHurtByPlayer, lastHurtByPlayer -> lastHurtByPlayer.getEntity(this.level(), Player.class)), this); // Paper
+ ExperienceOrb.awardWithDirection(serverLevel1, this.position(), net.minecraft.world.phys.Vec3.ZERO, Mth.floor(i * 0.2F), org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, net.minecraft.world.entity.EntityReference.get(this.lastHurtByPlayer, this.level(), Player.class), this); // Paper
}
if (this.dragonFight != null) {
@@ -232,23 +232,23 @@
this.gameEvent(GameEvent.ENTITY_DIE);
}
}
@@ -739,6 +_,7 @@
super.addAdditionalSaveData(compound);
compound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
compound.putInt("DragonDeathTime", this.dragonDeathTime);
+ compound.putInt("Bukkit.expToDrop", this.expToDrop); // CraftBukkit - SPIGOT-2420: The ender dragon drops xp over time which can also happen between server starts
@@ -740,6 +_,7 @@
super.addAdditionalSaveData(output);
output.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
output.putInt("DragonDeathTime", this.dragonDeathTime);
+ output.putInt("Bukkit.expToDrop", this.expToDrop); // CraftBukkit - SPIGOT-2420: The ender dragon drops xp over time which can also happen between server starts
}
@Override
@@ -746,6 +_,7 @@
super.readAdditionalSaveData(compound);
compound.getInt("DragonPhase").ifPresent(integer -> this.phaseManager.setPhase(EnderDragonPhase.getById(integer)));
this.dragonDeathTime = compound.getIntOr("DragonDeathTime", 0);
+ this.expToDrop = compound.getIntOr("Bukkit.expToDrop", 0); // CraftBukkit - SPIGOT-2420: The ender dragon drops xp over time which can also happen between server starts
@@ -747,6 +_,7 @@
super.readAdditionalSaveData(input);
input.getInt("DragonPhase").ifPresent(integer -> this.phaseManager.setPhase(EnderDragonPhase.getById(integer)));
this.dragonDeathTime = input.getIntOr("DragonDeathTime", 0);
+ this.expToDrop = input.getIntOr("Bukkit.expToDrop", 0); // CraftBukkit - SPIGOT-2420: The ender dragon drops xp over time which can also happen between server starts
}
@Override
@@ -786,7 +_,7 @@
@@ -787,7 +_,7 @@
EnderDragonPhase<? extends DragonPhaseInstance> phase = currentPhase.getPhase();
Vec3 viewVector;
if (phase == EnderDragonPhase.LANDING || phase == EnderDragonPhase.TAKEOFF) {
@@ -257,7 +257,7 @@
float max = Math.max((float)Math.sqrt(heightmapPos.distToCenterSqr(this.position())) / 4.0F, 1.0F);
float f = 6.0F / max;
float xRot = this.getXRot();
@@ -874,4 +_,19 @@
@@ -875,4 +_,19 @@
protected float sanitizeScale(float scale) {
return 1.0F;
}

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java
+++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java
@@ -83,7 +_,13 @@
this.flame.setParticle(ParticleTypes.DRAGON_BREATH);
this.flame.setCustomParticle(ParticleTypes.DRAGON_BREATH);
this.flame.setPotionDurationScale(0.25F);
this.flame.addEffect(new MobEffectInstance(MobEffects.INSTANT_DAMAGE));
+ if (new com.destroystokyo.paper.event.entity.EnderDragonFlameEvent((org.bukkit.entity.EnderDragon) this.dragon.getBukkitEntity(), (org.bukkit.entity.AreaEffectCloud) this.flame.getBukkitEntity()).callEvent()) { // Paper - EnderDragon Events

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -70,6 +_,7 @@
@@ -71,6 +_,7 @@
private final int[] nextHeadUpdate = new int[2];
private final int[] idleHeadUpdates = new int[2];
private int destroyBlocksTick;
@@ -8,7 +8,7 @@
public final ServerBossEvent bossEvent = (ServerBossEvent)new ServerBossEvent(
this.getDisplayName(), BossEvent.BossBarColor.PURPLE, BossEvent.BossBarOverlay.PROGRESS
)
@@ -261,15 +_,40 @@
@@ -262,15 +_,40 @@
int i = this.getInvulnerableTicks() - 1;
this.bossEvent.setProgress(1.0F - i / 220.0F);
if (i <= 0) {
@@ -52,7 +52,7 @@
}
} else {
super.customServerAiStep(level);
@@ -306,6 +_,7 @@
@@ -307,6 +_,7 @@
);
if (!nearbyEntities.isEmpty()) {
LivingEntity livingEntity1 = nearbyEntities.get(this.random.nextInt(nearbyEntities.size()));
@@ -60,7 +60,7 @@
this.setAlternativeTarget(ix, livingEntity1.getId());
}
}
@@ -335,6 +_,11 @@
@@ -336,6 +_,11 @@
)) {
BlockState blockState = level.getBlockState(blockPos);
if (canDestroy(blockState)) {
@@ -72,7 +72,7 @@
flag = level.destroyBlock(blockPos, true, this) || flag;
}
}
@@ -346,7 +_,7 @@
@@ -347,7 +_,7 @@
}
if (this.tickCount % 20 == 0) {
@@ -81,12 +81,12 @@
}
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());
@@ -484,16 +_,16 @@
@@ -485,16 +_,16 @@
@Override
protected void dropCustomDeathLoot(ServerLevel level, DamageSource damageSource, boolean recentlyHit) {
super.dropCustomDeathLoot(level, damageSource, recentlyHit);
- ItemEntity itemEntity = this.spawnAtLocation(level, Items.NETHER_STAR);
+ ItemEntity itemEntity = this.spawnAtLocation(level, new net.minecraft.world.item.ItemStack(Items.NETHER_STAR), 0, ItemEntity::setExtendedLifetime); // Paper - Restore vanilla drops behavior; spawnAtLocation returns null so modify the item entity with a consumer
+ ItemEntity itemEntity = this.spawnAtLocation(level, new net.minecraft.world.item.ItemStack(Items.NETHER_STAR), net.minecraft.world.phys.Vec3.ZERO, ItemEntity::setExtendedLifetime); // Paper - Restore vanilla drops behavior; spawnAtLocation returns null so modify the item entity with a consumer
if (itemEntity != null) {
- itemEntity.setExtendedLifetime();
+ itemEntity.setExtendedLifetime(); // Paper - diff on change
@@ -101,7 +101,7 @@
} else {
this.noActionTime = 0;
}
@@ -548,12 +_,18 @@
@@ -549,12 +_,18 @@
@Override
public boolean canUsePortal(boolean allowPassengers) {