Package net.minecraft.server
Class MinecraftServer
java.lang.Object
net.minecraft.util.concurrent.ThreadTaskExecutor<R>
net.minecraft.util.concurrent.RecursiveEventLoop<TickDelayedTask>
net.minecraft.server.MinecraftServer
- All Implemented Interfaces:
AutoCloseable,Executor,ICommandSource,ISnooperInfo,ITaskExecutor<TickDelayedTask>
- Direct Known Subclasses:
DedicatedServer,IntegratedServer
public abstract class MinecraftServer
extends RecursiveEventLoop<TickDelayedTask>
implements ISnooperInfo, ICommandSource, AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate floatprivate CommandStorageprivate final NetworkSystemprivate final TimeTrackerprivate final CustomServerBossInfoManagerprivate longprivate booleanstatic final WorldSettingsprivate booleanprivate final Executorprivate final com.mojang.datafixers.DataFixerprivate booleanprivate final FrameTimerprivate final FunctionManagerprivate booleanprivate booleanprivate booleanprivate KeyPairprivate longprivate longprivate final Map<RegistryKey<World>,ServerWorld> private Stringprivate static final org.apache.logging.log4j.Loggerprivate intprivate booleanprivate Stringprotected longprivate booleanprivate final ResourcePackListprivate Map<RegistryKey<World>,long[]> protected final PlayerDataprivate intprivate PlayerListprivate intprivate booleanprivate final PlayerProfileCacheprivate IProfilerprivate final com.mojang.authlib.GameProfileRepositoryprivate final IChunkStatusListenerFactoryprotected final Proxyprivate booleanprivate final Randomprotected final DynamicRegistries.Implprivate Stringprivate Stringprivate DataPackRegistriesprivate booleanprivate final ServerScoreboardprivate Stringprivate final Threadprivate final com.mojang.authlib.minecraft.MinecraftSessionServiceprivate Stringprivate final Snooperprivate final ServerStatusResponseprivate booleanprotected final SaveFormat.LevelSaveprivate final TemplateManagerprivate intfinal long[]static final Fileprivate ServerWorld[]private intprivate intprotected final IServerConfigurationFields inherited from interface net.minecraft.command.ICommandSource
NULL -
Constructor Summary
ConstructorsConstructorDescriptionMinecraftServer(Thread p_i232576_1_, DynamicRegistries.Impl p_i232576_2_, SaveFormat.LevelSave p_i232576_3_, IServerConfiguration p_i232576_4_, ResourcePackList p_i232576_5_, Proxy p_i232576_6_, com.mojang.datafixers.DataFixer p_i232576_7_, DataPackRegistries p_i232576_8_, com.mojang.authlib.minecraft.MinecraftSessionService p_i232576_9_, com.mojang.authlib.GameProfileRepository p_i232576_10_, PlayerProfileCache p_i232576_11_, IChunkStatusListenerFactory p_i232576_12_) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanvoidaddTickable(Runnable p_82010_1_) booleanvoidclose()static DatapackCodecconfigurePackRepository(ResourcePackList p_240772_0_, DatapackCodec p_240772_1_, boolean p_240772_2_) static voidconvertFromRegionFormatIfNeeded(SaveFormat.LevelSave p_240777_0_) protected voidcreateLevels(IChunkStatusListener p_240787_1_) createTextFilterForPlayer(ServerPlayerEntity p_244435_1_) protected voidprotected voiddoRunTask(TickDelayedTask p_213166_1_) private voiddumpClasspath(Path p_223706_1_) private voiddumpCrashCategory(Path p_223709_1_) private voiddumpGameRules(Path p_223708_1_) private voiddumpMiscStats(Path p_223710_1_) private voiddumpThreads(Path p_223712_1_) private voidendProfilerTick(LongTickDetector p_240795_1_) fillReport(CrashReport p_71230_1_) protected voidbooleanDeprecated.intfloatintcom.mojang.datafixers.DataFixerbooleanabstract intgetLevel(RegistryKey<World> p_71218_1_) intintgetMotd()longabstract intintintString[]intgetPort()booleanintgetProfilePermissions(com.mojang.authlib.GameProfile p_211833_1_) com.mojang.authlib.GameProfileRepositoryabstract intintgetScaledTrackingDistance(int p_230512_1_) private static DatapackCodecgetSelectedPacks(ResourcePackList p_240771_0_) com.mojang.authlib.minecraft.MinecraftSessionServiceintintgetSpawnRadius(ServerWorld p_184108_1_) getTags()intlong[]getTickTime(RegistryKey<World> dim) private ServerWorld[]getWorldPath(FolderName p_240776_1_) voidhalt(boolean p_71263_1_) booleanhasGui()booleanprivate booleanhaveTime()protected voidprotected abstract booleanvoidabstract booleanabstract booleanbooleanisDemo()booleanabstract booleanbooleanbooleanbooleanbooleanabstract booleanbooleanbooleanisReady()booleanbooleanbooleanabstract booleanisSingleplayerOwner(com.mojang.authlib.GameProfile p_213199_1_) booleanprotected booleanbooleanbooleanisUnderSpawnProtection(ServerWorld p_175579_1_, BlockPos p_175579_2_, PlayerEntity p_175579_3_) voidkickUnlistedPlayers(CommandSource p_205743_1_) protected voidvoidDeprecated.protected voidonServerCrash(CrashReport p_71228_1_) protected voidfinal ServerWorldbooleanpollTask()private booleanvoidpopulateSnooper(Snooper p_70000_1_) private voidprepareLevels(IChunkStatusListener p_213186_1_) abstract booleanpublishServer(GameType p_195565_1_, boolean p_195565_2_, int p_195565_3_) private voidreadScoreboard(DimensionSavedDataManager p_213204_1_) reloadResources(Collection<String> p_240780_1_) booleanprotected voidbooleansaveAllChunks(boolean p_213211_1_, boolean p_213211_2_, boolean p_213211_3_) voidsaveDebugReport(Path p_223711_1_) booleanprivate voidsendDifficultyUpdate(ServerPlayerEntity p_213189_1_) voidsendMessage(ITextComponent p_145747_1_, UUID p_145747_2_) voidsetDefaultGameType(GameType p_71235_1_) voidsetDemo(boolean p_71204_1_) voidsetDifficulty(Difficulty p_147139_1_, boolean p_147139_2_) voidsetDifficultyLocked(boolean p_213209_1_) voidsetEnforceWhitelist(boolean p_205741_1_) voidsetFlightAllowed(boolean p_71245_1_) voidsetForceGameType(boolean p_104055_1_) protected voidprivate static voidsetInitialSpawn(ServerWorld p_240786_0_, IServerWorldInfo p_240786_1_, boolean p_240786_2_, boolean p_240786_3_, boolean p_240786_4_) voidsetLocalIp(String p_71189_1_) voidsetMaxBuildHeight(int p_71191_1_) voidvoidsetPlayerIdleTimeout(int p_143006_1_) voidsetPlayerList(PlayerList p_184105_1_) voidsetPort(int p_71208_1_) voidsetPreventProxyConnections(boolean p_190517_1_) voidsetPvpAllowed(boolean p_71188_1_) voidsetResourcePack(String p_180507_1_, String p_180507_2_) voidsetSingleplayerName(String p_71224_1_) private voidsetupDebugLevel(IServerConfiguration p_240778_1_) voidsetUsesAuthentication(boolean p_71229_1_) abstract booleanprotected booleanshouldRun(TickDelayedTask p_212874_1_) static <S extends MinecraftServer>
Sprivate voidstartProfilerTick(LongTickDetector p_240773_1_) voidprotected voidprotected voidtickChildren(BooleanSupplier p_71190_1_) protected voidtickServer(BooleanSupplier p_71217_1_) private voidprivate voidupdateStatusIcon(ServerStatusResponse p_184107_1_) booleanprotected voidprotected TickDelayedTaskwrapRunnable(Runnable p_212875_1_) Methods inherited from class net.minecraft.util.concurrent.RecursiveEventLoop
runningTaskMethods inherited from class net.minecraft.util.concurrent.ThreadTaskExecutor
dropAllTasks, execute, executeBlocking, getPendingTasksCount, isSameThread, managedBlock, name, runAllTasks, submit, submit, submitAsync, tell, waitForTasksMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.command.ICommandSource
shouldInformAdminsMethods inherited from interface net.minecraft.util.concurrent.ITaskExecutor
ask, askEither
-
Field Details
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
USERID_CACHE_FILE
-
DEMO_SETTINGS
-
storageSource
-
playerDataStorage
-
snooper
-
tickables
-
continousProfiler
-
profiler
-
connection
-
progressListenerFactory
-
status
-
random
-
fixerUpper
private final com.mojang.datafixers.DataFixer fixerUpper -
localIp
-
port
private int port -
registryHolder
-
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
-
maxBuildHeight
private int maxBuildHeight -
playerIdleTimeout
private int playerIdleTimeout -
tickTimes
public final long[] tickTimes -
keyPair
-
singleplayerName
-
isDemo
private boolean isDemo -
resourcePack
-
resourcePackHash
-
isReady
private volatile boolean isReady -
lastOverloadWarning
private long lastOverloadWarning -
delayProfilerStart
private boolean delayProfilerStart -
forceGameType
private boolean forceGameType -
sessionService
private final com.mojang.authlib.minecraft.MinecraftSessionService sessionService -
profileRepository
private final com.mojang.authlib.GameProfileRepository profileRepository -
profileCache
-
lastServerStatus
private long lastServerStatus -
serverThread
-
nextTickTime
protected long nextTickTime -
delayedTasksMaxNextTickTime
private long delayedTasksMaxNextTickTime -
mayHaveDelayedTasks
private boolean mayHaveDelayedTasks -
hasWorldScreenshot
private boolean hasWorldScreenshot -
packRepository
-
scoreboard
-
commandStorage
-
customBossEvents
-
functionManager
-
frameTimer
-
enforceWhitelist
private boolean enforceWhitelist -
averageTickTime
private float averageTickTime -
executor
-
serverId
-
resources
-
structureManager
-
worldData
-
perWorldTickTimes
-
worldArrayMarker
private int worldArrayMarker -
worldArrayLast
private int worldArrayLast -
worldArray
-
-
Constructor Details
-
MinecraftServer
public MinecraftServer(Thread p_i232576_1_, DynamicRegistries.Impl p_i232576_2_, SaveFormat.LevelSave p_i232576_3_, IServerConfiguration p_i232576_4_, ResourcePackList p_i232576_5_, Proxy p_i232576_6_, com.mojang.datafixers.DataFixer p_i232576_7_, DataPackRegistries p_i232576_8_, com.mojang.authlib.minecraft.MinecraftSessionService p_i232576_9_, com.mojang.authlib.GameProfileRepository p_i232576_10_, PlayerProfileCache p_i232576_11_, IChunkStatusListenerFactory p_i232576_12_)
-
-
Method Details
-
spin
-
readScoreboard
-
initServer
- Throws:
IOException
-
convertFromRegionFormatIfNeeded
-
loadLevel
protected void loadLevel() -
forceDifficulty
protected void forceDifficulty() -
createLevels
-
setInitialSpawn
private static void setInitialSpawn(ServerWorld p_240786_0_, IServerWorldInfo p_240786_1_, boolean p_240786_2_, boolean p_240786_3_, boolean p_240786_4_) -
setupDebugLevel
-
prepareLevels
-
detectBundledResources
protected void detectBundledResources() -
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 p_213211_1_, boolean p_213211_2_, boolean p_213211_3_) -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceITaskExecutor<TickDelayedTask>
-
stopServer
protected void stopServer() -
getLocalIp
-
setLocalIp
-
isRunning
public boolean isRunning() -
halt
public void halt(boolean p_71263_1_) -
runServer
protected void runServer() -
haveTime
private boolean haveTime() -
waitUntilNextTick
protected void waitUntilNextTick() -
wrapRunnable
- Specified by:
wrapRunnablein classThreadTaskExecutor<TickDelayedTask>
-
shouldRun
- Specified by:
shouldRunin classThreadTaskExecutor<TickDelayedTask>
-
pollTask
public boolean pollTask()- Overrides:
pollTaskin classThreadTaskExecutor<TickDelayedTask>
-
pollTaskInternal
private boolean pollTaskInternal() -
doRunTask
- Overrides:
doRunTaskin classRecursiveEventLoop<TickDelayedTask>
-
updateStatusIcon
-
hasWorldScreenshot
public boolean hasWorldScreenshot() -
getWorldScreenshotFile
-
getServerDirectory
-
onServerCrash
-
onServerExit
protected void onServerExit() -
tickServer
-
tickChildren
-
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
-
fillReport
-
getModdedStatus
-
sendMessage
- Specified by:
sendMessagein interfaceICommandSource
-
getKeyPair
-
getPort
public int getPort() -
setPort
public void setPort(int p_71208_1_) -
getSingleplayerName
-
setSingleplayerName
-
isSingleplayer
public boolean isSingleplayer() -
initializeKeyPair
protected void initializeKeyPair() -
setDifficulty
-
getScaledTrackingDistance
public int getScaledTrackingDistance(int p_230512_1_) -
updateMobSpawningFlags
private void updateMobSpawningFlags() -
setDifficultyLocked
public void setDifficultyLocked(boolean p_213209_1_) -
sendDifficultyUpdate
-
isSpawningMonsters
protected boolean isSpawningMonsters() -
isDemo
public boolean isDemo() -
setDemo
public void setDemo(boolean p_71204_1_) -
getResourcePack
-
getResourcePackHash
-
setResourcePack
-
populateSnooper
- Specified by:
populateSnooperin interfaceISnooperInfo
-
isDedicatedServer
public abstract boolean isDedicatedServer() -
getRateLimitPacketsPerSecond
public abstract int getRateLimitPacketsPerSecond() -
usesAuthentication
public boolean usesAuthentication() -
setUsesAuthentication
public void setUsesAuthentication(boolean p_71229_1_) -
getPreventProxyConnections
public boolean getPreventProxyConnections() -
setPreventProxyConnections
public void setPreventProxyConnections(boolean p_190517_1_) -
isSpawningAnimals
public boolean isSpawningAnimals() -
areNpcsEnabled
public boolean areNpcsEnabled() -
isEpollEnabled
public abstract boolean isEpollEnabled() -
isPvpAllowed
public boolean isPvpAllowed() -
setPvpAllowed
public void setPvpAllowed(boolean p_71188_1_) -
isFlightAllowed
public boolean isFlightAllowed() -
setFlightAllowed
public void setFlightAllowed(boolean p_71245_1_) -
isCommandBlockEnabled
public abstract boolean isCommandBlockEnabled() -
getMotd
-
setMotd
-
getMaxBuildHeight
public int getMaxBuildHeight() -
setMaxBuildHeight
public void setMaxBuildHeight(int p_71191_1_) -
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() -
getSnooper
-
getSpawnProtectionRadius
public int getSpawnProtectionRadius() -
isUnderSpawnProtection
public boolean isUnderSpawnProtection(ServerWorld p_175579_1_, BlockPos p_175579_2_, PlayerEntity p_175579_3_) -
setForceGameType
public void setForceGameType(boolean p_104055_1_) -
getForceGameType
public boolean getForceGameType() -
repliesToStatus
public boolean repliesToStatus() -
getPlayerIdleTimeout
public int getPlayerIdleTimeout() -
setPlayerIdleTimeout
public void setPlayerIdleTimeout(int p_143006_1_) -
getSessionService
public com.mojang.authlib.minecraft.MinecraftSessionService getSessionService() -
getProfileRepository
public com.mojang.authlib.GameProfileRepository getProfileRepository() -
getProfileCache
-
getStatus
-
invalidateStatus
public void invalidateStatus() -
getAbsoluteMaxWorldSize
public int getAbsoluteMaxWorldSize() -
scheduleExecutables
public boolean scheduleExecutables()- Overrides:
scheduleExecutablesin classRecursiveEventLoop<TickDelayedTask>
-
getRunningThread
- Specified by:
getRunningThreadin classThreadTaskExecutor<TickDelayedTask>
-
getCompressionThreshold
public int getCompressionThreshold() -
getNextTickTime
public long getNextTickTime() -
getFixerUpper
public com.mojang.datafixers.DataFixer getFixerUpper() -
getSpawnRadius
-
getAdvancements
-
getFunctions
-
reloadResources
-
configurePackRepository
public static DatapackCodec configurePackRepository(ResourcePackList p_240772_0_, DatapackCodec p_240772_1_, boolean p_240772_2_) -
getSelectedPacks
-
kickUnlistedPlayers
-
getPackRepository
-
getCommands
-
createCommandSourceStack
-
acceptsSuccess
public boolean acceptsSuccess()- Specified by:
acceptsSuccessin interfaceICommandSource
-
acceptsFailure
public boolean acceptsFailure()- Specified by:
acceptsFailurein interfaceICommandSource
-
getRecipeManager
-
getTags
-
getScoreboard
-
getCommandStorage
-
getLootTables
-
getPredicateManager
-
getGameRules
-
getCustomBossEvents
-
isEnforceWhitelist
public boolean isEnforceWhitelist() -
setEnforceWhitelist
public void setEnforceWhitelist(boolean p_205741_1_) -
getAverageTickTime
public float getAverageTickTime() -
getProfilePermissions
public int getProfilePermissions(com.mojang.authlib.GameProfile p_211833_1_) -
getFrameTimer
-
getProfiler
-
isSingleplayerOwner
public abstract boolean isSingleplayerOwner(com.mojang.authlib.GameProfile p_213199_1_) -
getTickTime
-
forgeGetWorldMap
Deprecated. -
markWorldsDirty
Deprecated. -
getWorldArray
-
saveDebugReport
- Throws:
IOException
-
dumpMiscStats
- Throws:
IOException
-
dumpCrashCategory
- Throws:
IOException
-
dumpGameRules
- Throws:
IOException
-
dumpClasspath
- Throws:
IOException
-
dumpThreads
- Throws:
IOException
-
startProfilerTick
-
endProfilerTick
-
isProfiling
public boolean isProfiling() -
startProfiling
public void startProfiling() -
finishProfiling
-
getWorldPath
-
forceSynchronousWrites
public boolean forceSynchronousWrites() -
getStructureManager
-
getWorldData
-
getDataPackRegistries
-
registryAccess
-
createTextFilterForPlayer
-