Class ServerWorld

All Implemented Interfaces:
AutoCloseable, BiomeManager.IBiomeReader, IWorldGenerationBaseReader, IWorldGenerationReader, IBiomeReader, IBlockDisplayReader, IBlockReader, ICollisionReader, IDayTimeReader, IEntityReader, ISeedReader, IServerWorld, IWorld, IWorldReader, IWorldWriter, ICapabilityProvider, IForgeWorld, IForgeWorldServer

public class ServerWorld extends World implements ISeedReader, IForgeWorldServer
  • Field Details

    • END_SPAWN_POINT

      public static final BlockPos END_SPAWN_POINT
    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
    • entitiesById

      private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<Entity> entitiesById
    • entitiesByUuid

      private final Map<UUID,Entity> entitiesByUuid
    • toAddAfterTick

      private final Queue<Entity> toAddAfterTick
    • players

      private final List<ServerPlayerEntity> players
    • chunkSource

      private final ServerChunkProvider chunkSource
    • tickingEntities

      boolean tickingEntities
    • server

      private final MinecraftServer server
    • serverLevelData

      private final IServerWorldInfo serverLevelData
    • noSave

      public boolean noSave
    • allPlayersSleeping

      private boolean allPlayersSleeping
    • emptyTime

      private int emptyTime
    • portalForcer

      private final Teleporter portalForcer
    • blockTicks

      private final ServerTickList<Block> blockTicks
    • liquidTicks

      private final ServerTickList<Fluid> liquidTicks
    • raids

      protected final RaidManager raids
    • blockEvents

      private final it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet<BlockEventData> blockEvents
    • handlingTick

      private boolean handlingTick
    • customSpawners

      private final List<ISpecialSpawner> customSpawners
    • dragonFight

      @Nullable private final DragonFightManager dragonFight
    • structureFeatureManager

      private final StructureManager structureFeatureManager
    • tickTime

      private final boolean tickTime
    • capabilityData

      private WorldCapabilityData capabilityData
    • partEntities

      private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<PartEntity<?>> partEntities
  • Constructor Details

  • Method Details

    • setWeatherParameters

      public void setWeatherParameters(int p_241113_1_, int p_241113_2_, boolean p_241113_3_, boolean p_241113_4_)
    • getUncachedNoiseBiome

      public Biome getUncachedNoiseBiome(int p_225604_1_, int p_225604_2_, int p_225604_3_)
      Specified by:
      getUncachedNoiseBiome in interface IWorldReader
    • structureFeatureManager

      public StructureManager structureFeatureManager()
    • tick

      public void tick(BooleanSupplier p_72835_1_)
    • tickTime

      protected void tickTime()
    • setDayTime

      public void setDayTime(long p_241114_1_)
    • tickCustomSpawners

      public void tickCustomSpawners(boolean p_241123_1_, boolean p_241123_2_)
    • wakeUpAllPlayers

      private void wakeUpAllPlayers()
    • tickChunk

      public void tickChunk(Chunk p_217441_1_, int p_217441_2_)
    • findLightingTargetAround

      protected BlockPos findLightingTargetAround(BlockPos p_175736_1_)
    • isHandlingTick

      public boolean isHandlingTick()
    • updateSleepingPlayerList

      public void updateSleepingPlayerList()
    • getScoreboard

      public ServerScoreboard getScoreboard()
      Specified by:
      getScoreboard in class World
    • stopWeather

      private void stopWeather()
    • resetEmptyTime

      public void resetEmptyTime()
    • tickLiquid

      private void tickLiquid(NextTickListEntry<Fluid> p_205339_1_)
    • tickBlock

      private void tickBlock(NextTickListEntry<Block> p_205338_1_)
    • tickNonPassenger

      public void tickNonPassenger(Entity p_217479_1_)
    • tickPassenger

      public void tickPassenger(Entity p_217459_1_, Entity p_217459_2_)
    • updateChunkPos

      public void updateChunkPos(Entity p_217464_1_)
    • mayInteract

      public boolean mayInteract(PlayerEntity p_175660_1_, BlockPos p_175660_2_)
      Overrides:
      mayInteract in class World
    • save

      public void save(@Nullable IProgressUpdate p_217445_1_, boolean p_217445_2_, boolean p_217445_3_)
    • saveLevelData

      private void saveLevelData()
    • getEntities

      public List<Entity> getEntities(@Nullable EntityType<?> p_217482_1_, Predicate<? super Entity> p_217482_2_)
    • getDragons

      public List<EnderDragonEntity> getDragons()
    • getPlayers

      public List<ServerPlayerEntity> getPlayers(Predicate<? super ServerPlayerEntity> p_217490_1_)
    • getRandomPlayer

      @Nullable public ServerPlayerEntity getRandomPlayer()
    • addFreshEntity

      public boolean addFreshEntity(Entity p_217376_1_)
      Specified by:
      addFreshEntity in interface IWorldWriter
    • addWithUUID

      public boolean addWithUUID(Entity p_217470_1_)
    • addFromAnotherDimension

      public void addFromAnotherDimension(Entity p_217460_1_)
    • addDuringCommandTeleport

      public void addDuringCommandTeleport(ServerPlayerEntity p_217446_1_)
    • addDuringPortalTeleport

      public void addDuringPortalTeleport(ServerPlayerEntity p_217447_1_)
    • addNewPlayer

      public void addNewPlayer(ServerPlayerEntity p_217435_1_)
    • addRespawnedPlayer

      public void addRespawnedPlayer(ServerPlayerEntity p_217433_1_)
    • addPlayer

      private void addPlayer(ServerPlayerEntity p_217448_1_)
    • addEntity

      private boolean addEntity(Entity p_72838_1_)
    • loadFromChunk

      public boolean loadFromChunk(Entity p_217440_1_)
    • isUUIDUsed

      private boolean isUUIDUsed(Entity p_217478_1_)
    • findAddedOrPendingEntity

      @Nullable private Entity findAddedOrPendingEntity(UUID p_242105_1_)
    • tryAddFreshEntityWithPassengers

      public boolean tryAddFreshEntityWithPassengers(Entity p_242106_1_)
    • unload

      public void unload(Chunk p_217466_1_)
    • onEntityRemoved

      @Deprecated public void onEntityRemoved(Entity p_217484_1_)
      Deprecated.
    • removeEntityComplete

      public void removeEntityComplete(Entity p_217484_1_, boolean keepData)
    • add

      private void add(Entity p_217465_1_)
    • despawn

      public void despawn(Entity p_217467_1_)
    • removeEntity

      public void removeEntity(Entity p_217467_1_, boolean keepData)
    • removeFromChunk

      private void removeFromChunk(Entity p_217454_1_)
    • removePlayerImmediately

      public void removePlayerImmediately(ServerPlayerEntity p_217434_1_)
    • removePlayer

      public void removePlayer(ServerPlayerEntity p_217434_1_, boolean keepData)
    • destroyBlockProgress

      public void destroyBlockProgress(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_)
      Specified by:
      destroyBlockProgress in class World
    • playSound

      public void playSound(@Nullable PlayerEntity p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_)
      Specified by:
      playSound in class World
    • playSound

      public void playSound(@Nullable PlayerEntity p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, SoundCategory p_217384_4_, float p_217384_5_, float p_217384_6_)
      Specified by:
      playSound in class World
    • globalLevelEvent

      public void globalLevelEvent(int p_175669_1_, BlockPos p_175669_2_, int p_175669_3_)
      Overrides:
      globalLevelEvent in class World
    • levelEvent

      public void levelEvent(@Nullable PlayerEntity p_217378_1_, int p_217378_2_, BlockPos p_217378_3_, int p_217378_4_)
      Specified by:
      levelEvent in interface IWorld
    • sendBlockUpdated

      public void sendBlockUpdated(BlockPos p_184138_1_, BlockState p_184138_2_, BlockState p_184138_3_, int p_184138_4_)
      Specified by:
      sendBlockUpdated in class World
    • broadcastEntityEvent

      public void broadcastEntityEvent(Entity p_72960_1_, byte p_72960_2_)
      Overrides:
      broadcastEntityEvent in class World
    • getChunkSource

      public ServerChunkProvider getChunkSource()
      Specified by:
      getChunkSource in interface IWorld
    • explode

      public Explosion explode(@Nullable Entity p_230546_1_, @Nullable DamageSource p_230546_2_, @Nullable ExplosionContext p_230546_3_, double p_230546_4_, double p_230546_6_, double p_230546_8_, float p_230546_10_, boolean p_230546_11_, Explosion.Mode p_230546_12_)
      Overrides:
      explode in class World
    • blockEvent

      public void blockEvent(BlockPos p_175641_1_, Block p_175641_2_, int p_175641_3_, int p_175641_4_)
      Overrides:
      blockEvent in class World
    • runBlockEvents

      private void runBlockEvents()
    • doBlockEvent

      private boolean doBlockEvent(BlockEventData p_147485_1_)
    • getBlockTicks

      public ServerTickList<Block> getBlockTicks()
      Specified by:
      getBlockTicks in interface IWorld
    • getLiquidTicks

      public ServerTickList<Fluid> getLiquidTicks()
      Specified by:
      getLiquidTicks in interface IWorld
    • getServer

      @Nonnull public MinecraftServer getServer()
      Overrides:
      getServer in class World
    • getPortalForcer

      public Teleporter getPortalForcer()
    • getStructureManager

      public TemplateManager getStructureManager()
    • sendParticles

      public <T extends IParticleData> int sendParticles(T p_195598_1_, double p_195598_2_, double p_195598_4_, double p_195598_6_, int p_195598_8_, double p_195598_9_, double p_195598_11_, double p_195598_13_, double p_195598_15_)
    • sendParticles

      public <T extends IParticleData> boolean sendParticles(ServerPlayerEntity p_195600_1_, T p_195600_2_, boolean p_195600_3_, double p_195600_4_, double p_195600_6_, double p_195600_8_, int p_195600_10_, double p_195600_11_, double p_195600_13_, double p_195600_15_, double p_195600_17_)
    • sendParticles

      private boolean sendParticles(ServerPlayerEntity p_195601_1_, boolean p_195601_2_, double p_195601_3_, double p_195601_5_, double p_195601_7_, IPacket<?> p_195601_9_)
    • getEntity

      @Nullable public Entity getEntity(int p_73045_1_)
      Specified by:
      getEntity in class World
    • getEntity

      @Nullable public Entity getEntity(UUID p_217461_1_)
    • findNearestMapFeature

      @Nullable public BlockPos findNearestMapFeature(Structure<?> p_241117_1_, BlockPos p_241117_2_, int p_241117_3_, boolean p_241117_4_)
    • findNearestBiome

      @Nullable public BlockPos findNearestBiome(Biome p_241116_1_, BlockPos p_241116_2_, int p_241116_3_, int p_241116_4_)
    • getRecipeManager

      public RecipeManager getRecipeManager()
      Specified by:
      getRecipeManager in class World
    • getTagManager

      public ITagCollectionSupplier getTagManager()
      Specified by:
      getTagManager in class World
    • noSave

      public boolean noSave()
      Overrides:
      noSave in class World
    • registryAccess

      public DynamicRegistries registryAccess()
      Specified by:
      registryAccess in interface IBiomeReader
    • getDataStorage

      public DimensionSavedDataManager getDataStorage()
    • getMapData

      @Nullable public MapData getMapData(String p_217406_1_)
      Specified by:
      getMapData in class World
    • setMapData

      public void setMapData(MapData p_217399_1_)
      Specified by:
      setMapData in class World
    • getFreeMapId

      public int getFreeMapId()
      Specified by:
      getFreeMapId in class World
    • setDefaultSpawnPos

      public void setDefaultSpawnPos(BlockPos p_241124_1_, float p_241124_2_)
    • getSharedSpawnPos

      public BlockPos getSharedSpawnPos()
    • getSharedSpawnAngle

      public float getSharedSpawnAngle()
    • getForcedChunks

      public it.unimi.dsi.fastutil.longs.LongSet getForcedChunks()
    • setChunkForced

      public boolean setChunkForced(int p_217458_1_, int p_217458_2_, boolean p_217458_3_)
    • players

      public List<ServerPlayerEntity> players()
      Specified by:
      players in interface IEntityReader
    • onBlockStateChange

      public void onBlockStateChange(BlockPos p_217393_1_, BlockState p_217393_2_, BlockState p_217393_3_)
      Overrides:
      onBlockStateChange in class World
    • getPoiManager

      public PointOfInterestManager getPoiManager()
    • isVillage

      public boolean isVillage(BlockPos p_217483_1_)
    • isVillage

      public boolean isVillage(SectionPos p_222887_1_)
    • isCloseToVillage

      public boolean isCloseToVillage(BlockPos p_241119_1_, int p_241119_2_)
    • sectionsToVillage

      public int sectionsToVillage(SectionPos p_217486_1_)
    • getRaids

      public RaidManager getRaids()
    • getRaidAt

      @Nullable public Raid getRaidAt(BlockPos p_217475_1_)
    • isRaided

      public boolean isRaided(BlockPos p_217455_1_)
    • onReputationEvent

      public void onReputationEvent(IReputationType p_217489_1_, Entity p_217489_2_, IReputationTracking p_217489_3_)
    • saveDebugReport

      public void saveDebugReport(Path p_225322_1_) throws IOException
      Throws:
      IOException
    • dumpEntities

      private static void dumpEntities(Writer p_225320_0_, Iterable<Entity> p_225320_1_) throws IOException
      Throws:
      IOException
    • dumpBlockEntities

      private void dumpBlockEntities(Writer p_225321_1_) throws IOException
      Throws:
      IOException
    • clearBlockEvents

      public void clearBlockEvents(MutableBoundingBox p_229854_1_)
    • blockUpdated

      public void blockUpdated(BlockPos p_230547_1_, Block p_230547_2_)
      Specified by:
      blockUpdated in interface IWorld
    • getShade

      public float getShade(Direction p_230487_1_, boolean p_230487_2_)
      Specified by:
      getShade in interface IBlockDisplayReader
    • getAllEntities

      public Iterable<Entity> getAllEntities()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isFlat

      public boolean isFlat()
    • getSeed

      public long getSeed()
      Specified by:
      getSeed in interface ISeedReader
    • dragonFight

      @Nullable public DragonFightManager dragonFight()
    • startsForFeature

      public Stream<? extends StructureStart<?>> startsForFeature(SectionPos p_241827_1_, Structure<?> p_241827_2_)
      Specified by:
      startsForFeature in interface ISeedReader
    • getLevel

      public ServerWorld getLevel()
      Specified by:
      getLevel in interface IServerWorld
    • getWatchdogStats

      public String getWatchdogStats()
    • getTypeCount

      private static <T> String getTypeCount(Collection<T> p_244524_0_, Function<T,ResourceLocation> p_244524_1_)
    • makeObsidianPlatform

      public static void makeObsidianPlatform(ServerWorld p_241121_0_)
    • initCapabilities

      protected void initCapabilities()
    • getEntities

      public Stream<Entity> getEntities()
    • getPartEntities

      public Collection<PartEntity<?>> getPartEntities()
      Description copied from interface: IForgeWorld
      All part entities in this world. Used when collecting entities in an AABB to fix parts being ignored whose parent entity is in a chunk that does not intersect with the AABB.
      Specified by:
      getPartEntities in interface IForgeWorld