|
9 | 9 | import net.minecraft.CrashReport; |
10 | 10 | import net.minecraft.CrashReportCategory; |
11 | 11 | import net.minecraft.ReportType; |
12 | | -@@ -186,10 +_,15 @@ |
| 12 | +@@ -186,11 +_,16 @@ |
13 | 13 | import net.minecraft.world.phys.Vec2; |
14 | 14 | import net.minecraft.world.phys.Vec3; |
15 | 15 | import net.minecraft.world.scores.ScoreboardSaveData; |
|
22 | 22 | +import org.teneted.neotenet.injection.server.MinecraftServerInjection; |
23 | 23 |
|
24 | 24 | -public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, ServerInfo, ChunkIOErrorReporter { |
| 25 | +- private static final Logger LOGGER = LogUtils.getLogger(); |
25 | 26 | +public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, ServerInfo, ChunkIOErrorReporter, MinecraftServerInjection { |
26 | | - public static final Logger LOGGER = LogUtils.getLogger(); |
| 27 | ++ public static final Logger LOGGER = LogUtils.getLogger(); |
27 | 28 | public static final String VANILLA_BRAND = "vanilla"; |
28 | 29 | private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F; |
| 30 | + private static final int TICK_STATS_SPAN = 100; |
| 31 | +@@ -214,8 +_,8 @@ |
| 32 | + public static final Supplier<GameRules> DEFAULT_GAME_RULES = () -> new GameRules(WorldDataConfiguration.DEFAULT.enabledFeatures()); |
| 33 | + public static final NameAndId ANONYMOUS_PLAYER_PROFILE = new NameAndId(Util.NIL_UUID, "Anonymous Player"); |
| 34 | + public static final String SERVER_THREAD_NAME = "Server thread"; |
| 35 | +- protected final LevelStorageSource.LevelStorageAccess storageSource; |
| 36 | +- protected final PlayerDataStorage playerDataStorage; |
| 37 | ++ public LevelStorageSource.LevelStorageAccess storageSource; |
| 38 | ++ public final PlayerDataStorage playerDataStorage; |
| 39 | + private final SavedDataStorage savedDataStorage; |
| 40 | + private final List<Runnable> tickables = Lists.newArrayList(); |
| 41 | + private final GameRules gameRules; |
| 42 | +@@ -225,16 +_,16 @@ |
| 43 | + private boolean willStartRecordingMetrics; |
| 44 | + private MinecraftServer.@Nullable TimeProfiler debugCommandProfiler; |
| 45 | + private boolean debugCommandProfilerDelayStart; |
| 46 | +- private final ServerConnectionListener connection; |
| 47 | +- private final LevelLoadListener levelLoadListener; |
| 48 | ++ private ServerConnectionListener connection; |
| 49 | ++ public final LevelLoadListener levelLoadListener; |
| 50 | + private @Nullable ServerStatus status; |
| 51 | + private ServerStatus.@Nullable Favicon statusIcon; |
| 52 | + private final RandomSource random = RandomSource.create(); |
| 53 | +- private final DataFixer fixerUpper; |
| 54 | ++ public final DataFixer fixerUpper; |
| 55 | + private String localIp; |
| 56 | + private int port = -1; |
| 57 | + private final LayeredRegistryAccess<RegistryLayer> registries; |
| 58 | +- private final Map<ResourceKey<Level>, ServerLevel> levels = Maps.newLinkedHashMap(); |
| 59 | ++ private Map<ResourceKey<Level>, ServerLevel> levels = Maps.newLinkedHashMap(); |
| 60 | + private PlayerList playerList; |
| 61 | + private volatile boolean running = true; |
| 62 | + private boolean stopped; |
| 63 | +@@ -256,7 +_,7 @@ |
| 64 | + private final NotificationManager notificationManager; |
| 65 | + private final ServerActivityMonitor serverActivityMonitor; |
| 66 | + private long lastServerStatus; |
| 67 | +- private final Thread serverThread; |
| 68 | ++ public final Thread serverThread; |
| 69 | + private long lastTickNanos = Util.getNanos(); |
| 70 | + private long taskExecutionStartNanos = Util.getNanos(); |
| 71 | + private long idleTimeNanos; |
| 72 | +@@ -276,13 +_,13 @@ |
| 73 | + private boolean enforceWhitelist; |
| 74 | + private boolean usingWhitelist; |
| 75 | + private float smoothedTickTimeMillis; |
| 76 | +- private final Executor executor; |
| 77 | ++ public final Executor executor; |
| 78 | + private @Nullable String serverId; |
| 79 | +- private MinecraftServer.ReloadableResources resources; |
| 80 | ++ public MinecraftServer.ReloadableResources resources; |
| 81 | + private final StructureTemplateManager structureTemplateManager; |
| 82 | + private final ServerTickRateManager tickRateManager; |
| 83 | + private final ServerDebugSubscribers debugSubscribers = new ServerDebugSubscribers(this); |
| 84 | +- protected final WorldData worldData; |
| 85 | ++ protected WorldData worldData; |
| 86 | + private LevelData.RespawnData effectiveRespawnData = LevelData.RespawnData.DEFAULT; |
| 87 | + private final PotionBrewing potionBrewing; |
| 88 | + private FuelValues fuelValues; |
29 | 89 | @@ -293,10 +_,21 @@ |
30 | 90 | private final PacketProcessor packetProcessor; |
31 | 91 | private final TimerQueue<MinecraftServer> scheduledEvents; |
|
85 | 145 | ChunkPos spawnChunk = ChunkPos.containing(chunkSource.randomState().sampler().findSpawnPosition()); |
86 | 146 | levelLoadListener.start(LevelLoadListener.Stage.PREPARE_GLOBAL_SPAWN, 0); |
87 | 147 | levelLoadListener.updateFocus(level.dimension(), spawnChunk); |
| 148 | +@@ -542,7 +_,7 @@ |
| 149 | + levelData.setGameType(GameType.SPECTATOR); |
| 150 | + } |
| 151 | + |
| 152 | +- private void prepareLevels() { |
| 153 | ++ public void prepareLevels() { |
| 154 | + ChunkLoadCounter chunkLoadCounter = new ChunkLoadCounter(); |
| 155 | + |
| 156 | + for (ServerLevel level : this.levels.values()) { |
88 | 157 | @@ -550,6 +_,7 @@ |
89 | 158 | TicketStorage savedTickets = level.getDataStorage().get(TicketStorage.TYPE); |
90 | 159 | if (savedTickets != null) { |
|
0 commit comments