public class ServerWorld extends World implements StructureWorldAccess
blockEntities, CODEC, END, isClient, iteratingTickingBlockEntities, lcgBlockSeed, NETHER, OVERWORLD, pendingBlockEntities, properties, rainGradient, rainGradientPrev, random, thunderGradient, thunderGradientPrev, tickingBlockEntities, unloadedBlockEntities, unusedIncrement
Constructor and 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) |
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, isHeightInvalid, isHeightInvalid, isNight, isRaining, isReceivingRedstonePower, isThundering, isTopSolid, markDirty, method_24794, method_25953, playSound, playSound, removeBlock, removeBlockEntity, scheduleBlockRerenderIfNeeded, sendPacket, setBlockEntity, setBlockState, setBlockState, setBlockState, setLightningTicksLeft, setMobSpawnOptions, setRainGradient, setThunderGradient, testBlockState, tickBlockEntities, tickEntity, updateComparators, updateNeighbor, updateNeighborsAlways, updateNeighborsExcept
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
spawnEntityAndPassengers
addParticle, getDifficulty, getDimensionHeight, getLevelProperties, getLocalDifficulty, getLunarTime, getRandom, isChunkLoaded, playSound, syncWorldEvent
getEntityCollisions, getTopPosition, intersectsEntities, method_31081
getClosestEntity, getClosestEntity, getClosestEntityIncludingUngeneratedChunks, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getEntitiesByClass, getEntitiesIncludingUngeneratedChunks, getEntitiesIncludingUngeneratedChunks, getNonSpectatingEntities, getOtherEntities, getOtherEntities, getPlayerByUuid, getPlayers, getTargets, isPlayerInRange
testBlockState
breakBlock, breakBlock, breakBlock, removeBlock, setBlockState, setBlockState
getMoonPhase, getMoonSize, getSkyAngle
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
getBaseLightLevel, getLightingProvider, getLightLevel, isSkyVisible
canPlace, getBlockCollisions, getBlockCollisions, getCollisions, getWorldBorder, intersectsEntities, isBlockSpaceEmpty, isSpaceEmpty, isSpaceEmpty, isSpaceEmpty, isSpaceEmpty
getBlockEntity, getBlockState, getDismountHeight, getDismountHeight, getFluidState, getHeight, getLuminance, getMaxLightLevel, method_29546, raycast, raycast, raycastBlock
public static final BlockPos END_SPAWN_POS
private static final Logger LOGGER
private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<Entity> entitiesById
private final List<ServerPlayerEntity> players
private final ServerChunkManager serverChunkManager
boolean inEntityTick
private final MinecraftServer server
private final ServerWorldProperties worldProperties
public boolean savingDisabled
private boolean allPlayersSleeping
private int idleTimeout
private final PortalForcer portalForcer
private final ServerTickScheduler<Block> blockTickScheduler
private final ServerTickScheduler<Fluid> fluidTickScheduler
private final Set<EntityNavigation> entityNavigations
protected final RaidManager raidManager
private final it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet<BlockEvent> syncedBlockEventQueue
private boolean inBlockTick
@Nullable private final EnderDragonFight enderDragonFight
private final StructureAccessor structureAccessor
private final boolean shouldTickTime
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)
public void setWeather(int clearDuration, int rainDuration, boolean raining, boolean thundering)
public Biome getGeneratorStoredBiome(int biomeX, int biomeY, int biomeZ)
getGeneratorStoredBiome
in interface WorldView
public StructureAccessor getStructureAccessor()
public void tick(BooleanSupplier shouldKeepTicking)
protected void tickTime()
public void setTimeOfDay(long timeOfDay)
public void tickSpawners(boolean spawnMonsters, boolean spawnAnimals)
private void wakeSleepingPlayers()
public void tickChunk(WorldChunk chunk, int randomTickSpeed)
public boolean isInBlockTick()
public void updateSleepingPlayers()
public ServerScoreboard getScoreboard()
getScoreboard
in class World
private void resetWeather()
public void resetIdleTimeout()
private void tickFluid(ScheduledTick<Fluid> tick)
private void tickBlock(ScheduledTick<Block> tick)
public void tickEntity(Entity entity)
public void checkEntityChunkPos(Entity entity)
public boolean canPlayerModifyAt(PlayerEntity player, BlockPos pos)
canPlayerModifyAt
in class World
public void save(@Nullable ProgressListener progressListener, boolean flush, boolean bool)
private void saveLevel()
public List<Entity> getEntitiesByType(@Nullable EntityType<?> type, Predicate<? super Entity> predicate)
null
is passed as the entity type filter, care should be
taken that the type argument T
is set to Entity
, otherwise heap pollution
in the returned list or ClassCastException
can occur.type
- the entity type of the returned entities, or null
for any type of entitypredicate
- a predicate which returned entities must satisfypublic List<EnderDragonEntity> getAliveEnderDragons()
public List<ServerPlayerEntity> getPlayers(Predicate<? super ServerPlayerEntity> predicate)
@Nullable public ServerPlayerEntity getRandomAlivePlayer()
public boolean spawnEntity(Entity entity)
spawnEntity
in interface ModifiableWorld
public boolean tryLoadEntity(Entity entity)
public void onDimensionChanged(Entity entity)
public void onPlayerTeleport(ServerPlayerEntity player)
public void onPlayerChangeDimension(ServerPlayerEntity player)
public void onPlayerConnected(ServerPlayerEntity player)
public void onPlayerRespawned(ServerPlayerEntity player)
private void addPlayer(ServerPlayerEntity player)
private boolean addEntity(Entity entity)
public boolean loadEntity(Entity entity)
private boolean checkUuid(Entity entity)
public boolean shouldCreateNewEntityWithPassenger(Entity entity)
public void unloadEntities(WorldChunk chunk)
public void unloadEntity(Entity entity)
private void loadEntityUnchecked(Entity entity)
public void removeEntity(Entity entity)
private void removeEntityFromChunk(Entity entity)
public void removePlayer(ServerPlayerEntity player)
public void setBlockBreakingInfo(int entityId, BlockPos pos, int progress)
setBlockBreakingInfo
in class World
public void playSound(@Nullable PlayerEntity player, double x, double y, double z, SoundEvent sound, SoundCategory category, float volume, float pitch)
public void playSoundFromEntity(@Nullable PlayerEntity player, Entity entity, SoundEvent sound, SoundCategory category, float volume, float pitch)
playSoundFromEntity
in class World
public void syncGlobalEvent(int eventId, BlockPos pos, int data)
syncGlobalEvent
in class World
public void syncWorldEvent(@Nullable PlayerEntity player, int eventId, BlockPos pos, int data)
syncWorldEvent
in interface WorldAccess
public void updateListeners(BlockPos pos, BlockState oldState, BlockState newState, int flags)
updateListeners
in class World
public void sendEntityStatus(Entity entity, byte status)
sendEntityStatus
in class World
public ServerChunkManager getChunkManager()
getChunkManager
in interface WorldAccess
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)
createExplosion
in class World
public void addSyncedBlockEvent(BlockPos pos, Block block, int type, int data)
addSyncedBlockEvent
in class World
private void processSyncedBlockEvents()
private boolean processBlockEvent(BlockEvent event)
public ServerTickScheduler<Block> getBlockTickScheduler()
getBlockTickScheduler
in interface WorldAccess
public ServerTickScheduler<Fluid> getFluidTickScheduler()
getFluidTickScheduler
in interface WorldAccess
@Nonnull public MinecraftServer getServer()
public PortalForcer getPortalForcer()
public StructureManager getStructureManager()
public <T extends ParticleEffect> int spawnParticles(T particle, double x, double y, double z, int count, double deltaX, double deltaY, double deltaZ, double speed)
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)
private boolean sendToPlayerIfNearby(ServerPlayerEntity player, boolean force, double x, double y, double z, Packet<?> packet)
@Nullable public Entity getEntityById(int id)
getEntityById
in class World
@Nullable public BlockPos locateStructure(StructureFeature<?> feature, BlockPos pos, int radius, boolean skipExistingChunks)
public RecipeManager getRecipeManager()
getRecipeManager
in class World
public TagManager getTagManager()
getTagManager
in class World
public boolean isSavingDisabled()
isSavingDisabled
in class World
public DynamicRegistryManager getRegistryManager()
getRegistryManager
in interface class_5423
public PersistentStateManager getPersistentStateManager()
@Nullable public MapState getMapState(String id)
getMapState
in class World
public void putMapState(MapState mapState)
putMapState
in class World
public int getNextMapId()
getNextMapId
in class World
public void setSpawnPos(BlockPos pos, float angle)
public BlockPos getSpawnPos()
public float getSpawnAngle()
public it.unimi.dsi.fastutil.longs.LongSet getForcedChunks()
public boolean setChunkForced(int x, int z, boolean forced)
public List<ServerPlayerEntity> getPlayers()
getPlayers
in interface EntityView
public void onBlockChanged(BlockPos pos, BlockState oldBlock, BlockState newBlock)
onBlockChanged
in class World
public PointOfInterestStorage getPointOfInterestStorage()
public boolean isNearOccupiedPointOfInterest(BlockPos pos)
public boolean isNearOccupiedPointOfInterest(ChunkSectionPos sectionPos)
public boolean isNearOccupiedPointOfInterest(BlockPos pos, int maxDistance)
public int getOccupiedPointOfInterestDistance(ChunkSectionPos pos)
public RaidManager getRaidManager()
public boolean hasRaidAt(BlockPos pos)
public void handleInteraction(EntityInteraction interaction, Entity entity, InteractionObserver observer)
public void dump(Path path) throws IOException
IOException
private void dumpBlockEntities(Writer writer) throws IOException
IOException
public void clearUpdatesInArea(BlockBox box)
public void updateNeighbors(BlockPos pos, Block block)
updateNeighbors
in interface WorldAccess
@Environment(value=CLIENT) public float getBrightness(Direction direction, boolean shaded)
getBrightness
in interface BlockRenderView
public boolean isFlat()
public long getSeed()
getSeed
in interface StructureWorldAccess
@Nullable public EnderDragonFight getEnderDragonFight()
public Stream<? extends StructureStart<?>> getStructures(ChunkSectionPos pos, StructureFeature<?> feature)
getStructures
in interface StructureWorldAccess
public ServerWorld toServerWorld()
toServerWorld
in interface ServerWorldAccess
public String method_31268()
private static <T> String method_31270(Collection<T> collection, Function<T,Identifier> function)
public static void createEndSpawnPlatform(ServerWorld world)