类 MinecraftServer
java.lang.Object
net.minecraft.util.thread.BlockableEventLoop<R>
net.minecraft.util.thread.ReentrantBlockableEventLoop<TickTask>
net.minecraft.server.MinecraftServer
- 所有已实现的接口:
AutoCloseable
,Executor
,CommandSource
,ProfilerMeasured
,ProcessorHandle<TickTask>
- 直接已知子类:
DedicatedServer
,GameTestServer
,IntegratedServer
public abstract class MinecraftServer
extends ReentrantBlockableEventLoop<TickTask>
implements CommandSource, AutoCloseable
-
嵌套类概要
嵌套类修饰符和类型类说明static final record
static final record
(专用程序包) static class
-
字段概要
字段修饰符和类型字段说明static final int
private boolean
static final com.mojang.authlib.GameProfile
private static final int
private static final float
private float
private String
private CommandStorage
private final ServerConnectionListener
private final CustomBossEvents
private MinecraftServer.TimeProfiler
private boolean
private static final long
private long
static final LevelSettings
private boolean
private final Executor
private final com.mojang.datafixers.DataFixer
private final FrameTimer
private final ServerFunctionManager
private static final com.google.gson.Gson
private boolean
private boolean
private boolean
private KeyPair
private long
private long
private final Map<ResourceKey<Level>,
ServerLevel> private String
private static final org.slf4j.Logger
private static final int
private static final int
private boolean
private MetricsRecorder
private String
static final int
protected long
private boolean
private Consumer<ProfileResults>
private static final int
private static final int
private final PackRepository
private Map<ResourceKey<Level>,
long[]> protected final PlayerDataStorage
private int
private PlayerList
private int
private boolean
private ProfilerFiller
private final ChunkProgressListenerFactory
protected final Proxy
private boolean
private final RandomSource
private final LayeredRegistryAccess<RegistryLayer>
private boolean
private final ServerScoreboard
private String
private final Thread
protected final Services
private com.mojang.authlib.GameProfile
static final int
private static final int
private ServerStatus
private static final long
private ServerStatus.Favicon
private boolean
protected final LevelStorageSource.LevelStorageAccess
private final StructureTemplateManager
private static final int
private int
final long[]
static final String
private boolean
private ServerLevel[]
private int
private int
protected final WorldData
从接口继承的字段 net.minecraft.commands.CommandSource
NULL
-
构造器概要
构造器构造器说明MinecraftServer
(Thread pServerThread, LevelStorageSource.LevelStorageAccess pStorageSource, PackRepository pPackRepository, WorldStem pWorldStem, Proxy pProxy, com.mojang.datafixers.DataFixer pFixerUpper, Services pServices, ChunkProgressListenerFactory pProgressListenerFactory) -
方法概要
修饰符和类型方法说明boolean
boolean
void
addTickable
(Runnable pTickable) boolean
private ServerStatus.Players
private ServerStatus
void
void
close()
static WorldDataConfiguration
configurePackRepository
(PackRepository pPackRepository, DataPackConfig pDataPackConfig, boolean pSafeMode, FeatureFlagSet pEnabledFeatures) private static CrashReport
createGameModeForPlayer
(ServerPlayer pPlayer) protected void
createLevels
(ChunkProgressListener pListener) createTextFilterForPlayer
(ServerPlayer pPlayer) void
private void
dumpClasspath
(Path pPath) private void
dumpGameRules
(Path pPath) private void
dumpMiscStats
(Path pPath) private void
dumpNativeModules
(Path pPath) void
dumpServerProperties
(Path pPath) private void
dumpThreads
(Path pPath) private void
boolean
void
executeIfPossible
(Runnable pTask) abstract SystemReport
fillServerSystemReport
(SystemReport pReport) fillSystemReport
(SystemReport pSystemReport) void
protected void
boolean
void
已过时。int
float
int
com.mojang.datafixers.DataFixer
abstract int
getLevel
(ResourceKey<Level> pDimension) int
int
getMotd()
long
abstract int
int
int
String[]
int
getPort()
boolean
int
getProfilePermissions
(com.mojang.authlib.GameProfile pProfile) com.mojang.authlib.GameProfileRepository
getProxy()
abstract int
int
getScaledTrackingDistance
(int pTrackingDistance) private static DataPackConfig
getSelectedPacks
(PackRepository pPackRepository) com.mojang.authlib.minecraft.MinecraftSessionService
com.mojang.authlib.GameProfile
int
int
getSpawnRadius
(ServerLevel pLevel) int
long[]
getTickTime
(ResourceKey<Level> dim) private ServerLevel[]
getWorldPath
(LevelResource pLevelResource) void
halt
(boolean pWaitForServer) boolean
hasGui()
private boolean
haveTime()
boolean
protected void
protected abstract boolean
void
abstract boolean
boolean
abstract boolean
boolean
isDemo()
boolean
abstract boolean
boolean
boolean
boolean
abstract boolean
boolean
boolean
isReady()
boolean
boolean
boolean
boolean
boolean
abstract boolean
isSingleplayerOwner
(com.mojang.authlib.GameProfile pProfile) boolean
boolean
boolean
boolean
boolean
isUnderSpawnProtection
(ServerLevel pLevel, BlockPos pPos, Player pPlayer) void
kickUnlistedPlayers
(CommandSourceStack pCommandSource) protected void
private Optional<ServerStatus.Favicon>
void
logChatMessage
(Component pContent, ChatType.Bound pBoundChatType, String pHeader) void
已过时。void
onServerCrash
(CrashReport pReport) void
final ServerLevel
boolean
pollTask()
private boolean
private void
prepareLevels
(ChunkProgressListener pListener) boolean
publishServer
(GameType pGameMode, boolean pCheats, int pPort) private void
readScoreboard
(DimensionDataStorage pDataStorage) reloadResources
(Collection<String> pSelectedIds) boolean
private void
resetStatusCache
(ServerStatus status) protected void
boolean
saveAllChunks
(boolean pSuppressLog, boolean pFlush, boolean pForced) private void
saveDebugReport
(Path pPath) boolean
saveEverything
(boolean pSuppressLog, boolean pFlush, boolean pForced) boolean
private void
sendDifficultyUpdate
(ServerPlayer p_129939_) void
sendSystemMessage
(Component pComponent) void
setDefaultGameType
(GameType pGameMode) void
setDemo
(boolean pDemo) void
setDifficulty
(Difficulty pDifficulty, boolean pForced) void
setDifficultyLocked
(boolean pLocked) void
setEnforceWhitelist
(boolean pWhitelistEnabled) void
setFlightAllowed
(boolean pAllow) protected void
private static void
setInitialSpawn
(ServerLevel pLevel, ServerLevelData pLevelData, boolean pGenerateBonusChest, boolean pDebug) void
setLocalIp
(String pHost) void
void
setPlayerIdleTimeout
(int pIdleTimeout) void
setPlayerList
(PlayerList pList) void
setPort
(int pPort) void
setPreventProxyConnections
(boolean pPreventProxyConnections) void
setPvpAllowed
(boolean pAllowPvp) void
setSingleplayerProfile
(com.mojang.authlib.GameProfile pSingleplayerProfile) private void
setupDebugLevel
(WorldData pWorldData) void
setUsesAuthentication
(boolean pOnline) abstract boolean
abstract boolean
protected boolean
static <S extends MinecraftServer>
Sprivate void
void
startRecordingMetrics
(Consumer<ProfileResults> pOutput, Consumer<Path> pOnMetricsRecordingFinished) void
void
void
private void
synchronizeTime
(ServerLevel pLevel) void
tickChildren
(BooleanSupplier pHasTimeLeft) void
tickServer
(BooleanSupplier pHasTimeLeft) private void
boolean
protected void
protected TickTask
wrapRunnable
(Runnable pRunnable) 从类继承的方法 net.minecraft.util.thread.ReentrantBlockableEventLoop
runningTask
从类继承的方法 net.minecraft.util.thread.BlockableEventLoop
dropAllTasks, execute, executeBlocking, getPendingTasksCount, isSameThread, managedBlock, name, profiledMetrics, runAllTasks, submit, submit, submitAsync, tell, waitForTasks
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 net.minecraft.commands.CommandSource
alwaysAccepts
从接口继承的方法 net.minecraft.util.thread.ProcessorHandle
ask, askEither
-
字段详细资料
-
LOGGER
private static final org.slf4j.Logger LOGGER -
VANILLA_BRAND
- 另请参阅:
-
AVERAGE_TICK_TIME_SMOOTHING
private static final float AVERAGE_TICK_TIME_SMOOTHING- 另请参阅:
-
TICK_STATS_SPAN
private static final int TICK_STATS_SPAN- 另请参阅:
-
MS_PER_TICK
public static final int MS_PER_TICK- 另请参阅:
-
OVERLOADED_THRESHOLD
private static final int OVERLOADED_THRESHOLD- 另请参阅:
-
OVERLOADED_WARNING_INTERVAL
private static final int OVERLOADED_WARNING_INTERVAL- 另请参阅:
-
STATUS_EXPIRE_TIME_NS
private static final long STATUS_EXPIRE_TIME_NS- 另请参阅:
-
MAX_STATUS_PLAYER_SAMPLE
private static final int MAX_STATUS_PLAYER_SAMPLE- 另请参阅:
-
START_CHUNK_RADIUS
public static final int START_CHUNK_RADIUS- 另请参阅:
-
START_TICKING_CHUNK_COUNT
private static final int START_TICKING_CHUNK_COUNT- 另请参阅:
-
AUTOSAVE_INTERVAL
private static final int AUTOSAVE_INTERVAL- 另请参阅:
-
MAX_TICK_LATENCY
private static final int MAX_TICK_LATENCY- 另请参阅:
-
ABSOLUTE_MAX_WORLD_SIZE
public static final int ABSOLUTE_MAX_WORLD_SIZE- 另请参阅:
-
DEMO_SETTINGS
-
DELAYED_TASKS_TICK_EXTENSION
private static final long DELAYED_TASKS_TICK_EXTENSION- 另请参阅:
-
ANONYMOUS_PLAYER_PROFILE
public static final com.mojang.authlib.GameProfile ANONYMOUS_PLAYER_PROFILE -
storageSource
-
playerDataStorage
-
tickables
-
metricsRecorder
-
profiler
-
onMetricsRecordingStopped
-
onMetricsRecordingFinished
-
willStartRecordingMetrics
private boolean willStartRecordingMetrics -
debugCommandProfiler
-
debugCommandProfilerDelayStart
private boolean debugCommandProfilerDelayStart -
connection
-
progressListenerFactory
-
status
-
statusIcon
-
random
-
fixerUpper
private final com.mojang.datafixers.DataFixer fixerUpper -
localIp
-
port
private int port -
registries
-
levels
-
playerList
-
running
private volatile boolean running -
stopped
private boolean stopped -
tickCount
private int tickCount -
proxy
-
onlineMode
private boolean onlineMode -
preventProxyConnections
private boolean preventProxyConnections -
pvp
private boolean pvp -
allowFlight
private boolean allowFlight -
motd
-
playerIdleTimeout
private int playerIdleTimeout -
tickTimes
public final long[] tickTimes -
keyPair
-
singleplayerProfile
@Nullable private com.mojang.authlib.GameProfile singleplayerProfile -
isDemo
private boolean isDemo -
isReady
private volatile boolean isReady -
lastOverloadWarning
private long lastOverloadWarning -
services
-
lastServerStatus
private long lastServerStatus -
serverThread
-
nextTickTime
protected long nextTickTime -
delayedTasksMaxNextTickTime
private long delayedTasksMaxNextTickTime -
mayHaveDelayedTasks
private boolean mayHaveDelayedTasks -
packRepository
-
scoreboard
-
commandStorage
-
customBossEvents
-
functionManager
-
frameTimer
-
enforceWhitelist
private boolean enforceWhitelist -
averageTickTime
private float averageTickTime -
executor
-
serverId
-
resources
-
structureTemplateManager
-
worldData
-
isSaving
private volatile boolean isSaving -
GSON
private static final com.google.gson.Gson GSON -
cachedServerStatus
-
perWorldTickTimes
-
worldArrayMarker
private int worldArrayMarker -
worldArrayLast
private int worldArrayLast -
worldArray
-
-
构造器详细资料
-
MinecraftServer
public MinecraftServer(Thread pServerThread, LevelStorageSource.LevelStorageAccess pStorageSource, PackRepository pPackRepository, WorldStem pWorldStem, Proxy pProxy, com.mojang.datafixers.DataFixer pFixerUpper, Services pServices, ChunkProgressListenerFactory pProgressListenerFactory)
-
-
方法详细资料
-
spin
-
readScoreboard
-
initServer
- 抛出:
IOException
-
loadLevel
protected void loadLevel() -
forceDifficulty
protected void forceDifficulty() -
createLevels
-
setInitialSpawn
private static void setInitialSpawn(ServerLevel pLevel, ServerLevelData pLevelData, boolean pGenerateBonusChest, boolean pDebug) -
setupDebugLevel
-
prepareLevels
-
getDefaultGameType
-
isHardcore
public boolean isHardcore() -
getOperatorUserPermissionLevel
public abstract int getOperatorUserPermissionLevel() -
getFunctionCompilationLevel
public abstract int getFunctionCompilationLevel() -
shouldRconBroadcast
public abstract boolean shouldRconBroadcast() -
saveAllChunks
public boolean saveAllChunks(boolean pSuppressLog, boolean pFlush, boolean pForced) -
saveEverything
public boolean saveEverything(boolean pSuppressLog, boolean pFlush, boolean pForced) -
close
public void close()- 指定者:
close
在接口中AutoCloseable
- 指定者:
close
在接口中ProcessorHandle<TickTask>
-
stopServer
public void stopServer() -
getLocalIp
-
setLocalIp
-
isRunning
public boolean isRunning() -
halt
public void halt(boolean pWaitForServer) -
runServer
protected void runServer() -
constructOrExtractCrashReport
-
haveTime
private boolean haveTime() -
waitUntilNextTick
protected void waitUntilNextTick() -
wrapRunnable
- 指定者:
wrapRunnable
在类中BlockableEventLoop<TickTask>
-
shouldRun
- 指定者:
shouldRun
在类中BlockableEventLoop<TickTask>
-
pollTask
public boolean pollTask()- 覆盖:
pollTask
在类中BlockableEventLoop<TickTask>
-
pollTaskInternal
private boolean pollTaskInternal() -
doRunTask
- 覆盖:
doRunTask
在类中ReentrantBlockableEventLoop<TickTask>
-
loadStatusIcon
-
getWorldScreenshotFile
-
getServerDirectory
-
onServerCrash
-
onServerExit
public void onServerExit() -
tickServer
-
resetStatusCache
-
getStatusJson
-
buildServerStatus
-
buildPlayerStatus
-
tickChildren
-
synchronizeTime
-
forceTimeSynchronization
public void forceTimeSynchronization() -
isNetherEnabled
public boolean isNetherEnabled() -
addTickable
-
setId
-
isShutdown
public boolean isShutdown() -
getFile
-
overworld
-
getLevel
-
levelKeys
-
getAllLevels
-
getServerVersion
-
getPlayerCount
public int getPlayerCount() -
getMaxPlayers
public int getMaxPlayers() -
getPlayerNames
-
getServerModName
-
fillSystemReport
-
fillServerSystemReport
-
getModdedStatus
-
sendSystemMessage
- 指定者:
sendSystemMessage
在接口中CommandSource
-
getKeyPair
-
getPort
public int getPort() -
setPort
public void setPort(int pPort) -
getSingleplayerProfile
@Nullable public com.mojang.authlib.GameProfile getSingleplayerProfile() -
setSingleplayerProfile
public void setSingleplayerProfile(@Nullable com.mojang.authlib.GameProfile pSingleplayerProfile) -
isSingleplayer
public boolean isSingleplayer() -
initializeKeyPair
protected void initializeKeyPair() -
setDifficulty
-
getScaledTrackingDistance
public int getScaledTrackingDistance(int pTrackingDistance) -
updateMobSpawningFlags
private void updateMobSpawningFlags() -
setDifficultyLocked
public void setDifficultyLocked(boolean pLocked) -
sendDifficultyUpdate
-
isSpawningMonsters
public boolean isSpawningMonsters() -
isDemo
public boolean isDemo() -
setDemo
public void setDemo(boolean pDemo) -
getServerResourcePack
-
isResourcePackRequired
public boolean isResourcePackRequired() -
isDedicatedServer
public abstract boolean isDedicatedServer() -
getRateLimitPacketsPerSecond
public abstract int getRateLimitPacketsPerSecond() -
usesAuthentication
public boolean usesAuthentication() -
setUsesAuthentication
public void setUsesAuthentication(boolean pOnline) -
getPreventProxyConnections
public boolean getPreventProxyConnections() -
setPreventProxyConnections
public void setPreventProxyConnections(boolean pPreventProxyConnections) -
isSpawningAnimals
public boolean isSpawningAnimals() -
areNpcsEnabled
public boolean areNpcsEnabled() -
isEpollEnabled
public abstract boolean isEpollEnabled() -
isPvpAllowed
public boolean isPvpAllowed() -
setPvpAllowed
public void setPvpAllowed(boolean pAllowPvp) -
isFlightAllowed
public boolean isFlightAllowed() -
setFlightAllowed
public void setFlightAllowed(boolean pAllow) -
isCommandBlockEnabled
public abstract boolean isCommandBlockEnabled() -
getMotd
-
setMotd
-
isStopped
public boolean isStopped() -
getPlayerList
-
setPlayerList
-
isPublished
public abstract boolean isPublished() -
setDefaultGameType
-
getConnection
-
isReady
public boolean isReady() -
hasGui
public boolean hasGui() -
publishServer
-
getTickCount
public int getTickCount() -
getSpawnProtectionRadius
public int getSpawnProtectionRadius() -
isUnderSpawnProtection
-
repliesToStatus
public boolean repliesToStatus() -
hidesOnlinePlayers
public boolean hidesOnlinePlayers() -
getProxy
-
getPlayerIdleTimeout
public int getPlayerIdleTimeout() -
setPlayerIdleTimeout
public void setPlayerIdleTimeout(int pIdleTimeout) -
getSessionService
public com.mojang.authlib.minecraft.MinecraftSessionService getSessionService() -
getProfileKeySignatureValidator
-
getProfileRepository
public com.mojang.authlib.GameProfileRepository getProfileRepository() -
getProfileCache
-
getStatus
-
invalidateStatus
public void invalidateStatus() -
getAbsoluteMaxWorldSize
public int getAbsoluteMaxWorldSize() -
scheduleExecutables
public boolean scheduleExecutables() -
executeIfPossible
- 覆盖:
executeIfPossible
在类中BlockableEventLoop<TickTask>
-
getRunningThread
- 指定者:
getRunningThread
在类中BlockableEventLoop<TickTask>
-
getCompressionThreshold
public int getCompressionThreshold() -
enforceSecureProfile
public boolean enforceSecureProfile() -
getNextTickTime
public long getNextTickTime() -
getFixerUpper
public com.mojang.datafixers.DataFixer getFixerUpper() -
getSpawnRadius
-
getAdvancements
-
getFunctions
-
reloadResources
-
configurePackRepository
public static WorldDataConfiguration configurePackRepository(PackRepository pPackRepository, DataPackConfig pDataPackConfig, boolean pSafeMode, FeatureFlagSet pEnabledFeatures) -
getSelectedPacks
-
kickUnlistedPlayers
-
getPackRepository
-
getCommands
-
createCommandSourceStack
-
acceptsSuccess
public boolean acceptsSuccess()- 指定者:
acceptsSuccess
在接口中CommandSource
-
acceptsFailure
public boolean acceptsFailure()- 指定者:
acceptsFailure
在接口中CommandSource
-
shouldInformAdmins
public abstract boolean shouldInformAdmins()- 指定者:
shouldInformAdmins
在接口中CommandSource
-
getRecipeManager
-
getScoreboard
-
getCommandStorage
-
getLootData
-
getGameRules
-
getCustomBossEvents
-
isEnforceWhitelist
public boolean isEnforceWhitelist() -
setEnforceWhitelist
public void setEnforceWhitelist(boolean pWhitelistEnabled) -
getAverageTickTime
public float getAverageTickTime() -
getProfilePermissions
public int getProfilePermissions(com.mojang.authlib.GameProfile pProfile) -
getFrameTimer
-
getProfiler
-
isSingleplayerOwner
public abstract boolean isSingleplayerOwner(com.mojang.authlib.GameProfile pProfile) -
getTickTime
-
forgeGetWorldMap
已过时。 -
markWorldsDirty
已过时。 -
getWorldArray
-
dumpServerProperties
- 抛出:
IOException
-
saveDebugReport
-
dumpMiscStats
- 抛出:
IOException
-
dumpGameRules
- 抛出:
IOException
-
dumpClasspath
- 抛出:
IOException
-
dumpThreads
- 抛出:
IOException
-
dumpNativeModules
- 抛出:
IOException
-
startMetricsRecordingTick
private void startMetricsRecordingTick() -
endMetricsRecordingTick
private void endMetricsRecordingTick() -
isRecordingMetrics
public boolean isRecordingMetrics() -
startRecordingMetrics
public void startRecordingMetrics(Consumer<ProfileResults> pOutput, Consumer<Path> pOnMetricsRecordingFinished) -
stopRecordingMetrics
public void stopRecordingMetrics() -
finishRecordingMetrics
public void finishRecordingMetrics() -
cancelRecordingMetrics
public void cancelRecordingMetrics() -
getWorldPath
-
forceSynchronousWrites
public boolean forceSynchronousWrites() -
getStructureManager
-
getWorldData
-
getServerResources
-
registryAccess
-
registries
-
createTextFilterForPlayer
-
createGameModeForPlayer
-
getForcedGameType
-
getResourceManager
-
isCurrentlySaving
public boolean isCurrentlySaving() -
isTimeProfilerRunning
public boolean isTimeProfilerRunning() -
startTimeProfiler
public void startTimeProfiler() -
stopTimeProfiler
-
getMaxChainedNeighborUpdates
public int getMaxChainedNeighborUpdates() -
logChatMessage
public void logChatMessage(Component pContent, ChatType.Bound pBoundChatType, @Nullable String pHeader) -
getChatDecorator
-