Update to Minecraft 1.21.4

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-12-04 03:20:00 +11:00
parent 267ae64dd6
commit 5381ea78f7
125 changed files with 1383 additions and 1093 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/EntityPlayer.java
+++ b/net/minecraft/server/level/EntityPlayer.java
@@ -184,6 +184,41 @@
@@ -183,6 +183,41 @@
import net.minecraft.world.scores.criteria.IScoreboardCriteria;
import org.slf4j.Logger;
@@ -42,7 +42,7 @@
public class EntityPlayer extends EntityHuman {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -227,7 +262,7 @@
@@ -225,7 +260,7 @@
private int levitationStartTime;
private boolean disconnected;
private int requestedViewDistance;
@@ -51,7 +51,7 @@
@Nullable
private Vec3D startingToFallPosition;
@Nullable
@@ -261,6 +296,22 @@
@@ -259,6 +294,22 @@
private int containerCounter;
public boolean wonGame;
@@ -74,7 +74,7 @@
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, ClientInformation clientinformation) {
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
this.chatVisibility = EnumChatVisibility.FULL;
@@ -342,6 +393,13 @@
@@ -340,6 +391,13 @@
public void sendSystemMessage(IChatBaseComponent ichatbasecomponent) {
EntityPlayer.this.sendSystemMessage(ichatbasecomponent);
}
@@ -88,7 +88,7 @@
};
this.textFilter = minecraftserver.createTextFilterForPlayer(this);
this.gameMode = minecraftserver.createGameModeForPlayer(this);
@@ -354,14 +412,67 @@
@@ -352,14 +410,67 @@
this.moveTo(this.adjustSpawnLocation(worldserver, worldserver.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F);
this.updateOptions(clientinformation);
this.object = null;
@@ -157,7 +157,7 @@
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
@@ -397,14 +508,20 @@
@@ -395,14 +506,20 @@
Objects.requireNonNull(blockposition);
crashreportsystemdetails.setDetail("Origin", blockposition::toString);
@@ -180,7 +180,7 @@
});
throw new ReportedException(crashreport);
}
@@ -442,7 +559,7 @@
@@ -440,7 +557,7 @@
dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker")));
logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -189,7 +189,7 @@
this.wardenSpawnTracker = wardenspawntracker;
});
}
@@ -459,17 +576,26 @@
@@ -457,17 +574,26 @@
return this.server.getRecipeManager().byKey(resourcekey).isPresent();
});
}
@@ -217,7 +217,7 @@
Logger logger1 = EntityPlayer.LOGGER;
Objects.requireNonNull(logger1);
@@ -484,7 +610,7 @@
@@ -482,7 +608,7 @@
dataresult = BlockPosition.CODEC.parse(DynamicOpsNBT.INSTANCE, nbtbase);
logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -226,7 +226,7 @@
this.raidOmenPosition = blockposition;
});
}
@@ -494,7 +620,7 @@
@@ -492,7 +618,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -235,7 +235,7 @@
Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -528,6 +654,7 @@
@@ -526,6 +652,7 @@
nbttagcompound.put("SpawnDimension", nbtbase);
});
}
@@ -243,7 +243,7 @@
nbttagcompound.putBoolean("spawn_extra_particles_on_fall", this.spawnExtraParticlesOnFall);
if (this.raidOmenPosition != null) {
@@ -546,7 +673,20 @@
@@ -544,7 +671,20 @@
Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle();
@@ -265,7 +265,7 @@
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
@@ -600,12 +740,12 @@
@@ -598,12 +738,12 @@
if (!this.isPassenger()) {
EntityPlayer.LOGGER.warn("Couldn't reattach entity to player");
@@ -280,7 +280,7 @@
}
}
}
@@ -627,7 +767,7 @@
@@ -625,7 +765,7 @@
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
entityenderpearl.save(nbttagcompound1);
@@ -289,7 +289,7 @@
Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -653,7 +793,7 @@
@@ -651,7 +791,7 @@
nbttaglist.forEach((nbtbase1) -> {
if (nbtbase1 instanceof NBTTagCompound nbttagcompound) {
if (nbttagcompound.contains("ender_pearl_dimension")) {
@@ -298,7 +298,7 @@
Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -688,6 +828,29 @@
@@ -686,6 +826,29 @@
}
@@ -328,7 +328,7 @@
public void setExperiencePoints(int i) {
float f = (float) this.getXpNeededForNextLevel();
float f1 = (f - 1.0F) / f;
@@ -746,6 +909,11 @@
@@ -744,6 +907,11 @@
@Override
public void tick() {
@@ -337,10 +337,10 @@
+ this.joining = false;
+ }
+ // CraftBukkit end
this.tickClientLoadTimeout();
this.gameMode.tick();
this.wardenSpawnTracker.tick();
--this.spawnInvulnerableTime;
@@ -822,7 +990,7 @@
@@ -820,7 +988,7 @@
}
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
@@ -349,7 +349,7 @@
this.lastSentHealth = this.getHealth();
this.lastSentFood = this.foodData.getFoodLevel();
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
@@ -853,6 +1021,12 @@
@@ -851,6 +1019,12 @@
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
}
@@ -362,7 +362,7 @@
if (this.experienceLevel != this.lastRecordedLevel) {
this.lastRecordedLevel = this.experienceLevel;
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
@@ -867,6 +1041,20 @@
@@ -865,6 +1039,20 @@
CriterionTriggers.LOCATION.trigger(this);
}
@@ -383,7 +383,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
@@ -895,7 +1083,7 @@
@@ -893,7 +1081,7 @@
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.serverLevel().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.tickCount % 20 == 0) {
if (this.getHealth() < this.getMaxHealth()) {
@@ -392,7 +392,7 @@
}
float f = this.foodData.getSaturationLevel();
@@ -948,7 +1136,8 @@
@@ -946,7 +1134,8 @@
}
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
@@ -402,7 +402,7 @@
scoreaccess.set(i);
});
}
@@ -957,9 +1146,47 @@
@@ -955,9 +1144,47 @@
public void die(DamageSource damagesource) {
this.gameEvent(GameEvent.ENTITY_DIE);
boolean flag = this.serverLevel().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
@@ -452,7 +452,7 @@
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
boolean flag1 = true;
@@ -990,12 +1217,18 @@
@@ -988,12 +1215,18 @@
if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
this.tellNeutralMobsThatIDied();
}
@@ -475,10 +475,10 @@
EntityLiving entityliving = this.getKillCredit();
if (entityliving != null) {
@@ -1030,10 +1263,12 @@
@@ -1028,10 +1261,12 @@
public void awardKillScore(Entity entity, DamageSource damagesource) {
if (entity != this) {
super.awardKillScore(entity, i, damagesource);
this.increaseScore(i);
super.awardKillScore(entity, damagesource);
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_ALL, this, ScoreAccess::increment);
+ // CraftBukkit - Get our scores instead
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(IScoreboardCriteria.KILL_COUNT_ALL, this, ScoreAccess::increment);
@@ -490,7 +490,7 @@
} else {
this.awardStat(StatisticList.MOB_KILLS);
}
@@ -1051,7 +1286,8 @@
@@ -1049,7 +1284,8 @@
int i = scoreboardteam.getColor().getId();
if (i >= 0 && i < aiscoreboardcriteria.length) {
@@ -500,7 +500,7 @@
}
}
@@ -1101,10 +1337,16 @@
@@ -1093,10 +1329,16 @@
}
private boolean isPvpAllowed() {
@@ -519,7 +519,7 @@
BlockPosition blockposition = this.getRespawnPosition();
float f = this.getRespawnAngle();
boolean flag1 = this.isRespawnForced();
@@ -1116,13 +1358,32 @@
@@ -1108,13 +1350,32 @@
if (optional.isPresent()) {
EntityPlayer.RespawnPosAngle entityplayer_respawnposangle = (EntityPlayer.RespawnPosAngle) optional.get();
@@ -555,7 +555,7 @@
}
public static Optional<EntityPlayer.RespawnPosAngle> findRespawnAndUseSpawnBlock(WorldServer worldserver, BlockPosition blockposition, float f, boolean flag, boolean flag1) {
@@ -1137,11 +1398,11 @@
@@ -1129,11 +1390,11 @@
}
return optional.map((vec3d) -> {
@@ -569,7 +569,7 @@
});
} else if (!flag) {
return Optional.empty();
@@ -1150,7 +1411,7 @@
@@ -1142,7 +1403,7 @@
IBlockData iblockdata1 = worldserver.getBlockState(blockposition.above());
boolean flag3 = iblockdata1.getBlock().isPossibleToRespawnInThis(iblockdata1);
@@ -578,7 +578,7 @@
}
}
@@ -1168,6 +1429,7 @@
@@ -1160,6 +1421,7 @@
@Nullable
@Override
public EntityPlayer teleport(TeleportTransition teleporttransition) {
@@ -586,7 +586,7 @@
if (this.isRemoved()) {
return null;
} else {
@@ -1177,18 +1439,38 @@
@@ -1169,18 +1431,38 @@
WorldServer worldserver = teleporttransition.newLevel();
WorldServer worldserver1 = this.serverLevel();
@@ -628,7 +628,7 @@
this.isChangingDimension = true;
WorldData worlddata = worldserver.getLevelData();
@@ -1199,17 +1481,31 @@
@@ -1191,17 +1473,31 @@
playerlist.sendPlayerPermissionLevel(this);
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved();
@@ -662,7 +662,7 @@
this.connection.resetPosition();
worldserver.addDuringTeleport(this);
gameprofilerfiller.pop();
@@ -1223,11 +1519,29 @@
@@ -1215,11 +1511,29 @@
this.lastSentExp = -1;
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;
@@ -692,7 +692,7 @@
@Override
public void forceSetRotation(float f, float f1) {
this.connection.send(new ClientboundPlayerRotationPacket(f, f1));
@@ -1236,13 +1550,21 @@
@@ -1228,13 +1542,21 @@
public void triggerDimensionChangeTriggers(WorldServer worldserver) {
ResourceKey<World> resourcekey = worldserver.dimension();
ResourceKey<World> resourcekey1 = this.level().dimension();
@@ -717,7 +717,7 @@
this.enteredNetherPosition = null;
}
@@ -1259,19 +1581,17 @@
@@ -1251,19 +1573,17 @@
this.containerMenu.broadcastChanges();
}
@@ -741,7 +741,7 @@
if (this.level().isDay()) {
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_NOW);
} else {
@@ -1288,7 +1608,36 @@
@@ -1280,7 +1600,36 @@
}
}
@@ -779,7 +779,7 @@
this.awardStat(StatisticList.SLEEP_IN_BED);
CriterionTriggers.SLEPT_IN_BED.trigger(this);
});
@@ -1301,9 +1650,8 @@
@@ -1293,9 +1642,8 @@
return either;
}
}
@@ -790,7 +790,7 @@
}
@Override
@@ -1330,13 +1678,31 @@
@@ -1322,13 +1670,31 @@
@Override
public void stopSleepInBed(boolean flag, boolean flag1) {
@@ -823,7 +823,7 @@
}
}
@@ -1403,8 +1769,9 @@
@@ -1387,8 +1753,9 @@
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos(), flag));
}
@@ -834,7 +834,7 @@
}
@Override
@@ -1412,13 +1779,35 @@
@@ -1396,13 +1763,35 @@
if (itileinventory == null) {
return OptionalInt.empty();
} else {
@@ -870,7 +870,7 @@
if (container == null) {
if (this.isSpectator()) {
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
@@ -1426,9 +1815,11 @@
@@ -1410,9 +1799,11 @@
return OptionalInt.empty();
} else {
@@ -884,7 +884,7 @@
return OptionalInt.of(this.containerCounter);
}
}
@@ -1441,15 +1832,26 @@
@@ -1425,15 +1816,26 @@
@Override
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@@ -913,7 +913,7 @@
this.initMenu(this.containerMenu);
}
@@ -1472,6 +1874,7 @@
@@ -1456,6 +1858,7 @@
@Override
public void closeContainer() {
@@ -921,7 +921,7 @@
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
this.doCloseContainer();
}
@@ -1501,19 +1904,19 @@
@@ -1485,19 +1888,19 @@
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.awardStat(StatisticList.SWIM_ONE_CM, i);
@@ -944,7 +944,7 @@
}
} else if (this.onClimbable()) {
if (d1 > 0.0D) {
@@ -1524,13 +1927,13 @@
@@ -1508,13 +1911,13 @@
if (i > 0) {
if (this.isSprinting()) {
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
@@ -961,7 +961,7 @@
}
}
} else if (this.isFallFlying()) {
@@ -1573,7 +1976,7 @@
@@ -1557,7 +1960,7 @@
@Override
public void awardStat(Statistic<?> statistic, int i) {
this.stats.increment(this, statistic, i);
@@ -970,7 +970,7 @@
scoreaccess.add(i);
});
}
@@ -1581,7 +1984,7 @@
@@ -1565,7 +1968,7 @@
@Override
public void resetStat(Statistic<?> statistic) {
this.stats.setValue(this, statistic, 0);
@@ -979,7 +979,7 @@
}
@Override
@@ -1613,9 +2016,9 @@
@@ -1597,9 +2000,9 @@
super.jumpFromGround();
this.awardStat(StatisticList.JUMP);
if (this.isSprinting()) {
@@ -991,7 +991,7 @@
}
}
@@ -1641,6 +2044,7 @@
@@ -1625,6 +2028,7 @@
public void resetSentInfo() {
this.lastSentHealth = -1.0E8F;
@@ -999,7 +999,7 @@
}
@Override
@@ -1677,7 +2081,7 @@
@@ -1661,7 +2065,7 @@
this.onUpdateAbilities();
if (flag) {
this.getAttributes().assignBaseValues(entityplayer.getAttributes());
@@ -1008,7 +1008,7 @@
this.setHealth(entityplayer.getHealth());
this.foodData = entityplayer.foodData;
Iterator iterator = entityplayer.getActiveEffects().iterator();
@@ -1685,7 +2089,7 @@
@@ -1669,7 +2073,7 @@
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
@@ -1017,7 +1017,7 @@
}
this.getInventory().replaceWith(entityplayer.getInventory());
@@ -1696,7 +2100,7 @@
@@ -1680,7 +2084,7 @@
this.portalProcess = entityplayer.portalProcess;
} else {
this.getAttributes().assignBaseValues(entityplayer.getAttributes());
@@ -1026,7 +1026,7 @@
if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || entityplayer.isSpectator()) {
this.getInventory().replaceWith(entityplayer.getInventory());
this.experienceLevel = entityplayer.experienceLevel;
@@ -1712,7 +2116,7 @@
@@ -1696,7 +2100,7 @@
this.lastSentExp = -1;
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;
@@ -1035,16 +1035,16 @@
this.seenCredits = entityplayer.seenCredits;
this.enteredNetherPosition = entityplayer.enteredNetherPosition;
this.chunkTrackingView = entityplayer.chunkTrackingView;
@@ -1768,7 +2172,7 @@
@@ -1752,7 +2156,7 @@
}
@Override
- public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<Relative> set, float f, float f1, boolean flag) {
+ public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<Relative> set, float f, float f1, boolean flag, TeleportCause cause) { // CraftBukkit
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(BlockPosition.containing(d0, d1, d2));
worldserver.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkcoordintpair, 1, this.getId());
@@ -1780,7 +2184,7 @@
if (this.isSleeping()) {
this.stopSleepInBed(true, true);
}
@@ -1761,7 +2165,7 @@
this.setCamera(this);
}
@@ -1053,7 +1053,7 @@
if (flag1) {
this.setYHeadRot(set.contains(Relative.Y_ROT) ? this.getYHeadRot() + f : f);
@@ -1897,6 +2301,16 @@
@@ -1878,6 +2282,16 @@
}
public void updateOptions(ClientInformation clientinformation) {
@@ -1070,7 +1070,7 @@
this.language = clientinformation.language();
this.requestedViewDistance = clientinformation.viewDistance();
this.chatVisibility = clientinformation.chatVisibility();
@@ -1981,7 +2395,7 @@
@@ -1962,7 +2376,7 @@
if (world instanceof WorldServer) {
WorldServer worldserver = (WorldServer) world;
@@ -1079,7 +1079,7 @@
}
if (entity != null) {
@@ -2018,11 +2432,11 @@
@@ -1999,11 +2413,11 @@
@Nullable
public IChatBaseComponent getTabListDisplayName() {
@@ -1093,7 +1093,7 @@
}
@Override
@@ -2065,6 +2479,32 @@
@@ -2046,6 +2460,32 @@
}
public void setRespawnPosition(ResourceKey<World> resourcekey, @Nullable BlockPosition blockposition, float f, boolean flag, boolean flag1) {
@@ -1126,7 +1126,7 @@
if (blockposition != null) {
boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension);
@@ -2107,12 +2547,38 @@
@@ -2088,12 +2528,38 @@
}
@Override
@@ -1166,7 +1166,7 @@
this.level().addFreshEntity(entityitem);
ItemStack itemstack1 = entityitem.getItem();
@@ -2394,10 +2860,12 @@
@@ -2375,10 +2841,12 @@
return TicketType.ENDER_PEARL.timeout();
}
@@ -1182,7 +1182,7 @@
}
private static float calculateLookAtYaw(Vec3D vec3d, BlockPosition blockposition) {
@@ -2406,4 +2874,146 @@
@@ -2387,4 +2855,146 @@
return (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
}
}