Class World

All Implemented Interfaces:
AutoCloseable, BiomeManager.IBiomeReader, IWorldGenerationBaseReader, IWorldGenerationReader, IBiomeReader, IBlockDisplayReader, IBlockReader, ICollisionReader, IDayTimeReader, IEntityReader, IWorld, IWorldReader, IWorldWriter, ICapabilityProvider, IForgeWorld
Direct Known Subclasses:
ClientWorld, ServerWorld

public abstract class World extends CapabilityProvider<World> implements IWorld, AutoCloseable, IForgeWorld
  • Field Details

    • LOGGER

      protected static final org.apache.logging.log4j.Logger LOGGER
    • RESOURCE_KEY_CODEC

      public static final com.mojang.serialization.Codec<RegistryKey<World>> RESOURCE_KEY_CODEC
    • OVERWORLD

      public static final RegistryKey<World> OVERWORLD
    • NETHER

      public static final RegistryKey<World> NETHER
    • END

      public static final RegistryKey<World> END
    • DIRECTIONS

      private static final Direction[] DIRECTIONS
    • blockEntityList

      public final List<TileEntity> blockEntityList
    • tickableBlockEntities

      public final List<TileEntity> tickableBlockEntities
    • pendingBlockEntities

      protected final List<TileEntity> pendingBlockEntities
    • blockEntitiesToUnload

      protected final Set<TileEntity> blockEntitiesToUnload
    • thread

      private final Thread thread
    • isDebug

      private final boolean isDebug
    • skyDarken

      private int skyDarken
    • randValue

      protected int randValue
    • addend

      protected final int addend
      See Also:
    • oRainLevel

      public float oRainLevel
    • rainLevel

      public float rainLevel
    • oThunderLevel

      public float oThunderLevel
    • thunderLevel

      public float thunderLevel
    • random

      public final Random random
    • dimensionType

      private final DimensionType dimensionType
    • levelData

      protected final ISpawnWorldInfo levelData
    • profiler

      private final Supplier<IProfiler> profiler
    • isClientSide

      public final boolean isClientSide
    • updatingBlockEntities

      protected boolean updatingBlockEntities
    • worldBorder

      private final WorldBorder worldBorder
    • biomeManager

      private final BiomeManager biomeManager
    • dimension

      private final RegistryKey<World> dimension
    • restoringBlockSnapshots

      public boolean restoringBlockSnapshots
    • captureBlockSnapshots

      public boolean captureBlockSnapshots
    • capturedBlockSnapshots

      public ArrayList<BlockSnapshot> capturedBlockSnapshots
    • maxEntityRadius

      private double maxEntityRadius
  • Constructor Details

  • Method Details

    • isClientSide

      public boolean isClientSide()
      Specified by:
      isClientSide in interface IWorldReader
    • getServer

      @Nullable public MinecraftServer getServer()
    • isInWorldBounds

      public static boolean isInWorldBounds(BlockPos p_175701_0_)
    • isInSpawnableBounds

      public static boolean isInSpawnableBounds(BlockPos p_234935_0_)
    • isInWorldBoundsHorizontal

      private static boolean isInWorldBoundsHorizontal(BlockPos p_234934_0_)
    • isOutsideSpawnableHeight

      private static boolean isOutsideSpawnableHeight(int p_234933_0_)
    • isOutsideBuildHeight

      public static boolean isOutsideBuildHeight(BlockPos p_189509_0_)
    • isOutsideBuildHeight

      public static boolean isOutsideBuildHeight(int p_217405_0_)
    • getChunkAt

      public Chunk getChunkAt(BlockPos p_175726_1_)
    • getChunk

      public Chunk getChunk(int p_212866_1_, int p_212866_2_)
      Specified by:
      getChunk in interface IWorldReader
    • getChunk

      public IChunk getChunk(int p_217353_1_, int p_217353_2_, ChunkStatus p_217353_3_, boolean p_217353_4_)
      Specified by:
      getChunk in interface IWorldReader
    • setBlock

      public boolean setBlock(BlockPos p_180501_1_, BlockState p_180501_2_, int p_180501_3_)
      Specified by:
      setBlock in interface IWorldWriter
    • setBlock

      public boolean setBlock(BlockPos p_241211_1_, BlockState p_241211_2_, int p_241211_3_, int p_241211_4_)
      Specified by:
      setBlock in interface IWorldWriter
    • markAndNotifyBlock

      public void markAndNotifyBlock(BlockPos p_241211_1_, @Nullable Chunk chunk, BlockState blockstate, BlockState p_241211_2_, int p_241211_3_, int p_241211_4_)
    • onBlockStateChange

      public void onBlockStateChange(BlockPos p_217393_1_, BlockState p_217393_2_, BlockState p_217393_3_)
    • removeBlock

      public boolean removeBlock(BlockPos p_217377_1_, boolean p_217377_2_)
      Specified by:
      removeBlock in interface IWorldWriter
    • destroyBlock

      public boolean destroyBlock(BlockPos p_241212_1_, boolean p_241212_2_, @Nullable Entity p_241212_3_, int p_241212_4_)
      Specified by:
      destroyBlock in interface IWorldWriter
    • setBlockAndUpdate

      public boolean setBlockAndUpdate(BlockPos p_175656_1_, BlockState p_175656_2_)
    • sendBlockUpdated

      public abstract void sendBlockUpdated(BlockPos p_184138_1_, BlockState p_184138_2_, BlockState p_184138_3_, int p_184138_4_)
    • setBlocksDirty

      public void setBlocksDirty(BlockPos p_225319_1_, BlockState p_225319_2_, BlockState p_225319_3_)
    • updateNeighborsAt

      public void updateNeighborsAt(BlockPos p_195593_1_, Block p_195593_2_)
    • updateNeighborsAtExceptFromFacing

      public void updateNeighborsAtExceptFromFacing(BlockPos p_175695_1_, Block p_175695_2_, Direction p_175695_3_)
    • neighborChanged

      public void neighborChanged(BlockPos p_190524_1_, Block p_190524_2_, BlockPos p_190524_3_)
    • getHeight

      public int getHeight(Heightmap.Type p_201676_1_, int p_201676_2_, int p_201676_3_)
      Specified by:
      getHeight in interface IWorldReader
    • getLightEngine

      public WorldLightManager getLightEngine()
      Specified by:
      getLightEngine in interface IBlockDisplayReader
    • getBlockState

      public BlockState getBlockState(BlockPos p_180495_1_)
      Specified by:
      getBlockState in interface IBlockReader
    • getFluidState

      public FluidState getFluidState(BlockPos p_204610_1_)
      Specified by:
      getFluidState in interface IBlockReader
    • isDay

      public boolean isDay()
    • isNight

      public boolean isNight()
    • playSound

      public void playSound(@Nullable PlayerEntity p_184133_1_, BlockPos p_184133_2_, SoundEvent p_184133_3_, SoundCategory p_184133_4_, float p_184133_5_, float p_184133_6_)
      Specified by:
      playSound in interface IWorld
    • playSound

      public abstract 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_)
    • playSound

      public abstract 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_)
    • playLocalSound

      public void playLocalSound(double p_184134_1_, double p_184134_3_, double p_184134_5_, SoundEvent p_184134_7_, SoundCategory p_184134_8_, float p_184134_9_, float p_184134_10_, boolean p_184134_11_)
    • addParticle

      public void addParticle(IParticleData p_195594_1_, double p_195594_2_, double p_195594_4_, double p_195594_6_, double p_195594_8_, double p_195594_10_, double p_195594_12_)
      Specified by:
      addParticle in interface IWorld
    • addParticle

      public void addParticle(IParticleData p_195590_1_, boolean p_195590_2_, double p_195590_3_, double p_195590_5_, double p_195590_7_, double p_195590_9_, double p_195590_11_, double p_195590_13_)
    • addAlwaysVisibleParticle

      public void addAlwaysVisibleParticle(IParticleData p_195589_1_, double p_195589_2_, double p_195589_4_, double p_195589_6_, double p_195589_8_, double p_195589_10_, double p_195589_12_)
    • addAlwaysVisibleParticle

      public void addAlwaysVisibleParticle(IParticleData p_217404_1_, boolean p_217404_2_, double p_217404_3_, double p_217404_5_, double p_217404_7_, double p_217404_9_, double p_217404_11_, double p_217404_13_)
    • getSunAngle

      public float getSunAngle(float p_72929_1_)
    • addBlockEntity

      public boolean addBlockEntity(TileEntity p_175700_1_)
    • addAllPendingBlockEntities

      public void addAllPendingBlockEntities(Collection<TileEntity> p_147448_1_)
    • tickBlockEntities

      public void tickBlockEntities()
    • guardEntityTick

      public void guardEntityTick(Consumer<Entity> p_217390_1_, Entity p_217390_2_)
    • explode

      public Explosion explode(@Nullable Entity p_217385_1_, double p_217385_2_, double p_217385_4_, double p_217385_6_, float p_217385_8_, Explosion.Mode p_217385_9_)
    • explode

      public Explosion explode(@Nullable Entity p_217398_1_, double p_217398_2_, double p_217398_4_, double p_217398_6_, float p_217398_8_, boolean p_217398_9_, Explosion.Mode p_217398_10_)
    • 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_)
    • gatherChunkSourceStats

      public String gatherChunkSourceStats()
    • getBlockEntity

      @Nullable public TileEntity getBlockEntity(BlockPos p_175625_1_)
      Specified by:
      getBlockEntity in interface IBlockReader
    • getPendingBlockEntityAt

      @Nullable private TileEntity getPendingBlockEntityAt(BlockPos p_189508_1_)
    • setBlockEntity

      public void setBlockEntity(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_)
    • removeBlockEntity

      public void removeBlockEntity(BlockPos p_175713_1_)
    • isLoaded

      public boolean isLoaded(BlockPos p_195588_1_)
    • loadedAndEntityCanStandOnFace

      public boolean loadedAndEntityCanStandOnFace(BlockPos p_234929_1_, Entity p_234929_2_, Direction p_234929_3_)
    • loadedAndEntityCanStandOn

      public boolean loadedAndEntityCanStandOn(BlockPos p_217400_1_, Entity p_217400_2_)
    • updateSkyBrightness

      public void updateSkyBrightness()
    • setSpawnSettings

      public void setSpawnSettings(boolean p_72891_1_, boolean p_72891_2_)
    • prepareWeather

      protected void prepareWeather()
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • getChunkForCollisions

      @Nullable public IBlockReader getChunkForCollisions(int p_225522_1_, int p_225522_2_)
      Specified by:
      getChunkForCollisions in interface ICollisionReader
      Specified by:
      getChunkForCollisions in interface IWorldReader
    • getEntities

      public List<Entity> getEntities(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate<? super Entity> p_175674_3_)
      Specified by:
      getEntities in interface IEntityReader
    • getEntities

      public <T extends Entity> List<T> getEntities(@Nullable EntityType<T> p_217394_1_, AxisAlignedBB p_217394_2_, Predicate<? super T> p_217394_3_)
    • getEntitiesOfClass

      public <T extends Entity> List<T> getEntitiesOfClass(Class<? extends T> p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate<? super T> p_175647_3_)
      Specified by:
      getEntitiesOfClass in interface IEntityReader
    • getLoadedEntitiesOfClass

      public <T extends Entity> List<T> getLoadedEntitiesOfClass(Class<? extends T> p_225316_1_, AxisAlignedBB p_225316_2_, @Nullable Predicate<? super T> p_225316_3_)
      Specified by:
      getLoadedEntitiesOfClass in interface IEntityReader
    • getEntity

      @Nullable public abstract Entity getEntity(int p_73045_1_)
    • blockEntityChanged

      public void blockEntityChanged(BlockPos p_175646_1_, TileEntity p_175646_2_)
    • getSeaLevel

      public int getSeaLevel()
      Specified by:
      getSeaLevel in interface IWorldReader
    • getDirectSignalTo

      public int getDirectSignalTo(BlockPos p_175676_1_)
    • hasSignal

      public boolean hasSignal(BlockPos p_175709_1_, Direction p_175709_2_)
    • getSignal

      public int getSignal(BlockPos p_175651_1_, Direction p_175651_2_)
    • hasNeighborSignal

      public boolean hasNeighborSignal(BlockPos p_175640_1_)
    • getBestNeighborSignal

      public int getBestNeighborSignal(BlockPos p_175687_1_)
    • disconnect

      public void disconnect()
    • getGameTime

      public long getGameTime()
    • getDayTime

      public long getDayTime()
    • mayInteract

      public boolean mayInteract(PlayerEntity p_175660_1_, BlockPos p_175660_2_)
    • broadcastEntityEvent

      public void broadcastEntityEvent(Entity p_72960_1_, byte p_72960_2_)
    • blockEvent

      public void blockEvent(BlockPos p_175641_1_, Block p_175641_2_, int p_175641_3_, int p_175641_4_)
    • getLevelData

      public IWorldInfo getLevelData()
      Specified by:
      getLevelData in interface IWorld
    • getGameRules

      public GameRules getGameRules()
    • getThunderLevel

      public float getThunderLevel(float p_72819_1_)
    • setThunderLevel

      public void setThunderLevel(float p_147442_1_)
    • getRainLevel

      public float getRainLevel(float p_72867_1_)
    • setRainLevel

      public void setRainLevel(float p_72894_1_)
    • isThundering

      public boolean isThundering()
    • isRaining

      public boolean isRaining()
    • isRainingAt

      public boolean isRainingAt(BlockPos p_175727_1_)
    • isHumidAt

      public boolean isHumidAt(BlockPos p_180502_1_)
    • getMapData

      @Nullable public abstract MapData getMapData(String p_217406_1_)
    • setMapData

      public abstract void setMapData(MapData p_217399_1_)
    • getFreeMapId

      public abstract int getFreeMapId()
    • globalLevelEvent

      public void globalLevelEvent(int p_175669_1_, BlockPos p_175669_2_, int p_175669_3_)
    • fillReportDetails

      public CrashReportCategory fillReportDetails(CrashReport p_72914_1_)
    • destroyBlockProgress

      public abstract void destroyBlockProgress(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_)
    • createFireworks

      public void createFireworks(double p_92088_1_, double p_92088_3_, double p_92088_5_, double p_92088_7_, double p_92088_9_, double p_92088_11_, @Nullable CompoundNBT p_92088_13_)
    • getScoreboard

      public abstract Scoreboard getScoreboard()
    • updateNeighbourForOutputSignal

      public void updateNeighbourForOutputSignal(BlockPos p_175666_1_, Block p_175666_2_)
    • getCurrentDifficultyAt

      public DifficultyInstance getCurrentDifficultyAt(BlockPos p_175649_1_)
      Specified by:
      getCurrentDifficultyAt in interface IWorld
    • getSkyDarken

      public int getSkyDarken()
      Specified by:
      getSkyDarken in interface IWorldReader
    • setSkyFlashTime

      public void setSkyFlashTime(int p_225605_1_)
    • getWorldBorder

      public WorldBorder getWorldBorder()
      Specified by:
      getWorldBorder in interface ICollisionReader
    • sendPacketToServer

      public void sendPacketToServer(IPacket<?> p_184135_1_)
    • dimensionType

      public DimensionType dimensionType()
      Specified by:
      dimensionType in interface IWorldReader
    • dimension

      public RegistryKey<World> dimension()
    • getRandom

      public Random getRandom()
      Specified by:
      getRandom in interface IWorld
    • isStateAtPosition

      public boolean isStateAtPosition(BlockPos p_217375_1_, Predicate<BlockState> p_217375_2_)
      Specified by:
      isStateAtPosition in interface IWorldGenerationBaseReader
    • getRecipeManager

      public abstract RecipeManager getRecipeManager()
    • getTagManager

      public abstract ITagCollectionSupplier getTagManager()
    • getBlockRandomPos

      public BlockPos getBlockRandomPos(int p_217383_1_, int p_217383_2_, int p_217383_3_, int p_217383_4_)
    • noSave

      public boolean noSave()
    • getProfiler

      public IProfiler getProfiler()
    • getProfilerSupplier

      public Supplier<IProfiler> getProfilerSupplier()
    • getBiomeManager

      public BiomeManager getBiomeManager()
      Specified by:
      getBiomeManager in interface IWorldReader
    • getMaxEntityRadius

      public double getMaxEntityRadius()
      Description copied from interface: IForgeWorld
      The maximum radius to scan for entities when trying to check bounding boxes. Vanilla's default is 2.0D But mods that add larger entities may increase this.
      Specified by:
      getMaxEntityRadius in interface IForgeWorld
    • increaseMaxEntityRadius

      public double increaseMaxEntityRadius(double value)
      Description copied from interface: IForgeWorld
      Increases the max entity radius, this is safe to call with any value. The setter will verify the input value is larger then the current setting.
      Specified by:
      increaseMaxEntityRadius in interface IForgeWorld
      Parameters:
      value - New max radius to set.
      Returns:
      The new max radius
    • isDebug

      public final boolean isDebug()