Update to Minecraft 1.21

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-06-14 01:05:00 +10:00
parent 7c6204e1a9
commit eed041d629
255 changed files with 3585 additions and 3261 deletions

View File

@@ -13,7 +13,7 @@
public class EntityEnderCrystal extends Entity {
private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.defineId(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS);
@@ -55,7 +61,11 @@
@@ -57,7 +63,11 @@
BlockPosition blockposition = this.blockPosition();
if (((WorldServer) this.level()).getDragonFight() != null && this.level().getBlockState(blockposition).isAir()) {
@@ -26,7 +26,7 @@
}
}
@@ -92,12 +102,26 @@
@@ -94,12 +104,26 @@
return false;
} else {
if (!this.isRemoved() && !this.level().isClientSide) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
@@ -51,6 +51,20 @@
@@ -52,6 +52,20 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -21,7 +21,7 @@
public class EntityEnderDragon extends EntityInsentient implements IMonster {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -88,6 +102,7 @@
@@ -89,6 +103,7 @@
private final PathPoint[] nodes;
private final int[] nodeAdjacency;
private final Path openSet;
@@ -29,7 +29,7 @@
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
super(EntityTypes.ENDER_DRAGON, world);
@@ -109,6 +124,7 @@
@@ -110,6 +125,7 @@
this.noPhysics = true;
this.noCulling = true;
this.phaseManager = new DragonControllerManager(this);
@@ -37,7 +37,7 @@
}
public void setDragonFight(EnderDragonBattle enderdragonbattle) {
@@ -256,7 +272,7 @@
@@ -257,7 +273,7 @@
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
@@ -46,7 +46,7 @@
double d0 = vec3d1.x - this.getX();
double d1 = vec3d1.y - this.getY();
double d2 = vec3d1.z - this.getZ();
@@ -397,7 +413,14 @@
@@ -404,7 +420,14 @@
if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
@@ -62,7 +62,7 @@
}
}
@@ -472,6 +495,9 @@
@@ -489,6 +512,9 @@
int j1 = MathHelper.floor(axisalignedbb.maxZ);
boolean flag = false;
boolean flag1 = false;
@@ -72,7 +72,7 @@
for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = j; l1 <= i1; ++l1) {
@@ -481,7 +507,11 @@
@@ -498,7 +524,11 @@
if (!iblockdata.isAir() && !iblockdata.is(TagsBlock.DRAGON_TRANSPARENT)) {
if (this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
@@ -85,7 +85,7 @@
} else {
flag = true;
}
@@ -490,6 +520,51 @@
@@ -507,6 +537,51 @@
}
}
@@ -137,7 +137,7 @@
if (flag1) {
BlockPosition blockposition1 = new BlockPosition(i + this.random.nextInt(l - i + 1), j + this.random.nextInt(i1 - j + 1), k + this.random.nextInt(j1 - k + 1));
@@ -545,7 +620,7 @@
@@ -562,7 +637,7 @@
@Override
public void kill() {
@@ -146,13 +146,13 @@
this.gameEvent(GameEvent.ENTITY_DIE);
if (this.dragonFight != null) {
this.dragonFight.updateDragon(this);
@@ -554,6 +629,21 @@
@@ -571,6 +646,21 @@
}
+ // CraftBukkit start - SPIGOT-2420: Special case, the ender dragon drops 12000 xp for the first kill and 500 xp for every other kill and this over time.
+ @Override
+ public int getExpReward() {
+ public int getExpReward(Entity entity) {
+ // CraftBukkit - Moved from #tickDeath method
+ boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
+ short short0 = 500;
@@ -168,7 +168,7 @@
@Override
protected void tickDeath() {
if (this.dragonFight != null) {
@@ -569,15 +659,20 @@
@@ -586,15 +676,20 @@
this.level().addParticle(Particles.EXPLOSION_EMITTER, this.getX() + (double) f, this.getY() + 2.0D + (double) f1, this.getZ() + (double) f2, 0.0D, 0.0D, 0.0D);
}
@@ -190,7 +190,7 @@
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), MathHelper.floor((float) short0 * 0.08F));
}
@@ -588,7 +683,7 @@
@@ -605,7 +700,7 @@
this.move(EnumMoveType.SELF, new Vec3D(0.0D, 0.10000000149011612D, 0.0D));
if (this.dragonDeathTime == 200 && this.level() instanceof WorldServer) {
@@ -199,7 +199,7 @@
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), MathHelper.floor((float) short0 * 0.2F));
}
@@ -596,7 +691,7 @@
@@ -613,7 +708,7 @@
this.dragonFight.setDragonKilled(this);
}
@@ -208,7 +208,7 @@
this.gameEvent(GameEvent.ENTITY_DIE);
}
@@ -809,6 +904,7 @@
@@ -826,6 +921,7 @@
super.addAdditionalSaveData(nbttagcompound);
nbttagcompound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
nbttagcompound.putInt("DragonDeathTime", this.dragonDeathTime);
@@ -216,7 +216,7 @@
}
@Override
@@ -822,6 +918,11 @@
@@ -839,6 +935,11 @@
this.dragonDeathTime = nbttagcompound.getInt("DragonDeathTime");
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
@@ -58,6 +58,18 @@
@@ -59,6 +59,18 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@@ -19,7 +19,7 @@
public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity {
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT);
@@ -254,15 +266,40 @@
@@ -255,15 +267,40 @@
i = this.getInvulnerableTicks() - 1;
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
if (i <= 0) {
@@ -63,7 +63,7 @@
}
} else {
@@ -307,6 +344,7 @@
@@ -308,6 +345,7 @@
if (!list.isEmpty()) {
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
@@ -71,7 +71,7 @@
this.setAlternativeTarget(i, entityliving1.getId());
}
}
@@ -333,6 +371,11 @@
@@ -334,6 +372,11 @@
IBlockData iblockdata = this.level().getBlockState(blockposition);
if (canDestroy(iblockdata)) {
@@ -83,7 +83,7 @@
flag = this.level().destroyBlock(blockposition, true, this) || flag;
}
}
@@ -344,7 +387,7 @@
@@ -345,7 +388,7 @@
}
if (this.tickCount % 20 == 0) {
@@ -92,7 +92,7 @@
}
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());
@@ -500,7 +543,7 @@
@@ -502,7 +545,7 @@
@Override
public void checkDespawn() {
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {