Class World
- All Implemented Interfaces:
AutoCloseable,BiomeAccess.Storage,BlockRenderView,BlockView,CollisionView,EntityView,ModifiableTestableWorld,ModifiableWorld,TestableWorld,WorldAccess,WorldView
- Direct Known Subclasses:
ClientWorld,ServerWorld
public abstract class World extends Object implements WorldAccess, AutoCloseable
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedWorld(MutableWorldProperties mutableWorldProperties, RegistryKey<World> registryKey, RegistryKey<DimensionType> registryKey2, DimensionType dimensionType, Supplier<Profiler> profiler, boolean bool, boolean bool2, long long2) -
Method Summary
Modifier and Type Method Description voidaddBlockEntities(Collection<BlockEntity> blockEntities)booleanaddBlockEntity(BlockEntity blockEntity)CrashReportSectionaddDetailsToCrashReport(CrashReport report)voidaddFireworkParticle(double x, double y, double z, double velocityX, double velocityY, double velocityZ, CompoundTag tag)voidaddImportantParticle(ParticleEffect parameters, boolean alwaysSpawn, double x, double y, double z, double velocityX, double velocityY, double velocityZ)voidaddImportantParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)voidaddParticle(ParticleEffect parameters, boolean alwaysSpawn, double x, double y, double z, double velocityX, double velocityY, double velocityZ)voidaddParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)voidaddSyncedBlockEvent(BlockPos pos, Block block, int type, int data)voidcalculateAmbientDarkness()booleancanPlayerModifyAt(PlayerEntity player, BlockPos pos)booleancanSetBlock(BlockPos pos)voidclose()ExplosioncreateExplosion(Entity entity, double x, double y, double z, float power, boolean createFire, Explosion.DestructionType destructionType)ExplosioncreateExplosion(Entity entity, double x, double y, double z, float power, Explosion.DestructionType destructionType)ExplosioncreateExplosion(Entity entity, DamageSource damageSource, ExplosionBehavior explosionBehavior, double double2, double double3, double double4, float float2, boolean bool, Explosion.DestructionType destructionType)voiddisconnect()intgetAmbientDarkness()BiomeAccessgetBiomeAccess()BlockEntitygetBlockEntity(BlockPos pos)BlockStategetBlockState(BlockPos pos)WorldChunkgetChunk(int int2, int int3)ChunkgetChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create)doublegetCollisionHeightAt(BlockPos pos)doublegetCollisionHeightAt(BlockPos pos, Predicate<BlockState> predicate)StringgetDebugString()DimensionTypegetDimension()RegistryKey<DimensionType>getDimensionRegistryKey()intgetEmittedRedstonePower(BlockPos pos, Direction direction)<T extends Entity>
List<T>getEntities(Class<? extends T> entityClass, Box box, Predicate<? super T> predicate)List<Entity>getEntities(Entity except, Box box, Predicate<? super Entity> predicate)<T extends Entity>
List<T>getEntities(EntityType<T> type, Box box, Predicate<? super T> predicate)<T extends Entity>
List<T>getEntitiesIncludingUngeneratedChunks(Class<? extends T> entityClass, Box box, Predicate<? super T> predicate)abstract EntitygetEntityById(int id)BlockViewgetExistingChunk(int chunkX, int chunkZ)FluidStategetFluidState(BlockPos pos)GameRulesgetGameRules()WorldPropertiesgetLevelProperties()LightingProvidergetLightingProvider()LocalDifficultygetLocalDifficulty(BlockPos pos)abstract MapStategetMapState(String id)abstract intgetNextMapId()private BlockEntitygetPendingBlockEntity(BlockPos pos)ProfilergetProfiler()Supplier<Profiler>getProfilerSupplier()floatgetRainGradient(float delta)RandomgetRandom()BlockPosgetRandomPosInChunk(int x, int y, int z, int int2)intgetReceivedRedstonePower(BlockPos pos)intgetReceivedStrongRedstonePower(BlockPos pos)abstract RecipeManagergetRecipeManager()RegistryKey<World>getRegistryKey()abstract ScoreboardgetScoreboard()intgetSeaLevel()MinecraftServergetServer()floatgetSkyAngleRadians(float tickDelta)abstract RegistryTagManagergetTagManager()floatgetThunderGradient(float delta)longgetTime()longgetTimeOfDay()intgetTopY(Heightmap.Type heightmap, int x, int z)WorldgetWorld()WorldBordergetWorldBorder()WorldChunkgetWorldChunk(BlockPos pos)booleanhasHighHumidity(BlockPos pos)booleanhasRain(BlockPos pos)protected voidinitWeatherGradients()booleanisClient()Checks if this world view is on the logical client.booleanisDay()booleanisDebugWorld()booleanisDirectionSolid(BlockPos pos, Entity entity, Direction direction)booleanisEmittingRedstonePower(BlockPos pos, Direction direction)static booleanisHeightInvalid(int y)static booleanisHeightInvalid(BlockPos pos)booleanisNight()booleanisRaining()booleanisReceivingRedstonePower(BlockPos pos)booleanisSavingDisabled()booleanisThundering()booleanisTopSolid(BlockPos pos, Entity entity)private static booleanisValid(BlockPos pos)voidmarkDirty(BlockPos pos, BlockEntity blockEntity)static booleanmethod_24794(BlockPos blockPos)private static booleanmethod_25952(int int2)static booleanmethod_25953(BlockPos blockPos)doublemethod_26096(BlockPos blockPos, double double2)booleanmethod_30093(BlockPos blockPos, boolean bool, Entity entity, int int2)voidonBlockChanged(BlockPos pos, BlockState oldBlock, BlockState newBlock)voidplaySound(double x, double y, double z, SoundEvent sound, SoundCategory category, float volume, float pitch, boolean bool)abstract voidplaySound(PlayerEntity player, double x, double y, double z, SoundEvent sound, SoundCategory category, float volume, float pitch)voidplaySound(PlayerEntity player, BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch)abstract voidplaySoundFromEntity(PlayerEntity player, Entity entity, SoundEvent sound, SoundCategory category, float volume, float pitch)abstract voidputMapState(MapState mapState)booleanremoveBlock(BlockPos pos, boolean move)voidremoveBlockEntity(BlockPos pos)voidscheduleBlockRerenderIfNeeded(BlockPos pos, BlockState old, BlockState updated)voidsendEntityStatus(Entity entity, byte status)voidsendPacket(Packet<?> packet)abstract voidsetBlockBreakingInfo(int entityId, BlockPos pos, int progress)voidsetBlockEntity(BlockPos pos, BlockEntity blockEntity)booleansetBlockState(BlockPos pos, BlockState state)booleansetBlockState(BlockPos pos, BlockState state, int flags)Updates the block state at a position, calling appropriate callbacks.booleansetBlockState(BlockPos pos, BlockState state, int flags, int maxUpdateDepth)Updates the block state at a position, calling appropriate callbacks.voidsetLightningTicksLeft(int lightningTicksLeft)voidsetMobSpawnOptions(boolean spawnMonsters, boolean spawnAnimals)voidsetRainGradient(float rainGradient)voidsetThunderGradient(float thunderGradient)voidsyncGlobalEvent(int eventId, BlockPos pos, int data)booleantestBlockState(BlockPos pos, Predicate<BlockState> state)voidtickBlockEntities()voidtickEntity(Consumer<Entity> tickConsumer, Entity entity)voidupdateComparators(BlockPos pos, Block block)abstract voidupdateListeners(BlockPos pos, BlockState oldState, BlockState newState, int flags)voidupdateNeighbor(BlockPos sourcePos, Block sourceBlock, BlockPos neighborPos)voidupdateNeighborsAlways(BlockPos pos, Block block)voidupdateNeighborsExcept(BlockPos pos, Block sourceBlock, Direction direction)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.BlockRenderView
getBaseLightLevel, getBrightness, getLightLevel, isSkyVisibleMethods inherited from interface net.minecraft.world.BlockView
getHeight, getLuminance, getMaxLightLevel, method_29546, rayTrace, rayTraceBlockMethods inherited from interface net.minecraft.world.CollisionView
canPlace, doesNotCollide, doesNotCollide, doesNotCollide, doesNotCollide, getBlockCollisions, getCollisions, intersectsEntities, method_30030Methods inherited from interface net.minecraft.world.EntityView
getClosestEntity, getClosestEntity, getClosestEntityIncludingUngeneratedChunks, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getEntities, getEntitiesIncludingUngeneratedChunks, getNonSpectatingEntities, getPlayerByUuid, getPlayers, getPlayers, getTargets, isPlayerInRangeMethods inherited from interface net.minecraft.world.ModifiableWorld
breakBlock, breakBlock, spawnEntityMethods inherited from interface net.minecraft.world.WorldAccess
getBlockTickScheduler, getChunkManager, getDifficulty, getDimensionHeight, getEntityCollisions, getFluidTickScheduler, getMoonPhase, getMoonSize, getSkyAngle, getTopPosition, intersectsEntities, isChunkLoaded, syncWorldEvent, syncWorldEvent, updateNeighborsMethods inherited from interface net.minecraft.world.WorldView
containsFluid, getBiome, getBiomeForNoiseGen, getBrightness, getChunk, getChunk, getColor, getGeneratorStoredBiome, getLightLevel, getLightLevel, getStrongRedstonePower, isAir, isChunkLoaded, isRegionLoaded, isRegionLoaded, isSkyVisibleAllowingSea, isWater, method_29556
-
Field Details
-
LOGGER
-
CODEC
-
OVERWORLD
-
NETHER
-
END
-
DIRECTIONS
-
blockEntities
-
tickingBlockEntities
-
pendingBlockEntities
-
unloadedBlockEntities
-
thread
-
debugWorld
private final boolean debugWorld -
ambientDarkness
private int ambientDarkness -
lcgBlockSeed
protected int lcgBlockSeed -
unusedIncrement
protected final int unusedIncrement- See Also:
- Constant Field Values
-
rainGradientPrev
protected float rainGradientPrev -
rainGradient
protected float rainGradient -
thunderGradientPrev
protected float thunderGradientPrev -
thunderGradient
protected float thunderGradient -
random
-
dimension
-
properties
-
profiler
-
isClient
public final boolean isClient -
iteratingTickingBlockEntities
protected boolean iteratingTickingBlockEntities -
border
-
biomeAccess
-
registryKey
-
dimensionRegistryKey
-
-
Constructor Details
-
World
protected World(MutableWorldProperties mutableWorldProperties, RegistryKey<World> registryKey, RegistryKey<DimensionType> registryKey2, DimensionType dimensionType, Supplier<Profiler> profiler, boolean bool, boolean bool2, long long2)
-
-
Method Details
-
isClient
public boolean isClient()Checks if this world view is on the logical client.If the value returned is false, it is expected that this world is present on a logical server.
-
getServer
-
method_24794
-
method_25953
-
isValid
-
method_25952
private static boolean method_25952(int int2) -
isHeightInvalid
-
isHeightInvalid
public static boolean isHeightInvalid(int y) -
getCollisionHeightAt
-
getCollisionHeightAt
-
method_26096
-
getWorldChunk
-
getChunk
-
getChunk
-
setBlockState
Updates the block state at a position, calling appropriate callbacks.When called on the server, the new block state is stored and propagated to clients and listeners as dictated by the supplied flags. Note that calling this on the client will update the world locally, but may not see the change persisted across loads. It's recommended to check whether this world is client before interacting with the world in this way.
Accepted values of the flags are a bitset combination of the following:
- 0b0000001 // 1 - PROPAGATE_CHANGE - Propagates a change event to surrounding blocks.
- 0b0000010 // 2 - NOTIFY_LISTENERS - Notifies listeners and clients who need to react when the block changes
- 0b0000100 // 4 - NO_REDRAW - Used in conjunction with NOTIFY_LISTENERS to suppress the render pass on clients.
- 0b0001000 // 8 - REDRAW_ON_MAIN_THREAD - Forces a synchronous redraw on clients.
- 0b0010000 // 16 - FORCE_STATE - Bypass virtual blockstate changes and forces the passed state to be stored as-is.
- 0b0100000 // 32 - SKIP_DROPS - Prevents the previous block (container) from dropping items when destroyed.
- 0b1000000 // 64 - MOVED - Signals that the current block is being moved to a different location, usually because of a piston.
- Specified by:
setBlockStatein interfaceModifiableWorld- Parameters:
pos- the target positionstate- the block state to setflags- the bitwise flag combination, as described above
-
setBlockState
Updates the block state at a position, calling appropriate callbacks.When called on the server, the new block state is stored and propagated to clients and listeners as dictated by the supplied flags. Note that calling this on the client will update the world locally, but may not see the change persisted across loads. It's recommended to check whether this world is client before interacting with the world in this way.
Accepted values of the flags are a bitset combination of the following:
- 0b0000001 // 1 - PROPAGATE_CHANGE - Propagates a change event to surrounding blocks.
- 0b0000010 // 2 - NOTIFY_LISTENERS - Notifies listeners and clients who need to react when the block changes
- 0b0000100 // 4 - NO_REDRAW - Used in conjunction with NOTIFY_LISTENERS to suppress the render pass on clients.
- 0b0001000 // 8 - REDRAW_ON_MAIN_THREAD - Forces a synchronous redraw on clients.
- 0b0010000 // 16 - FORCE_STATE - Bypass virtual blockstate changes and forces the passed state to be stored as-is.
- 0b0100000 // 32 - SKIP_DROPS - Prevents the previous block (container) from dropping items when destroyed.
- 0b1000000 // 64 - MOVED - Signals that the current block is being moved to a different location, usually because of a piston.
- Specified by:
setBlockStatein interfaceModifiableWorld- Parameters:
pos- the target positionstate- the block state to setflags- the bitwise flag combination, as described abovemaxUpdateDepth- the limit for the cascading block updates
-
onBlockChanged
-
removeBlock
- Specified by:
removeBlockin interfaceModifiableWorld
-
method_30093
- Specified by:
method_30093in interfaceModifiableWorld
-
setBlockState
-
updateListeners
public abstract void updateListeners(BlockPos pos, BlockState oldState, BlockState newState, int flags) -
scheduleBlockRerenderIfNeeded
-
updateNeighborsAlways
-
updateNeighborsExcept
-
updateNeighbor
-
getTopY
-
getLightingProvider
- Specified by:
getLightingProviderin interfaceBlockRenderView
-
getBlockState
- Specified by:
getBlockStatein interfaceBlockView
-
getFluidState
- Specified by:
getFluidStatein interfaceBlockView
-
isDay
public boolean isDay() -
isNight
public boolean isNight() -
playSound
public void playSound(@Nullable PlayerEntity player, BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch)- Specified by:
playSoundin interfaceWorldAccess
-
playSound
public abstract void playSound(@Nullable PlayerEntity player, double x, double y, double z, SoundEvent sound, SoundCategory category, float volume, float pitch) -
playSoundFromEntity
public abstract void playSoundFromEntity(@Nullable PlayerEntity player, Entity entity, SoundEvent sound, SoundCategory category, float volume, float pitch) -
playSound
public void playSound(double x, double y, double z, SoundEvent sound, SoundCategory category, float volume, float pitch, boolean bool) -
addParticle
public void addParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)- Specified by:
addParticlein interfaceWorldAccess
-
addParticle
@Environment(CLIENT) public void addParticle(ParticleEffect parameters, boolean alwaysSpawn, double x, double y, double z, double velocityX, double velocityY, double velocityZ) -
addImportantParticle
public void addImportantParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) -
addImportantParticle
public void addImportantParticle(ParticleEffect parameters, boolean alwaysSpawn, double x, double y, double z, double velocityX, double velocityY, double velocityZ) -
getSkyAngleRadians
public float getSkyAngleRadians(float tickDelta) -
addBlockEntity
-
addBlockEntities
-
tickBlockEntities
public void tickBlockEntities() -
tickEntity
-
createExplosion
public Explosion createExplosion(@Nullable Entity entity, double x, double y, double z, float power, Explosion.DestructionType destructionType) -
createExplosion
public Explosion createExplosion(@Nullable Entity entity, double x, double y, double z, float power, boolean createFire, Explosion.DestructionType destructionType) -
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) -
getDebugString
-
getBlockEntity
- Specified by:
getBlockEntityin interfaceBlockView
-
getPendingBlockEntity
-
setBlockEntity
-
removeBlockEntity
-
canSetBlock
-
isDirectionSolid
-
isTopSolid
-
calculateAmbientDarkness
public void calculateAmbientDarkness() -
setMobSpawnOptions
public void setMobSpawnOptions(boolean spawnMonsters, boolean spawnAnimals) -
initWeatherGradients
protected void initWeatherGradients() -
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
getExistingChunk
- Specified by:
getExistingChunkin interfaceCollisionView- Specified by:
getExistingChunkin interfaceWorldView
-
getEntities
public List<Entity> getEntities(@Nullable Entity except, Box box, @Nullable Predicate<? super Entity> predicate)- Specified by:
getEntitiesin interfaceEntityView
-
getEntities
-
getEntities
public <T extends Entity> List<T> getEntities(Class<? extends T> entityClass, Box box, @Nullable Predicate<? super T> predicate)- Specified by:
getEntitiesin interfaceEntityView
-
getEntitiesIncludingUngeneratedChunks
public <T extends Entity> List<T> getEntitiesIncludingUngeneratedChunks(Class<? extends T> entityClass, Box box, @Nullable Predicate<? super T> predicate)- Specified by:
getEntitiesIncludingUngeneratedChunksin interfaceEntityView
-
getEntityById
-
markDirty
-
getSeaLevel
public int getSeaLevel()- Specified by:
getSeaLevelin interfaceWorldView
-
getWorld
- Specified by:
getWorldin interfaceWorldAccess
-
getReceivedStrongRedstonePower
-
isEmittingRedstonePower
-
getEmittedRedstonePower
-
isReceivingRedstonePower
-
getReceivedRedstonePower
-
disconnect
@Environment(CLIENT) public void disconnect() -
getTime
public long getTime() -
getTimeOfDay
public long getTimeOfDay() -
canPlayerModifyAt
-
sendEntityStatus
-
addSyncedBlockEvent
-
getLevelProperties
- Specified by:
getLevelPropertiesin interfaceWorldAccess
-
getGameRules
-
getThunderGradient
public float getThunderGradient(float delta) -
setThunderGradient
@Environment(CLIENT) public void setThunderGradient(float thunderGradient) -
getRainGradient
public float getRainGradient(float delta) -
setRainGradient
@Environment(CLIENT) public void setRainGradient(float rainGradient) -
isThundering
public boolean isThundering() -
isRaining
public boolean isRaining() -
hasRain
-
hasHighHumidity
-
getMapState
-
putMapState
-
getNextMapId
public abstract int getNextMapId() -
syncGlobalEvent
-
addDetailsToCrashReport
-
setBlockBreakingInfo
-
addFireworkParticle
@Environment(CLIENT) public void addFireworkParticle(double x, double y, double z, double velocityX, double velocityY, double velocityZ, @Nullable CompoundTag tag) -
getScoreboard
-
updateComparators
-
getLocalDifficulty
- Specified by:
getLocalDifficultyin interfaceWorldAccess
-
getAmbientDarkness
public int getAmbientDarkness()- Specified by:
getAmbientDarknessin interfaceWorldView
-
setLightningTicksLeft
public void setLightningTicksLeft(int lightningTicksLeft) -
getWorldBorder
- Specified by:
getWorldBorderin interfaceCollisionView
-
sendPacket
-
getDimension
- Specified by:
getDimensionin interfaceWorldView
-
getDimensionRegistryKey
-
getRegistryKey
-
getRandom
- Specified by:
getRandomin interfaceWorldAccess
-
testBlockState
- Specified by:
testBlockStatein interfaceTestableWorld
-
getRecipeManager
-
getTagManager
-
getRandomPosInChunk
-
isSavingDisabled
public boolean isSavingDisabled() -
getProfiler
-
getProfilerSupplier
-
getBiomeAccess
- Specified by:
getBiomeAccessin interfaceWorldView
-
isDebugWorld
public final boolean isDebugWorld()
-