Update to Minecraft 1.19.4

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-03-15 03:30:00 +11:00
parent 90a887a912
commit 40076782ed
227 changed files with 2788 additions and 1621 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/EntityPlayer.java
+++ b/net/minecraft/server/level/EntityPlayer.java
@@ -150,6 +150,35 @@
@@ -155,6 +155,35 @@
import net.minecraft.world.scores.criteria.IScoreboardCriteria;
import org.slf4j.Logger;
@@ -36,7 +36,7 @@
public class EntityPlayer extends EntityHuman {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -207,6 +236,21 @@
@@ -212,6 +241,21 @@
public int latency;
public boolean wonGame;
@@ -58,9 +58,9 @@
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) {
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
this.chatVisibility = EnumChatVisibility.FULL;
@@ -270,12 +314,56 @@
@@ -275,12 +319,56 @@
this.advancements = minecraftserver.getPlayerList().getPlayerAdvancements(this);
this.maxUpStep = 1.0F;
this.setMaxUpStep(1.0F);
this.fudgeSpawnLocation(worldserver);
+
+ // CraftBukkit start
@@ -116,7 +116,7 @@
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
@@ -324,7 +412,7 @@
@@ -329,7 +417,7 @@
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.readAdditionalSaveData(nbttagcompound);
if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
@@ -125,7 +125,7 @@
Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -343,17 +431,26 @@
@@ -348,17 +436,26 @@
if (nbttagcompound.contains("recipeBook", 10)) {
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
}
@@ -153,7 +153,7 @@
Logger logger1 = EntityPlayer.LOGGER;
Objects.requireNonNull(logger1);
@@ -366,7 +463,7 @@
@@ -371,7 +468,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -162,7 +162,7 @@
Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -387,7 +484,20 @@
@@ -392,7 +489,20 @@
Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle();
@@ -184,7 +184,7 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
@@ -412,9 +522,33 @@
@@ -417,9 +527,33 @@
nbttagcompound.put("SpawnDimension", nbtbase);
});
}
@@ -218,7 +218,7 @@
public void setExperiencePoints(int i) {
float f = (float) this.getXpNeededForNextLevel();
float f1 = (f - 1.0F) / f;
@@ -473,6 +607,11 @@
@@ -478,6 +612,11 @@
@Override
public void tick() {
@@ -230,7 +230,7 @@
this.gameMode.tick();
this.wardenSpawnTracker.tick();
--this.spawnInvulnerableTime;
@@ -529,7 +668,7 @@
@@ -534,7 +673,7 @@
}
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
@@ -239,7 +239,7 @@
this.lastSentHealth = this.getHealth();
this.lastSentFood = this.foodData.getFoodLevel();
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
@@ -560,6 +699,12 @@
@@ -565,6 +704,12 @@
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
}
@@ -252,7 +252,7 @@
if (this.experienceLevel != this.lastRecordedLevel) {
this.lastRecordedLevel = this.experienceLevel;
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
@@ -574,6 +719,20 @@
@@ -579,6 +724,20 @@
CriterionTriggers.LOCATION.trigger(this);
}
@@ -273,7 +273,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
@@ -616,7 +775,8 @@
@@ -621,7 +780,8 @@
}
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
@@ -283,7 +283,7 @@
scoreboardscore.setScore(i);
});
}
@@ -625,9 +785,47 @@
@@ -630,9 +790,47 @@
public void die(DamageSource damagesource) {
this.gameEvent(GameEvent.ENTITY_DIE);
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
@@ -333,7 +333,7 @@
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
boolean flag1 = true;
@@ -658,12 +856,18 @@
@@ -663,12 +861,18 @@
if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
this.tellNeutralMobsThatIDied();
}
@@ -356,7 +356,7 @@
EntityLiving entityliving = this.getKillCredit();
if (entityliving != null) {
@@ -701,10 +905,12 @@
@@ -706,10 +910,12 @@
String s = this.getScoreboardName();
String s1 = entity.getScoreboardName();
@@ -371,7 +371,7 @@
} else {
this.awardStat(StatisticList.MOB_KILLS);
}
@@ -722,7 +928,8 @@
@@ -727,7 +933,8 @@
int i = scoreboardteam.getColor().getId();
if (i >= 0 && i < aiscoreboardcriteria.length) {
@@ -381,7 +381,7 @@
}
}
@@ -766,18 +973,20 @@
@@ -777,18 +984,20 @@
}
private boolean isPvpAllowed() {
@@ -405,7 +405,7 @@
} else {
return shapedetectorshape;
}
@@ -786,11 +995,20 @@
@@ -797,11 +1006,20 @@
@Nullable
@Override
public Entity changeDimension(WorldServer worldserver) {
@@ -429,7 +429,7 @@
this.unRide();
this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
if (!this.wonGame) {
@@ -801,6 +1019,8 @@
@@ -812,6 +1030,8 @@
return this;
} else {
@@ -438,7 +438,7 @@
WorldData worlddata = worldserver.getLevelData();
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation()));
@@ -810,20 +1030,50 @@
@@ -821,20 +1041,50 @@
playerlist.sendPlayerPermissionLevel(this);
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved();
@@ -455,7 +455,7 @@
this.enteredNetherPosition = this.position();
- } else if (worldserver.dimension() == World.END) {
+ } else if (worldserver.getTypeKey() == WorldDimension.END && shapedetectorshape.portalEventInfo != null && shapedetectorshape.portalEventInfo.getCanCreatePortal()) { // CraftBukkit
this.createEndPlatform(worldserver, new BlockPosition(shapedetectorshape.pos));
this.createEndPlatform(worldserver, BlockPosition.containing(shapedetectorshape.pos));
}
+ // CraftBukkit start
+ } else {
@@ -494,7 +494,7 @@
this.connection.resetPosition();
worldserver.addDuringPortalTeleport(this);
worldserver1.getProfiler().pop();
@@ -843,39 +1093,66 @@
@@ -854,39 +1104,66 @@
this.lastSentExp = -1;
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;
@@ -567,7 +567,7 @@
}
return optional1;
@@ -885,13 +1162,21 @@
@@ -896,13 +1173,21 @@
public void triggerDimensionChangeTriggers(WorldServer worldserver) {
ResourceKey<World> resourcekey = worldserver.dimension();
ResourceKey<World> resourcekey1 = this.level.dimension();
@@ -592,7 +592,7 @@
this.enteredNetherPosition = null;
}
@@ -908,12 +1193,10 @@
@@ -919,12 +1204,10 @@
this.containerMenu.broadcastChanges();
}
@@ -608,7 +608,7 @@
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
} else if (!this.bedInRange(blockposition, enumdirection)) {
return Either.left(EntityHuman.EnumBedResult.TOO_FAR_AWAY);
@@ -937,7 +1220,36 @@
@@ -948,7 +1231,36 @@
}
}
@@ -646,7 +646,7 @@
this.awardStat(StatisticList.SLEEP_IN_BED);
CriterionTriggers.SLEPT_IN_BED.trigger(this);
});
@@ -950,9 +1262,8 @@
@@ -961,9 +1273,8 @@
return either;
}
}
@@ -657,7 +657,7 @@
}
@Override
@@ -979,6 +1290,24 @@
@@ -990,6 +1301,24 @@
@Override
public void stopSleepInBed(boolean flag, boolean flag1) {
@@ -682,7 +682,7 @@
if (this.isSleeping()) {
this.getLevel().getChunkSource().broadcastAndSend(this, new PacketPlayOutAnimation(this, 2));
}
@@ -1060,8 +1389,9 @@
@@ -1038,8 +1367,9 @@
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos()));
}
@@ -693,7 +693,7 @@
}
@Override
@@ -1069,13 +1399,35 @@
@@ -1047,13 +1377,35 @@
if (itileinventory == null) {
return OptionalInt.empty();
} else {
@@ -729,7 +729,7 @@
if (container == null) {
if (this.isSpectator()) {
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
@@ -1083,9 +1435,11 @@
@@ -1061,9 +1413,11 @@
return OptionalInt.empty();
} else {
@@ -743,7 +743,7 @@
return OptionalInt.of(this.containerCounter);
}
}
@@ -1098,13 +1452,24 @@
@@ -1076,13 +1430,24 @@
@Override
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@@ -770,7 +770,7 @@
this.initMenu(this.containerMenu);
}
@@ -1127,6 +1492,7 @@
@@ -1105,6 +1470,7 @@
@Override
public void closeContainer() {
@@ -778,7 +778,7 @@
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
this.doCloseContainer();
}
@@ -1157,7 +1523,7 @@
@@ -1135,7 +1501,7 @@
@Override
public void awardStat(Statistic<?> statistic, int i) {
this.stats.increment(this, statistic, i);
@@ -787,7 +787,7 @@
scoreboardscore.add(i);
});
}
@@ -1165,7 +1531,7 @@
@@ -1143,7 +1509,7 @@
@Override
public void resetStat(Statistic<?> statistic) {
this.stats.setValue(this, statistic, 0);
@@ -796,7 +796,7 @@
}
@Override
@@ -1181,7 +1547,7 @@
@@ -1159,7 +1525,7 @@
for (int j = 0; j < i; ++j) {
MinecraftKey minecraftkey = aminecraftkey1[j];
@@ -805,7 +805,7 @@
Objects.requireNonNull(list);
optional.ifPresent(list::add);
@@ -1216,6 +1582,7 @@
@@ -1194,6 +1560,7 @@
public void resetSentInfo() {
this.lastSentHealth = -1.0E8F;
@@ -813,7 +813,7 @@
}
@Override
@@ -1274,7 +1641,7 @@
@@ -1252,7 +1619,7 @@
this.lastSentExp = -1;
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;
@@ -822,8 +822,33 @@
this.seenCredits = entityplayer.seenCredits;
this.enteredNetherPosition = entityplayer.enteredNetherPosition;
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
@@ -1415,7 +1782,20 @@
return s;
@@ -1302,6 +1669,12 @@
@Override
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
+ // CraftBukkit start
+ return teleportTo(worldserver, 0, 0, 0, set, 0, 0, TeleportCause.UNKNOWN);
+ }
+
+ public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1, TeleportCause cause) {
+ // CraftBukkit end
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(BlockPosition.containing(d0, d1, d2));
worldserver.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkcoordintpair, 1, this.getId());
@@ -1311,9 +1684,9 @@
}
if (worldserver == this.level) {
- this.connection.teleport(d0, d1, d2, f, f1, set);
+ this.connection.teleport(d0, d1, d2, f, f1, set, cause); // CraftBukkit
} else {
- this.teleportTo(worldserver, d0, d1, d2, f, f1);
+ this.teleportTo(worldserver, d0, d1, d2, f, f1, cause); // CraftBukkit
}
this.setYHeadRot(f);
@@ -1417,7 +1790,20 @@
}
}
+ public String locale = "en_us"; // CraftBukkit - add, lowercase
@@ -843,16 +868,16 @@
this.chatVisibility = packetplayinsettings.chatVisibility();
this.canChatColor = packetplayinsettings.chatColors();
this.textFilteringEnabled = packetplayinsettings.textFilteringEnabled();
@@ -1486,7 +1866,7 @@
this.camera = (Entity) (entity == null ? this : entity);
if (entity1 != this.camera) {
this.connection.send(new PacketPlayOutCamera(this.camera));
- this.connection.teleport(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.getYRot(), this.getXRot());
+ this.connection.teleport(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.getYRot(), this.getXRot(), TeleportCause.SPECTATE); // CraftBukkit
this.connection.resetPosition();
}
@@ -1492,7 +1878,7 @@
if (world instanceof WorldServer) {
WorldServer worldserver = (WorldServer) world;
@@ -1516,7 +1896,7 @@
- this.teleportTo(worldserver, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot());
+ this.teleportTo(worldserver, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot(), TeleportCause.SPECTATE); // CraftBukkit
}
if (entity != null) {
@@ -1529,7 +1915,7 @@
@Nullable
public IChatBaseComponent getTabListDisplayName() {
@@ -861,7 +886,7 @@
}
@Override
@@ -1537,9 +1917,16 @@
@@ -1550,9 +1936,16 @@
return this.advancements;
}
@@ -878,7 +903,7 @@
if (worldserver == this.level) {
this.connection.teleport(d0, d1, d2, f, f1);
} else {
@@ -1559,6 +1946,9 @@
@@ -1572,6 +1965,9 @@
this.server.getPlayerList().sendLevelInfo(this, worldserver);
this.server.getPlayerList().sendAllPlayerInfo(this);
}
@@ -888,9 +913,9 @@
}
@@ -1743,4 +2133,146 @@
public RemoteChatSession getChatSession() {
return this.chatSession;
@@ -1762,4 +2158,146 @@
this.hurtDir = (float) (MathHelper.atan2(d1, d0) * 57.2957763671875D - (double) this.getYRot());
this.connection.send(new ClientboundHurtAnimationPacket(this));
}
+
+ // CraftBukkit start - Add per-player time and weather.

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/EntityTrackerEntry.java
+++ b/net/minecraft/server/level/EntityTrackerEntry.java
@@ -42,6 +42,12 @@
@@ -44,6 +44,12 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -13,7 +13,7 @@
public class EntityTrackerEntry {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -63,8 +69,12 @@
@@ -65,8 +71,12 @@
private boolean wasOnGround;
@Nullable
private List<DataWatcher.b<?>> trackedDataValues;
@@ -27,16 +27,16 @@
this.ap = Vec3D.ZERO;
this.lastPassengers = Collections.emptyList();
this.level = worldserver;
@@ -85,7 +95,7 @@
@@ -86,7 +96,7 @@
List<Entity> list = this.entity.getPassengers();
if (!list.equals(this.lastPassengers)) {
this.lastPassengers = list;
- this.broadcast.accept(new PacketPlayOutMount(this.entity));
+ this.broadcastAndSend(new PacketPlayOutMount(this.entity)); // CraftBukkit
}
Entity entity = this.entity;
@@ -93,18 +103,18 @@
this.changedPassengers(list, this.lastPassengers).forEach((entity) -> {
if (entity instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) entity;
@@ -105,18 +115,18 @@
if (entity instanceof EntityItemFrame) {
EntityItemFrame entityitemframe = (EntityItemFrame) entity;
@@ -59,7 +59,7 @@
worldmap.tickCarriedBy(entityplayer, itemstack);
Packet<?> packet = worldmap.getUpdatePacket(integer, entityplayer);
@@ -209,7 +219,27 @@
@@ -229,7 +239,27 @@
++this.tickCount;
if (this.entity.hurtMarked) {
@@ -88,17 +88,18 @@
this.entity.hurtMarked = false;
}
@@ -224,13 +254,16 @@
PlayerConnection playerconnection = entityplayer.connection;
@@ -252,14 +282,17 @@
List<Packet<PacketListenerPlayOut>> list = new ArrayList();
Objects.requireNonNull(entityplayer.connection);
- this.sendPairingData(playerconnection::send);
+ this.sendPairingData(playerconnection::send, entityplayer); // CraftBukkit - add player
Objects.requireNonNull(list);
- this.sendPairingData(list::add);
+ this.sendPairingData(list::add, entityplayer); // CraftBukkit - add player
entityplayer.connection.send(new ClientboundBundlePacket(list));
this.entity.startSeenByPlayer(entityplayer);
}
- public void sendPairingData(Consumer<Packet<?>> consumer) {
+ public void sendPairingData(Consumer<Packet<?>> consumer, EntityPlayer entityplayer) { // CraftBukkit - add player
- public void sendPairingData(Consumer<Packet<PacketListenerPlayOut>> consumer) {
+ public void sendPairingData(Consumer<Packet<PacketListenerPlayOut>> consumer, EntityPlayer entityplayer) { // CraftBukkit - add player
if (this.entity.isRemoved()) {
- EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity {}", this.entity);
+ // CraftBukkit start - Remove useless error spam, just return
@@ -108,7 +109,7 @@
}
Packet<PacketListenerPlayOut> packet = this.entity.getAddEntityPacket();
@@ -246,6 +279,12 @@
@@ -275,6 +308,12 @@
if (this.entity instanceof EntityLiving) {
Collection<AttributeModifiable> collection = ((EntityLiving) this.entity).getAttributes().getSyncableAttributes();
@@ -121,7 +122,7 @@
if (!collection.isEmpty()) {
consumer.accept(new PacketPlayOutUpdateAttributes(this.entity.getId(), collection));
}
@@ -277,8 +316,14 @@
@@ -306,8 +345,14 @@
if (!list.isEmpty()) {
consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list));
}
@@ -136,7 +137,7 @@
if (this.entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) this.entity;
Iterator iterator = entityliving.getActiveEffects().iterator();
@@ -321,6 +366,11 @@
@@ -350,6 +395,11 @@
Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributes().getDirtyAttributes();
if (!set.isEmpty()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/PlayerChunkMap.java
+++ b/net/minecraft/server/level/PlayerChunkMap.java
@@ -106,6 +106,12 @@
@@ -109,6 +109,12 @@
import org.apache.commons.lang3.mutable.MutableObject;
import org.slf4j.Logger;
@@ -13,7 +13,7 @@
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.e {
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
@@ -149,6 +155,27 @@
@@ -152,6 +158,27 @@
private final Queue<Runnable> unloadQueue;
int viewDistance;
@@ -41,7 +41,7 @@
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, StructureTemplateManager structuretemplatemanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
super(convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag);
this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -167,6 +194,11 @@
@@ -170,6 +197,11 @@
this.storageName = path.getFileName().toString();
this.level = worldserver;
this.generator = chunkgenerator;
@@ -53,7 +53,7 @@
IRegistryCustom iregistrycustom = worldserver.registryAccess();
long j = worldserver.getSeed();
@@ -326,9 +358,12 @@
@@ -329,9 +361,12 @@
CompletableFuture<List<Either<IChunkAccess, PlayerChunk.Failure>>> completablefuture1 = SystemUtils.sequence(list);
CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> {
List<IChunkAccess> list3 = Lists.newArrayList();
@@ -68,7 +68,7 @@
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
if (either == null) {
@@ -533,7 +568,7 @@
@@ -536,7 +571,7 @@
private void scheduleUnload(long i, PlayerChunk playerchunk) {
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave();
@@ -77,7 +77,7 @@
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave();
if (completablefuture1 != completablefuture) {
@@ -622,9 +657,9 @@
@@ -625,9 +660,9 @@
ProtoChunk protochunk = ChunkRegionLoader.read(this.level, this.poiManager, chunkcoordintpair, (NBTTagCompound) optional.get());
this.markPosition(chunkcoordintpair, protochunk.getStatus().getChunkType());
@@ -89,7 +89,7 @@
}
}, this.mainThreadExecutor).exceptionallyAsync((throwable) -> {
return this.handleChunkLoadFailure(throwable, chunkcoordintpair);
@@ -730,7 +765,21 @@
@@ -733,7 +768,21 @@
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
if (!list.isEmpty()) {
@@ -112,7 +112,7 @@
}
}
@@ -829,7 +878,7 @@
@@ -832,7 +881,7 @@
if (!playerchunk.wasAccessibleSinceLastSave()) {
return false;
} else {
@@ -121,7 +121,7 @@
if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) {
return false;
@@ -991,7 +1040,8 @@
@@ -994,7 +1043,8 @@
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
});
@@ -131,7 +131,7 @@
return chunk.getBlockEntities().size();
}).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> {
return chunk.getBlockTicks().count();
@@ -1004,7 +1054,7 @@
@@ -1007,7 +1057,7 @@
private static String printFuture(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
try {
@@ -140,7 +140,7 @@
return either != null ? (String) either.map((chunk) -> {
return "done";
@@ -1020,12 +1070,14 @@
@@ -1023,12 +1073,14 @@
private CompletableFuture<Optional<NBTTagCompound>> readChunk(ChunkCoordIntPair chunkcoordintpair) {
return this.read(chunkcoordintpair).thenApplyAsync((optional) -> {
@@ -158,7 +158,7 @@
}
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
@@ -1471,7 +1523,7 @@
@@ -1482,7 +1534,7 @@
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
public EntityTracker(Entity entity, int i, int j, boolean flag) {
@@ -167,7 +167,7 @@
this.entity = entity;
this.range = i;
this.lastSectionPos = SectionPosition.of((EntityAccess) entity);
@@ -1530,6 +1582,11 @@
@@ -1541,6 +1593,11 @@
double d2 = d0 * d0;
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(entityplayer);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/WorldServer.java
+++ b/net/minecraft/server/level/WorldServer.java
@@ -156,6 +156,26 @@
@@ -159,6 +159,26 @@
import net.minecraft.world.ticks.TickListServer;
import org.slf4j.Logger;
@@ -27,7 +27,7 @@
public class WorldServer extends World implements GeneratorAccessSeed {
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
@@ -173,7 +193,7 @@
@@ -172,7 +192,7 @@
final List<EntityPlayer> players;
private final ChunkProviderServer chunkSource;
private final MinecraftServer server;
@@ -36,11 +36,12 @@
final EntityTickList entityTickList;
public final PersistentEntitySectionManager<Entity> entityManager;
private final GameEventDispatcher gameEventDispatcher;
@@ -197,11 +217,28 @@
@@ -196,12 +216,30 @@
private final StructureCheck structureCheck;
private final boolean tickTime;
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
- IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess();
- Holder holder = worlddimension.type();
+ // CraftBukkit start
+ public final Convertable.ConversionSession convertable;
@@ -56,12 +57,14 @@
+ }
- Objects.requireNonNull(minecraftserver);
- super(iworlddataserver, resourcekey, holder, minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates());
- super(iworlddataserver, resourcekey, iregistrycustom_dimension, holder, minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates());
+ // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, WorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
+ // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error
+ // Holder holder = worlddimension.type(); // CraftBukkit - decompile error
+
+ // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
+ super(iworlddataserver, resourcekey, worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
+ super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
+ this.pvpMode = minecraftserver.isPvpAllowed();
+ convertable = convertable_conversionsession;
+ uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
@@ -69,7 +72,7 @@
this.players = Lists.newArrayList();
this.entityTickList = new EntityTickList();
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
@@ -215,6 +252,22 @@
@@ -215,6 +253,22 @@
this.customSpawners = list;
this.serverLevelData = iworlddataserver;
ChunkGenerator chunkgenerator = worlddimension.generator();
@@ -92,7 +95,7 @@
boolean flag2 = minecraftserver.forceSynchronousWrites();
DataFixer datafixer = minecraftserver.getFixerUpper();
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
@@ -246,15 +299,16 @@
@@ -246,15 +300,16 @@
long l = minecraftserver.getWorldData().worldGenOptions().seed();
this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer);
@@ -112,7 +115,7 @@
}
public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) {
@@ -286,12 +340,20 @@
@@ -286,12 +341,20 @@
long j;
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
@@ -136,7 +139,7 @@
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
this.resetWeatherCycle();
}
@@ -317,7 +379,7 @@
@@ -317,7 +380,7 @@
this.runBlockEvents();
this.handlingTick = false;
gameprofilerfiller.pop();
@@ -145,7 +148,7 @@
if (flag) {
this.resetEmptyTime();
@@ -333,7 +395,7 @@
@@ -333,7 +396,7 @@
this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) {
@@ -154,7 +157,7 @@
entity.discard();
} else {
gameprofilerfiller.push("checkDespawn");
@@ -405,7 +467,7 @@
@@ -405,7 +468,7 @@
private void wakeUpAllPlayers() {
this.sleepStatus.removeAllSleepers();
@@ -163,7 +166,7 @@
entityplayer.stopSleepInBed(false, false);
});
}
@@ -433,7 +495,7 @@
@@ -433,7 +496,7 @@
entityhorseskeleton.setTrap(true);
entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@@ -172,7 +175,7 @@
}
}
@@ -442,7 +504,7 @@
@@ -442,7 +505,7 @@
if (entitylightning != null) {
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
entitylightning.setVisualOnly(flag1);
@@ -181,7 +184,7 @@
}
}
}
@@ -456,7 +518,7 @@
@@ -456,7 +519,7 @@
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition).value();
if (biomebase.shouldFreeze(this, blockposition1)) {
@@ -190,7 +193,7 @@
}
if (flag) {
@@ -471,10 +533,10 @@
@@ -471,10 +534,10 @@
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, l + 1);
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition);
@@ -203,7 +206,7 @@
}
}
@@ -671,6 +733,7 @@
@@ -670,6 +733,7 @@
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
}
@@ -211,7 +214,7 @@
if (this.oRainLevel != this.rainLevel) {
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
}
@@ -689,14 +752,47 @@
@@ -688,14 +752,47 @@
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
}
@@ -261,7 +264,7 @@
}
public void resetEmptyTime() {
@@ -731,6 +827,7 @@
@@ -730,6 +827,7 @@
});
gameprofilerfiller.incrementCounter("tickNonPassenger");
entity.tick();
@@ -269,7 +272,7 @@
this.getProfiler().pop();
Iterator iterator = entity.getPassengers().iterator();
@@ -754,6 +851,7 @@
@@ -753,6 +851,7 @@
});
gameprofilerfiller.incrementCounter("tickPassenger");
entity1.rideTick();
@@ -277,7 +280,7 @@
gameprofilerfiller.pop();
Iterator iterator = entity1.getPassengers().iterator();
@@ -778,6 +876,7 @@
@@ -777,6 +876,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkSource();
if (!flag1) {
@@ -285,7 +288,7 @@
if (iprogressupdate != null) {
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
}
@@ -795,11 +894,19 @@
@@ -794,11 +894,19 @@
}
}
@@ -306,7 +309,7 @@
}
this.getChunkSource().getDataStorage().save();
@@ -864,15 +971,37 @@
@@ -863,15 +971,37 @@
@Override
public boolean addFreshEntity(Entity entity) {
@@ -347,7 +350,7 @@
}
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
@@ -903,24 +1032,37 @@
@@ -902,24 +1032,37 @@
this.entityManager.addNewEntity(entityplayer);
}
@@ -389,7 +392,7 @@
return true;
}
}
@@ -934,10 +1076,32 @@
@@ -933,10 +1076,32 @@
entityplayer.remove(entity_removalreason);
}
@@ -422,7 +425,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -946,6 +1110,12 @@
@@ -945,6 +1110,12 @@
double d1 = (double) blockposition.getY() - entityplayer.getY();
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
@@ -435,7 +438,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
}
@@ -1005,7 +1175,18 @@
@@ -1004,7 +1175,18 @@
Iterator iterator = this.navigatingMobs.iterator();
while (iterator.hasNext()) {
@@ -455,7 +458,7 @@
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
if (navigationabstract.shouldRecomputePath(blockposition)) {
@@ -1062,6 +1243,11 @@
@@ -1066,6 +1248,11 @@
@Override
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, World.a world_a) {
Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false);
@@ -467,7 +470,7 @@
if (!explosion.interactsWithBlocks()) {
explosion.clearToBlow();
@@ -1134,13 +1320,20 @@
@@ -1138,13 +1325,20 @@
}
public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
@@ -490,7 +493,7 @@
++j;
}
}
@@ -1191,7 +1384,7 @@
@@ -1195,7 +1389,7 @@
@Nullable
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
@@ -499,7 +502,7 @@
return null;
} else {
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
@@ -1233,11 +1426,21 @@
@@ -1232,11 +1426,21 @@
@Nullable
@Override
public WorldMap getMapData(String s) {
@@ -522,7 +525,7 @@
this.getServer().overworld().getDataStorage().set(s, worldmap);
}
@@ -1535,6 +1738,11 @@
@@ -1534,6 +1738,11 @@
@Override
public void blockUpdated(BlockPosition blockposition, Block block) {
if (!this.isDebug()) {
@@ -534,7 +537,7 @@
this.updateNeighborsAt(blockposition, block);
}
@@ -1554,12 +1762,12 @@
@@ -1553,12 +1762,12 @@
}
public boolean isFlat() {
@@ -549,7 +552,7 @@
}
@Nullable
@@ -1582,7 +1790,7 @@
@@ -1581,7 +1790,7 @@
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
try {
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
@@ -558,7 +561,7 @@
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1591,7 +1799,7 @@
@@ -1590,7 +1799,7 @@
object2intopenhashmap.addTo(s, 1);
}
@@ -567,7 +570,7 @@
String s1 = (String) entry.getKey();
return s1 + ":" + entry.getIntValue();
@@ -1602,17 +1810,33 @@
@@ -1601,17 +1810,33 @@
}
public static void makeObsidianPlatform(WorldServer worldserver) {
@@ -603,7 +606,7 @@
}
@Override
@@ -1728,6 +1952,7 @@
@@ -1727,6 +1952,7 @@
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
@@ -611,7 +614,7 @@
}
public void onTrackingEnd(Entity entity) {
@@ -1764,6 +1989,14 @@
@@ -1763,6 +1989,14 @@
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);