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/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -173,11 +_,13 @@
@@ -174,11 +_,13 @@
import org.slf4j.Logger;
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, ChunkIOErrorReporter, CommandSource {
@@ -15,7 +15,7 @@
private static final int OVERLOADED_TICKS_THRESHOLD = 20;
private static final long OVERLOADED_WARNING_INTERVAL_NANOS = 10L * TimeUtil.NANOSECONDS_PER_SECOND;
private static final int OVERLOADED_TICKS_WARNING_INTERVAL = 100;
@@ -217,6 +_,7 @@
@@ -218,6 +_,7 @@
private Map<ResourceKey<Level>, ServerLevel> levels = Maps.newLinkedHashMap();
private PlayerList playerList;
private volatile boolean running = true;
@@ -23,7 +23,7 @@
private boolean stopped;
private int tickCount;
private int ticksUntilAutosave = 6000;
@@ -225,11 +_,15 @@
@@ -226,11 +_,15 @@
private boolean preventProxyConnections;
private boolean pvp;
private boolean allowFlight;
@@ -41,7 +41,7 @@
@Nullable
private KeyPair keyPair;
@Nullable
@@ -270,10 +_,37 @@
@@ -271,10 +_,37 @@
private final SuppressedExceptionCollector suppressedExceptions = new SuppressedExceptionCollector();
private final DiscontinuousFrame tickFrame;
@@ -80,7 +80,7 @@
if (Runtime.getRuntime().availableProcessors() > 4) {
thread.setPriority(8);
}
@@ -285,6 +_,10 @@
@@ -286,6 +_,10 @@
}
public MinecraftServer(
@@ -91,7 +91,7 @@
Thread serverThread,
LevelStorageSource.LevelStorageAccess storageSource,
PackRepository packRepository,
@@ -295,9 +_,10 @@
@@ -296,9 +_,10 @@
ChunkProgressListenerFactory progressListenerFactory
) {
super("Server");
@@ -103,7 +103,7 @@
throw new IllegalStateException("Missing Overworld dimension data");
} else {
this.proxy = proxy;
@@ -308,7 +_,7 @@
@@ -309,7 +_,7 @@
services.profileCache().setExecutor(this);
}
@@ -112,7 +112,7 @@
this.tickRateManager = new ServerTickRateManager(this);
this.progressListenerFactory = progressListenerFactory;
this.storageSource = storageSource;
@@ -327,6 +_,38 @@
@@ -328,6 +_,38 @@
this.fuelValues = FuelValues.vanillaBurnTimes(this.registries.compositeAccess(), this.worldData.enabledFeatures());
this.tickFrame = TracyClient.createDiscontinuousFrame("Server Tick");
}
@@ -151,7 +151,7 @@
}
private void readScoreboard(DimensionDataStorage dataStorage) {
@@ -335,18 +_,13 @@
@@ -336,18 +_,13 @@
protected abstract boolean initServer() throws IOException;
@@ -172,7 +172,7 @@
if (profiledDuration != null) {
profiledDuration.finish(true);
}
@@ -363,25 +_,265 @@
@@ -364,25 +_,265 @@
protected void forceDifficulty() {
}
@@ -457,7 +457,7 @@
if (!serverLevelData.isInitialized()) {
try {
setInitialSpawn(serverLevel, serverLevelData, worldOptions.generateBonusChest(), isDebugWorld);
@@ -402,47 +_,30 @@
@@ -403,47 +_,30 @@
serverLevelData.setInitialized(true);
}
@@ -522,7 +522,7 @@
int spawnHeight = chunkSource.getGenerator().getSpawnHeight(level);
if (spawnHeight < level.getMinY()) {
BlockPos worldPosition = chunkPos.getWorldPosition();
@@ -494,36 +_,48 @@
@@ -495,36 +_,48 @@
serverLevelData.setGameType(GameType.SPECTATOR);
}
@@ -582,7 +582,7 @@
}
public GameType getDefaultGameType() {
@@ -552,11 +_,14 @@
@@ -553,11 +_,14 @@
flag = true;
}
@@ -597,7 +597,7 @@
if (flush) {
for (ServerLevel serverLevel2 : this.getAllLevels()) {
LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", serverLevel2.getChunkSource().chunkMap.getStorageName());
@@ -586,18 +_,48 @@
@@ -587,18 +_,48 @@
this.stopServer();
}
@@ -647,7 +647,7 @@
}
LOGGER.info("Saving worlds");
@@ -639,6 +_,25 @@
@@ -640,6 +_,25 @@
} catch (IOException var4) {
LOGGER.error("Failed to unlock level {}", this.storageSource.getLevelId(), var4);
}
@@ -673,7 +673,7 @@
}
public String getLocalIp() {
@@ -654,6 +_,14 @@
@@ -655,6 +_,14 @@
}
public void halt(boolean waitForServer) {
@@ -688,7 +688,7 @@
this.running = false;
if (waitForServer) {
try {
@@ -664,6 +_,57 @@
@@ -665,6 +_,57 @@
}
}
@@ -746,7 +746,7 @@
protected void runServer() {
try {
if (!this.initServer()) {
@@ -674,6 +_,35 @@
@@ -675,6 +_,35 @@
this.statusIcon = this.loadStatusIcon().orElse(null);
this.status = this.buildServerStatus();
@@ -782,7 +782,7 @@
while (this.running) {
long l;
if (!this.isPaused() && this.tickRateManager.isSprinting() && this.tickRateManager.checkShouldSprintThisTick()) {
@@ -686,11 +_,30 @@
@@ -687,11 +_,30 @@
if (l1 > OVERLOADED_THRESHOLD_NANOS + 20L * l
&& this.nextTickTimeNanos - this.lastOverloadWarningNanos >= OVERLOADED_WARNING_INTERVAL_NANOS + 100L * l) {
long l2 = l1 / l;
@@ -813,7 +813,7 @@
boolean flag = l == 0L;
if (this.debugCommandProfilerDelayStart) {
@@ -698,6 +_,8 @@
@@ -699,6 +_,8 @@
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount);
}
@@ -822,7 +822,7 @@
this.nextTickTimeNanos += l;
try (Profiler.Scope scope = Profiler.use(this.createProfiler())) {
@@ -748,7 +_,7 @@
@@ -749,7 +_,7 @@
this.services.profileCache().clearExecutor();
}
@@ -831,7 +831,7 @@
}
}
}
@@ -800,7 +_,14 @@
@@ -801,7 +_,14 @@
}
private boolean haveTime() {
@@ -847,7 +847,7 @@
}
public static boolean throwIfFatalException() {
@@ -845,6 +_,12 @@
@@ -846,6 +_,12 @@
@Override
public TickTask wrapRunnable(Runnable runnable) {
@@ -860,7 +860,7 @@
return new TickTask(this.tickCount, runnable);
}
@@ -864,15 +_,16 @@
@@ -865,15 +_,16 @@
if (super.pollTask()) {
return true;
} else {
@@ -879,7 +879,7 @@
}
}
@@ -920,26 +_,44 @@
@@ -921,26 +_,44 @@
}
public void tickServer(BooleanSupplier hasTimeLeft) {
@@ -925,7 +925,7 @@
this.tickCount++;
this.tickRateManager.tick();
this.tickChildren(hasTimeLeft);
@@ -949,11 +_,19 @@
@@ -950,11 +_,19 @@
}
this.ticksUntilAutosave--;
@@ -946,7 +946,7 @@
profilerFiller.push("tallying");
long l = Util.getNanos() - nanos;
int i1 = this.tickCount % 100;
@@ -961,12 +_,17 @@
@@ -962,12 +_,17 @@
this.aggregatedTickTimesNanos += l;
this.tickTimesNanos[i1] = l;
this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float)l / (float)TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F;
@@ -965,7 +965,7 @@
LOGGER.debug("Autosave started");
ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push("save");
@@ -1008,7 +_,7 @@
@@ -1009,7 +_,7 @@
private ServerStatus buildServerStatus() {
ServerStatus.Players players = this.buildPlayerStatus();
return new ServerStatus(
@@ -974,7 +974,7 @@
Optional.of(players),
Optional.of(ServerStatus.Version.current()),
Optional.ofNullable(this.statusIcon),
@@ -1022,7 +_,7 @@
@@ -1023,7 +_,7 @@
if (this.hidesOnlinePlayers()) {
return new ServerStatus.Players(maxPlayers, players.size(), List.of());
} else {
@@ -983,7 +983,7 @@
ObjectArrayList<GameProfile> list = new ObjectArrayList<>(min);
int randomInt = Mth.nextInt(this.random, 0, players.size() - min);
@@ -1039,17 +_,66 @@
@@ -1040,17 +_,66 @@
protected void tickChildren(BooleanSupplier hasTimeLeft) {
ProfilerFiller profilerFiller = Profiler.get();
this.getPlayerList().getPlayers().forEach(serverPlayer1 -> serverPlayer1.connection.suspendFlushing());
@@ -1050,7 +1050,7 @@
profilerFiller.push("tick");
@@ -1063,7 +_,9 @@
@@ -1064,7 +_,9 @@
profilerFiller.pop();
profilerFiller.pop();
@@ -1060,7 +1060,7 @@
profilerFiller.popPush("connection");
this.tickConnection();
@@ -1141,6 +_,22 @@
@@ -1142,6 +_,22 @@
return this.levels.get(dimension);
}
@@ -1083,7 +1083,7 @@
public Set<ResourceKey<Level>> levelKeys() {
return this.levels.keySet();
}
@@ -1170,7 +_,7 @@
@@ -1171,7 +_,7 @@
@DontObfuscate
public String getServerModName() {
@@ -1092,7 +1092,7 @@
}
public SystemReport fillSystemReport(SystemReport systemReport) {
@@ -1205,7 +_,7 @@
@@ -1206,7 +_,7 @@
@Override
public void sendSystemMessage(Component component) {
@@ -1101,7 +1101,7 @@
}
public KeyPair getKeyPair() {
@@ -1243,11 +_,14 @@
@@ -1244,11 +_,14 @@
}
}
@@ -1121,7 +1121,7 @@
}
}
@@ -1257,7 +_,7 @@
@@ -1258,7 +_,7 @@
private void updateMobSpawningFlags() {
for (ServerLevel serverLevel : this.getAllLevels()) {
@@ -1130,7 +1130,7 @@
}
}
@@ -1333,10 +_,20 @@
@@ -1334,10 +_,20 @@
@Override
public String getMotd() {
@@ -1152,7 +1152,7 @@
this.motd = motd;
}
@@ -1359,7 +_,7 @@
@@ -1360,7 +_,7 @@
}
public ServerConnectionListener getConnection() {
@@ -1161,7 +1161,7 @@
}
public boolean isReady() {
@@ -1445,7 +_,7 @@
@@ -1446,7 +_,7 @@
@Override
public void executeIfPossible(Runnable task) {
if (this.isStopped()) {
@@ -1170,7 +1170,7 @@
} else {
super.executeIfPossible(task);
}
@@ -1484,7 +_,14 @@
@@ -1485,7 +_,14 @@
return this.functionManager;
}
@@ -1185,7 +1185,7 @@
CompletableFuture<Void> completableFuture = CompletableFuture.<ImmutableList>supplyAsync(
() -> selectedIds.stream().map(this.packRepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()),
this
@@ -1492,7 +_,7 @@
@@ -1493,7 +_,7 @@
.thenCompose(
list -> {
CloseableResourceManager closeableResourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, list);
@@ -1194,7 +1194,7 @@
return ReloadableServerResources.loadResources(
closeableResourceManager,
this.registries,
@@ -1513,20 +_,39 @@
@@ -1514,20 +_,39 @@
)
.thenAcceptAsync(
reloadableResources -> {
@@ -1236,7 +1236,7 @@
},
this
);
@@ -1543,7 +_,7 @@
@@ -1544,7 +_,7 @@
DataPackConfig dataPackConfig = initialDataConfig.dataPacks();
FeatureFlagSet featureFlagSet = initMode ? FeatureFlagSet.of() : initialDataConfig.enabledFeatures();
FeatureFlagSet featureFlagSet1 = initMode ? FeatureFlags.REGISTRY.allFlags() : initialDataConfig.enabledFeatures();
@@ -1245,7 +1245,7 @@
if (safeMode) {
return configureRepositoryWithSelection(packRepository, List.of("vanilla"), featureFlagSet, false);
} else {
@@ -1598,7 +_,7 @@
@@ -1599,7 +_,7 @@
private static WorldDataConfiguration configureRepositoryWithSelection(
PackRepository packRepository, Collection<String> selectedPacks, FeatureFlagSet enabledFeatures, boolean safeMode
) {
@@ -1254,7 +1254,7 @@
enableForcedFeaturePacks(packRepository, enabledFeatures);
DataPackConfig selectedPacks1 = getSelectedPacks(packRepository, safeMode);
FeatureFlagSet featureFlagSet = packRepository.getRequestedFeatureFlags().join(enabledFeatures);
@@ -1630,7 +_,7 @@
@@ -1631,7 +_,7 @@
}
}
@@ -1263,7 +1263,7 @@
}
}
@@ -1644,11 +_,12 @@
@@ -1645,11 +_,12 @@
public void kickUnlistedPlayers(CommandSourceStack commandSource) {
if (this.isEnforceWhitelist()) {
PlayerList playerList = commandSource.getServer().getPlayerList();
@@ -1278,7 +1278,7 @@
}
}
}
@@ -1852,6 +_,17 @@
@@ -1853,6 +_,17 @@
}
}
@@ -1296,7 +1296,7 @@
private ProfilerFiller createProfiler() {
if (this.willStartRecordingMetrics) {
this.metricsRecorder = ActiveMetricsRecorder.createStarted(
@@ -1973,16 +_,22 @@
@@ -1974,16 +_,22 @@
}
public void logChatMessage(Component content, ChatType.Bound boundChatType, @Nullable String header) {
@@ -1323,7 +1323,7 @@
}
public boolean logIPs() {
@@ -2115,4 +_,53 @@
@@ -2120,4 +_,53 @@
};
}
}