Package net.minecraft.server.world
Class ServerWorld
java.lang.Object
net.minecraft.world.World
net.minecraft.server.world.ServerWorld
- All Implemented Interfaces:
AutoCloseable
,class_5423
,BiomeAccess.Storage
,BlockRenderView
,BlockView
,CollisionView
,EntityView
,LunarWorldView
,ModifiableTestableWorld
,ModifiableWorld
,ServerWorldAccess
,StructureWorldAccess
,TestableWorld
,WorldAccess
,WorldView
public class ServerWorld extends World implements StructureWorldAccess
-
Field Summary
Fields Modifier and Type Field Description private boolean
allPlayersSleeping
private ServerTickScheduler<Block>
blockTickScheduler
static BlockPos
END_SPAWN_POS
private EnderDragonFight
enderDragonFight
private Int2ObjectMap<Entity>
entitiesById
private Map<UUID,Entity>
entitiesByUuid
private Queue<Entity>
entitiesToLoad
private Set<EntityNavigation>
entityNavigations
private ServerTickScheduler<Fluid>
fluidTickScheduler
private int
idleTimeout
private boolean
inBlockTick
(package private) boolean
inEntityTick
private static Logger
LOGGER
private List<ServerPlayerEntity>
players
private PortalForcer
portalForcer
protected RaidManager
raidManager
boolean
savingDisabled
private MinecraftServer
server
private ServerChunkManager
serverChunkManager
private boolean
shouldTickTime
private List<Spawner>
spawners
private StructureAccessor
structureAccessor
private ObjectLinkedOpenHashSet<BlockEvent>
syncedBlockEventQueue
private ServerWorldProperties
worldProperties
Fields inherited from class net.minecraft.world.World
blockEntities, CODEC, END, isClient, iteratingTickingBlockEntities, lcgBlockSeed, NETHER, OVERWORLD, pendingBlockEntities, properties, rainGradient, rainGradientPrev, random, thunderGradient, thunderGradientPrev, tickingBlockEntities, unloadedBlockEntities, unusedIncrement
-
Constructor Summary
Constructors Constructor Description ServerWorld(MinecraftServer server, Executor workerExecutor, LevelStorage.Session session, ServerWorldProperties properties, RegistryKey<World> registryKey, DimensionType dimensionType, WorldGenerationProgressListener worldGenerationProgressListener, ChunkGenerator chunkGenerator, boolean debugWorld, long long2, List<Spawner> list, boolean bool)
-
Method Summary
Methods inherited from class net.minecraft.world.World
addBlockEntities, addBlockEntity, addDetailsToCrashReport, addFireworkParticle, addImportantParticle, addImportantParticle, addParticle, addParticle, breakBlock, calculateAmbientDarkness, canSetBlock, close, createExplosion, createExplosion, disconnect, getAmbientDarkness, getBiomeAccess, getBlockEntity, getBlockState, getChunk, getChunk, getDebugString, getDimension, getEmittedRedstonePower, getEntitiesByClass, getEntitiesByType, getEntitiesIncludingUngeneratedChunks, getExistingChunk, getFluidState, getGameRules, getLevelProperties, getLightingProvider, getLocalDifficulty, getOtherEntities, getProfiler, getProfilerSupplier, getRainGradient, getRandom, getRandomPosInChunk, getReceivedRedstonePower, getReceivedStrongRedstonePower, getRegistryKey, getSeaLevel, getSkyAngleRadians, getThunderGradient, getTime, getTimeOfDay, getTopY, getWorldBorder, getWorldChunk, hasHighHumidity, hasRain, initWeatherGradients, isClient, isDay, isDebugWorld, isDirectionSolid, isEmittingRedstonePower, isInBuildLimit, isNight, isOutOfBuildLimitVertically, isOutOfBuildLimitVertically, isRaining, isReceivingRedstonePower, isThundering, isTopSolid, isValid, markDirty, playSound, playSound, removeBlock, removeBlockEntity, scheduleBlockRerenderIfNeeded, sendPacket, setBlockEntity, setBlockState, setBlockState, setBlockState, setLightningTicksLeft, setMobSpawnOptions, setRainGradient, setThunderGradient, testBlockState, tickBlockEntities, tickEntity, updateComparators, updateNeighbor, updateNeighborsAlways, updateNeighborsExcept
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.world.BlockRenderView
getBaseLightLevel, getLightingProvider, getLightLevel, isSkyVisible
Methods inherited from interface net.minecraft.world.BlockView
getBlockEntity, getBlockState, getDismountHeight, getDismountHeight, getFluidState, getHeight, getLuminance, getMaxLightLevel, method_29546, raycast, raycastBlock
Methods inherited from interface net.minecraft.class_5423
getEntityCollisions, getTopPosition, intersectsEntities, method_31081
Methods inherited from interface net.minecraft.world.CollisionView
canPlace, getBlockCollisions, getBlockCollisions, getCollisions, getEntityCollisions, getWorldBorder, intersectsEntities, intersectsEntities, isBlockSpaceEmpty, isSpaceEmpty, isSpaceEmpty, isSpaceEmpty, isSpaceEmpty
Methods inherited from interface net.minecraft.world.EntityView
getClosestEntity, getClosestEntity, getClosestEntityIncludingUngeneratedChunks, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getEntitiesByClass, getEntitiesIncludingUngeneratedChunks, getEntitiesIncludingUngeneratedChunks, getNonSpectatingEntities, getOtherEntities, getOtherEntities, getPlayerByUuid, getPlayers, getTargets, isPlayerInRange
Methods inherited from interface net.minecraft.world.LunarWorldView
getMoonPhase, getMoonSize, getSkyAngle
Methods inherited from interface net.minecraft.world.ModifiableWorld
breakBlock, breakBlock, breakBlock, removeBlock, setBlockState, setBlockState
Methods inherited from interface net.minecraft.world.ServerWorldAccess
spawnEntityAndPassengers
Methods inherited from interface net.minecraft.world.TestableWorld
testBlockState
Methods inherited from interface net.minecraft.world.WorldAccess
addParticle, getDifficulty, getDimensionHeight, getLevelProperties, getLocalDifficulty, getLunarTime, getRandom, isChunkLoaded, playSound, syncWorldEvent
Methods inherited from interface net.minecraft.world.WorldView
containsFluid, getAmbientDarkness, getBiome, getBiomeAccess, getBiomeForNoiseGen, getBrightness, getChunk, getChunk, getChunk, getChunk, getColor, getDimension, getExistingChunk, getLightLevel, getLightLevel, getSeaLevel, getStrongRedstonePower, getTopY, isAir, isChunkLoaded, isClient, isRegionLoaded, isRegionLoaded, isSkyVisibleAllowingSea, isWater, method_29556
-
Field Details
-
END_SPAWN_POS
-
LOGGER
-
entitiesById
-
entitiesByUuid
-
entitiesToLoad
-
players
-
serverChunkManager
-
inEntityTick
boolean inEntityTick -
server
-
worldProperties
-
savingDisabled
public boolean savingDisabled -
allPlayersSleeping
private boolean allPlayersSleeping -
idleTimeout
private int idleTimeout -
portalForcer
-
blockTickScheduler
-
fluidTickScheduler
-
raidManager
-
syncedBlockEventQueue
-
inBlockTick
private boolean inBlockTick -
spawners
-
enderDragonFight
-
structureAccessor
-
shouldTickTime
private final boolean shouldTickTime
-
-
Constructor Details
-
ServerWorld
public ServerWorld(MinecraftServer server, Executor workerExecutor, LevelStorage.Session session, ServerWorldProperties properties, RegistryKey<World> registryKey, DimensionType dimensionType, WorldGenerationProgressListener worldGenerationProgressListener, ChunkGenerator chunkGenerator, boolean debugWorld, long long2, List<Spawner> list, boolean bool)
-
-
Method Details
-
setWeather
public void setWeather(int clearDuration, int rainDuration, boolean raining, boolean thundering) -
getGeneratorStoredBiome
- Specified by:
getGeneratorStoredBiome
in interfaceWorldView
-
getStructureAccessor
-
tick
-
tickTime
protected void tickTime() -
setTimeOfDay
public void setTimeOfDay(long timeOfDay) -
tickSpawners
public void tickSpawners(boolean spawnMonsters, boolean spawnAnimals) -
wakeSleepingPlayers
private void wakeSleepingPlayers() -
tickChunk
-
getSurface
-
isInBlockTick
public boolean isInBlockTick() -
updateSleepingPlayers
public void updateSleepingPlayers() -
getScoreboard
- Specified by:
getScoreboard
in classWorld
-
resetWeather
private void resetWeather() -
resetIdleTimeout
public void resetIdleTimeout() -
tickFluid
-
tickBlock
-
tickEntity
-
tickPassenger
-
checkEntityChunkPos
Validates if an entity's current position matches its chunk position. If the entity's chunk position and actual position don't match, then the entity will be moved to its new chunk. -
canPlayerModifyAt
- Overrides:
canPlayerModifyAt
in classWorld
-
save
-
saveLevel
private void saveLevel() -
getEntitiesByType
public List<Entity> getEntitiesByType(@Nullable EntityType<?> type, Predicate<? super Entity> predicate)Computes a list of entities of the given type. Warning: Ifnull
is passed as the entity type filter, care should be taken that the type argumentT
is set toEntity
, otherwise heap pollution in the returned list orClassCastException
can occur.- Parameters:
type
- the entity type of the returned entities, ornull
for any type of entitypredicate
- a predicate which returned entities must satisfy- Returns:
- a list of entities of the given type
-
getAliveEnderDragons
-
getPlayers
-
getRandomAlivePlayer
-
spawnEntity
- Specified by:
spawnEntity
in interfaceModifiableWorld
-
tryLoadEntity
-
onDimensionChanged
-
onPlayerTeleport
-
onPlayerChangeDimension
-
onPlayerConnected
-
onPlayerRespawned
-
addPlayer
-
addEntity
-
loadEntity
-
checkUuid
-
checkIfUuidExists
-
shouldCreateNewEntityWithPassenger
-
unloadEntities
-
unloadEntity
-
loadEntityUnchecked
-
removeEntity
-
removeEntityFromChunk
-
removePlayer
-
setBlockBreakingInfo
- Specified by:
setBlockBreakingInfo
in classWorld
-
playSound
public void playSound(@Nullable PlayerEntity player, double x, double y, double z, SoundEvent sound, SoundCategory category, float volume, float pitch) -
playSoundFromEntity
public void playSoundFromEntity(@Nullable PlayerEntity player, Entity entity, SoundEvent sound, SoundCategory category, float volume, float pitch)- Specified by:
playSoundFromEntity
in classWorld
-
syncGlobalEvent
- Overrides:
syncGlobalEvent
in classWorld
-
syncWorldEvent
- Specified by:
syncWorldEvent
in interfaceWorldAccess
-
updateListeners
- Specified by:
updateListeners
in classWorld
-
sendEntityStatus
- Overrides:
sendEntityStatus
in classWorld
-
getChunkManager
- Specified by:
getChunkManager
in interfaceWorldAccess
-
createExplosion
public Explosion createExplosion(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionBehavior explosionBehavior, double double2, double double3, double double4, float float2, boolean bool, Explosion.DestructionType destructionType)- Overrides:
createExplosion
in classWorld
-
addSyncedBlockEvent
- Overrides:
addSyncedBlockEvent
in classWorld
-
processSyncedBlockEvents
private void processSyncedBlockEvents() -
processBlockEvent
-
getBlockTickScheduler
- Specified by:
getBlockTickScheduler
in interfaceWorldAccess
-
getFluidTickScheduler
- Specified by:
getFluidTickScheduler
in interfaceWorldAccess
-
getServer
-
getPortalForcer
-
getStructureManager
-
spawnParticles
public <T extends ParticleEffect> int spawnParticles(T particle, double x, double y, double z, int count, double deltaX, double deltaY, double deltaZ, double speed) -
spawnParticles
public <T extends ParticleEffect> boolean spawnParticles(ServerPlayerEntity viewer, T particle, boolean force, double x, double y, double z, int count, double deltaX, double deltaY, double deltaZ, double speed) -
sendToPlayerIfNearby
private boolean sendToPlayerIfNearby(ServerPlayerEntity player, boolean force, double x, double y, double z, Packet<?> packet) -
getEntityById
- Specified by:
getEntityById
in classWorld
-
getEntity
-
locateStructure
@Nullable public BlockPos locateStructure(StructureFeature<?> feature, BlockPos pos, int radius, boolean skipExistingChunks) -
locateBiome
-
getRecipeManager
- Specified by:
getRecipeManager
in classWorld
-
getTagManager
- Specified by:
getTagManager
in classWorld
-
isSavingDisabled
public boolean isSavingDisabled()- Overrides:
isSavingDisabled
in classWorld
-
getRegistryManager
- Specified by:
getRegistryManager
in interfaceclass_5423
-
getPersistentStateManager
-
getMapState
- Specified by:
getMapState
in classWorld
-
putMapState
- Specified by:
putMapState
in classWorld
-
getNextMapId
public int getNextMapId()- Specified by:
getNextMapId
in classWorld
-
setSpawnPos
-
getSpawnPos
-
getSpawnAngle
public float getSpawnAngle() -
getForcedChunks
-
setChunkForced
public boolean setChunkForced(int x, int z, boolean forced) -
getPlayers
- Specified by:
getPlayers
in interfaceEntityView
-
onBlockChanged
- Overrides:
onBlockChanged
in classWorld
-
getPointOfInterestStorage
-
isNearOccupiedPointOfInterest
-
isNearOccupiedPointOfInterest
-
isNearOccupiedPointOfInterest
-
getOccupiedPointOfInterestDistance
-
getRaidManager
-
getRaidAt
-
hasRaidAt
-
handleInteraction
public void handleInteraction(EntityInteraction interaction, Entity entity, InteractionObserver observer) -
dump
- Throws:
IOException
-
dumpEntities
-
dumpBlockEntities
- Throws:
IOException
-
clearUpdatesInArea
-
updateNeighbors
- Specified by:
updateNeighbors
in interfaceWorldAccess
-
getBrightness
- Specified by:
getBrightness
in interfaceBlockRenderView
-
iterateEntities
-
toString
-
isFlat
public boolean isFlat() -
getSeed
public long getSeed()- Specified by:
getSeed
in interfaceStructureWorldAccess
-
getEnderDragonFight
-
getStructures
public Stream<? extends StructureStart<?>> getStructures(ChunkSectionPos pos, StructureFeature<?> feature)- Specified by:
getStructures
in interfaceStructureWorldAccess
-
toServerWorld
- Specified by:
toServerWorld
in interfaceServerWorldAccess
-
method_31268
-
method_31270
-
createEndSpawnPlatform
-