public abstract class World extends Object implements WorldAccess, AutoCloseable
| Modifier | Constructor and Description |
|---|---|
protected |
World(MutableWorldProperties mutableWorldProperties,
RegistryKey<World> registryKey,
RegistryKey<DimensionType> registryKey2,
DimensionType dimensionType,
Supplier<Profiler> profiler,
boolean bool,
boolean bool2,
long long2) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBlockEntities(Collection<BlockEntity> blockEntities) |
boolean |
addBlockEntity(BlockEntity blockEntity) |
CrashReportSection |
addDetailsToCrashReport(CrashReport report) |
void |
addFireworkParticle(double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ,
CompoundTag tag) |
void |
addImportantParticle(ParticleEffect parameters,
boolean alwaysSpawn,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ) |
void |
addImportantParticle(ParticleEffect parameters,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ) |
void |
addParticle(ParticleEffect parameters,
boolean alwaysSpawn,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ) |
void |
addParticle(ParticleEffect parameters,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ) |
void |
addSyncedBlockEvent(BlockPos pos,
Block block,
int type,
int data) |
void |
calculateAmbientDarkness() |
boolean |
canPlayerModifyAt(PlayerEntity player,
BlockPos pos) |
boolean |
canSetBlock(BlockPos pos) |
void |
close() |
Explosion |
createExplosion(Entity entity,
DamageSource damageSource,
ExplosionBehavior explosionBehavior,
double double2,
double double3,
double double4,
float float2,
boolean bool,
Explosion.DestructionType destructionType) |
Explosion |
createExplosion(Entity entity,
double x,
double y,
double z,
float power,
boolean createFire,
Explosion.DestructionType destructionType) |
Explosion |
createExplosion(Entity entity,
double x,
double y,
double z,
float power,
Explosion.DestructionType destructionType) |
void |
disconnect() |
int |
getAmbientDarkness() |
BiomeAccess |
getBiomeAccess() |
BlockEntity |
getBlockEntity(BlockPos pos) |
BlockState |
getBlockState(BlockPos pos) |
WorldChunk |
getChunk(int int2,
int int3) |
Chunk |
getChunk(int chunkX,
int chunkZ,
ChunkStatus leastStatus,
boolean create) |
double |
getCollisionHeightAt(BlockPos pos) |
double |
getCollisionHeightAt(BlockPos pos,
Predicate<BlockState> predicate) |
String |
getDebugString() |
DimensionType |
getDimension() |
RegistryKey<DimensionType> |
getDimensionRegistryKey() |
int |
getEmittedRedstonePower(BlockPos pos,
Direction direction) |
<T extends Entity> |
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> |
getEntities(EntityType<T> type,
Box box,
Predicate<? super T> predicate) |
<T extends Entity> |
getEntitiesIncludingUngeneratedChunks(Class<? extends T> entityClass,
Box box,
Predicate<? super T> predicate) |
abstract Entity |
getEntityById(int id) |
BlockView |
getExistingChunk(int chunkX,
int chunkZ) |
FluidState |
getFluidState(BlockPos pos) |
GameRules |
getGameRules() |
WorldProperties |
getLevelProperties() |
LightingProvider |
getLightingProvider() |
LocalDifficulty |
getLocalDifficulty(BlockPos pos) |
abstract MapState |
getMapState(String id) |
abstract int |
getNextMapId() |
private BlockEntity |
getPendingBlockEntity(BlockPos pos) |
Profiler |
getProfiler() |
Supplier<Profiler> |
getProfilerSupplier() |
float |
getRainGradient(float delta) |
Random |
getRandom() |
BlockPos |
getRandomPosInChunk(int x,
int y,
int z,
int int2) |
int |
getReceivedRedstonePower(BlockPos pos) |
int |
getReceivedStrongRedstonePower(BlockPos pos) |
abstract RecipeManager |
getRecipeManager() |
RegistryKey<World> |
getRegistryKey() |
abstract Scoreboard |
getScoreboard() |
int |
getSeaLevel() |
MinecraftServer |
getServer() |
float |
getSkyAngleRadians(float tickDelta) |
abstract RegistryTagManager |
getTagManager() |
float |
getThunderGradient(float delta) |
long |
getTime() |
long |
getTimeOfDay() |
int |
getTopY(Heightmap.Type heightmap,
int x,
int z) |
World |
getWorld() |
WorldBorder |
getWorldBorder() |
WorldChunk |
getWorldChunk(BlockPos pos) |
boolean |
hasHighHumidity(BlockPos pos) |
boolean |
hasRain(BlockPos pos) |
protected void |
initWeatherGradients() |
boolean |
isClient()
Checks if this world view is on the logical client.
|
boolean |
isDay() |
boolean |
isDebugWorld() |
boolean |
isDirectionSolid(BlockPos pos,
Entity entity,
Direction direction) |
boolean |
isEmittingRedstonePower(BlockPos pos,
Direction direction) |
static boolean |
isHeightInvalid(BlockPos pos) |
static boolean |
isHeightInvalid(int y) |
boolean |
isNight() |
boolean |
isRaining() |
boolean |
isReceivingRedstonePower(BlockPos pos) |
boolean |
isSavingDisabled() |
boolean |
isThundering() |
boolean |
isTopSolid(BlockPos pos,
Entity entity) |
private static boolean |
isValid(BlockPos pos) |
void |
markDirty(BlockPos pos,
BlockEntity blockEntity) |
static boolean |
method_24794(BlockPos blockPos) |
private static boolean |
method_25952(int int2) |
static boolean |
method_25953(BlockPos blockPos) |
double |
method_26096(BlockPos blockPos,
double double2) |
boolean |
method_30093(BlockPos blockPos,
boolean bool,
Entity entity,
int int2) |
void |
onBlockChanged(BlockPos pos,
BlockState oldBlock,
BlockState newBlock) |
void |
playSound(double x,
double y,
double z,
SoundEvent sound,
SoundCategory category,
float volume,
float pitch,
boolean bool) |
void |
playSound(PlayerEntity player,
BlockPos pos,
SoundEvent sound,
SoundCategory category,
float volume,
float pitch) |
abstract void |
playSound(PlayerEntity player,
double x,
double y,
double z,
SoundEvent sound,
SoundCategory category,
float volume,
float pitch) |
abstract void |
playSoundFromEntity(PlayerEntity player,
Entity entity,
SoundEvent sound,
SoundCategory category,
float volume,
float pitch) |
abstract void |
putMapState(MapState mapState) |
boolean |
removeBlock(BlockPos pos,
boolean move) |
void |
removeBlockEntity(BlockPos pos) |
void |
scheduleBlockRerenderIfNeeded(BlockPos pos,
BlockState old,
BlockState updated) |
void |
sendEntityStatus(Entity entity,
byte status) |
void |
sendPacket(Packet<?> packet) |
abstract void |
setBlockBreakingInfo(int entityId,
BlockPos pos,
int progress) |
void |
setBlockEntity(BlockPos pos,
BlockEntity blockEntity) |
boolean |
setBlockState(BlockPos pos,
BlockState state) |
boolean |
setBlockState(BlockPos pos,
BlockState state,
int flags)
Updates the block state at a position, calling appropriate callbacks.
|
boolean |
setBlockState(BlockPos pos,
BlockState state,
int flags,
int maxUpdateDepth)
Updates the block state at a position, calling appropriate callbacks.
|
void |
setLightningTicksLeft(int lightningTicksLeft) |
void |
setMobSpawnOptions(boolean spawnMonsters,
boolean spawnAnimals) |
void |
setRainGradient(float rainGradient) |
void |
setThunderGradient(float thunderGradient) |
void |
syncGlobalEvent(int eventId,
BlockPos pos,
int data) |
boolean |
testBlockState(BlockPos pos,
Predicate<BlockState> state) |
void |
tickBlockEntities() |
void |
tickEntity(Consumer<Entity> tickConsumer,
Entity entity) |
void |
updateComparators(BlockPos pos,
Block block) |
abstract void |
updateListeners(BlockPos pos,
BlockState oldState,
BlockState newState,
int flags) |
void |
updateNeighbor(BlockPos sourcePos,
Block sourceBlock,
BlockPos neighborPos) |
void |
updateNeighborsAlways(BlockPos pos,
Block block) |
void |
updateNeighborsExcept(BlockPos pos,
Block sourceBlock,
Direction direction) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBlockTickScheduler, getChunkManager, getDifficulty, getDimensionHeight, getEntityCollisions, getFluidTickScheduler, getMoonPhase, getMoonSize, getSkyAngle, getTopPosition, intersectsEntities, isChunkLoaded, syncWorldEvent, syncWorldEvent, updateNeighborsgetClosestEntity, getClosestEntity, getClosestEntityIncludingUngeneratedChunks, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getEntities, getEntitiesIncludingUngeneratedChunks, getNonSpectatingEntities, getPlayerByUuid, getPlayers, getPlayers, getTargets, isPlayerInRangecontainsFluid, getBiome, getBiomeForNoiseGen, getBrightness, getChunk, getChunk, getColor, getGeneratorStoredBiome, getLightLevel, getLightLevel, getStrongRedstonePower, isAir, isChunkLoaded, isRegionLoaded, isRegionLoaded, isSkyVisibleAllowingSea, isWater, method_29556getBaseLightLevel, getBrightness, getLightLevel, isSkyVisiblecanPlace, doesNotCollide, doesNotCollide, doesNotCollide, doesNotCollide, getBlockCollisions, getCollisions, intersectsEntities, method_30030getHeight, getLuminance, getMaxLightLevel, method_29546, rayTrace, rayTrace, rayTraceBlockbreakBlock, breakBlock, spawnEntityprotected static final Logger LOGGER
public static final com.mojang.serialization.Codec<RegistryKey<World>> CODEC
public static final RegistryKey<World> OVERWORLD
public static final RegistryKey<World> NETHER
public static final RegistryKey<World> END
private static final Direction[] DIRECTIONS
public final List<BlockEntity> blockEntities
public final List<BlockEntity> tickingBlockEntities
protected final List<BlockEntity> pendingBlockEntities
protected final List<BlockEntity> unloadedBlockEntities
private final Thread thread
private final boolean debugWorld
private int ambientDarkness
protected int lcgBlockSeed
protected final int unusedIncrement
protected float rainGradientPrev
protected float rainGradient
protected float thunderGradientPrev
protected float thunderGradient
public final Random random
private final DimensionType dimension
protected final MutableWorldProperties properties
public final boolean isClient
protected boolean iteratingTickingBlockEntities
private final WorldBorder border
private final BiomeAccess biomeAccess
private final RegistryKey<World> registryKey
private final RegistryKey<DimensionType> dimensionRegistryKey
protected World(MutableWorldProperties mutableWorldProperties, RegistryKey<World> registryKey, RegistryKey<DimensionType> registryKey2, DimensionType dimensionType, Supplier<Profiler> profiler, boolean bool, boolean bool2, long long2)
public boolean isClient()
If the value returned is false, it is expected that this world is present on a logical server.
@Nullable public MinecraftServer getServer()
public static boolean method_24794(BlockPos blockPos)
public static boolean method_25953(BlockPos blockPos)
private static boolean isValid(BlockPos pos)
private static boolean method_25952(int int2)
public static boolean isHeightInvalid(BlockPos pos)
public static boolean isHeightInvalid(int y)
public double getCollisionHeightAt(BlockPos pos)
public double getCollisionHeightAt(BlockPos pos, Predicate<BlockState> predicate)
public double method_26096(BlockPos blockPos, double double2)
public WorldChunk getWorldChunk(BlockPos pos)
public WorldChunk getChunk(int int2, int int3)
public Chunk getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create)
public boolean setBlockState(BlockPos pos, BlockState state, int flags)
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:
setBlockState in interface ModifiableWorldpos - the target positionstate - the block state to setflags - the bitwise flag combination, as described abovepublic boolean setBlockState(BlockPos pos, BlockState state, int flags, int maxUpdateDepth)
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:
setBlockState in interface ModifiableWorldpos - the target positionstate - the block state to setflags - the bitwise flag combination, as described abovemaxUpdateDepth - the limit for the cascading block updatespublic void onBlockChanged(BlockPos pos, BlockState oldBlock, BlockState newBlock)
public boolean removeBlock(BlockPos pos, boolean move)
removeBlock in interface ModifiableWorldpublic boolean method_30093(BlockPos blockPos, boolean bool, @Nullable Entity entity, int int2)
method_30093 in interface ModifiableWorldpublic boolean setBlockState(BlockPos pos, BlockState state)
public abstract void updateListeners(BlockPos pos, BlockState oldState, BlockState newState, int flags)
public void scheduleBlockRerenderIfNeeded(BlockPos pos, BlockState old, BlockState updated)
public void updateNeighborsExcept(BlockPos pos, Block sourceBlock, Direction direction)
public void updateNeighbor(BlockPos sourcePos, Block sourceBlock, BlockPos neighborPos)
public int getTopY(Heightmap.Type heightmap, int x, int z)
public LightingProvider getLightingProvider()
getLightingProvider in interface BlockRenderViewpublic BlockState getBlockState(BlockPos pos)
getBlockState in interface BlockViewpublic FluidState getFluidState(BlockPos pos)
getFluidState in interface BlockViewpublic boolean isDay()
public boolean isNight()
public void playSound(@Nullable PlayerEntity player, BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch)
playSound in interface WorldAccesspublic abstract void playSound(@Nullable PlayerEntity player, double x, double y, double z, SoundEvent sound, SoundCategory category, float volume, float pitch)
public abstract void playSoundFromEntity(@Nullable PlayerEntity player, Entity entity, SoundEvent sound, SoundCategory category, float volume, float pitch)
public void playSound(double x,
double y,
double z,
SoundEvent sound,
SoundCategory category,
float volume,
float pitch,
boolean bool)
public void addParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)
addParticle in interface WorldAccess@Environment(value=CLIENT) public void addParticle(ParticleEffect parameters, boolean alwaysSpawn, double x, double y, double z, double velocityX, double velocityY, double velocityZ)
public void addImportantParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)
public void addImportantParticle(ParticleEffect parameters, boolean alwaysSpawn, double x, double y, double z, double velocityX, double velocityY, double velocityZ)
public float getSkyAngleRadians(float tickDelta)
public boolean addBlockEntity(BlockEntity blockEntity)
public void addBlockEntities(Collection<BlockEntity> blockEntities)
public void tickBlockEntities()
public Explosion createExplosion(@Nullable Entity entity, double x, double y, double z, float power, Explosion.DestructionType destructionType)
public Explosion createExplosion(@Nullable Entity entity, double x, double y, double z, float power, boolean createFire, Explosion.DestructionType destructionType)
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)
@Environment(value=CLIENT) public String getDebugString()
@Nullable public BlockEntity getBlockEntity(BlockPos pos)
getBlockEntity in interface BlockView@Nullable private BlockEntity getPendingBlockEntity(BlockPos pos)
public void setBlockEntity(BlockPos pos, @Nullable BlockEntity blockEntity)
public void removeBlockEntity(BlockPos pos)
public boolean canSetBlock(BlockPos pos)
public void calculateAmbientDarkness()
public void setMobSpawnOptions(boolean spawnMonsters,
boolean spawnAnimals)
protected void initWeatherGradients()
public void close()
throws IOException
close in interface AutoCloseableIOException@Nullable public BlockView getExistingChunk(int chunkX, int chunkZ)
getExistingChunk in interface CollisionViewgetExistingChunk in interface WorldViewpublic List<Entity> getEntities(@Nullable Entity except, Box box, @Nullable Predicate<? super Entity> predicate)
getEntities in interface EntityViewpublic <T extends Entity> List<T> getEntities(@Nullable EntityType<T> type, Box box, Predicate<? super T> predicate)
public <T extends Entity> List<T> getEntities(Class<? extends T> entityClass, Box box, @Nullable Predicate<? super T> predicate)
getEntities in interface EntityViewpublic <T extends Entity> List<T> getEntitiesIncludingUngeneratedChunks(Class<? extends T> entityClass, Box box, @Nullable Predicate<? super T> predicate)
getEntitiesIncludingUngeneratedChunks in interface EntityViewpublic void markDirty(BlockPos pos, BlockEntity blockEntity)
public int getSeaLevel()
getSeaLevel in interface WorldViewpublic World getWorld()
getWorld in interface WorldAccesspublic int getReceivedStrongRedstonePower(BlockPos pos)
public boolean isReceivingRedstonePower(BlockPos pos)
public int getReceivedRedstonePower(BlockPos pos)
@Environment(value=CLIENT) public void disconnect()
public long getTime()
public long getTimeOfDay()
public boolean canPlayerModifyAt(PlayerEntity player, BlockPos pos)
public void sendEntityStatus(Entity entity, byte status)
public WorldProperties getLevelProperties()
getLevelProperties in interface WorldAccesspublic GameRules getGameRules()
public float getThunderGradient(float delta)
@Environment(value=CLIENT) public void setThunderGradient(float thunderGradient)
public float getRainGradient(float delta)
@Environment(value=CLIENT) public void setRainGradient(float rainGradient)
public boolean isThundering()
public boolean isRaining()
public boolean hasRain(BlockPos pos)
public boolean hasHighHumidity(BlockPos pos)
public abstract void putMapState(MapState mapState)
public abstract int getNextMapId()
public void syncGlobalEvent(int eventId,
BlockPos pos,
int data)
public CrashReportSection addDetailsToCrashReport(CrashReport report)
public abstract void setBlockBreakingInfo(int entityId,
BlockPos pos,
int progress)
@Environment(value=CLIENT)
public void addFireworkParticle(double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ,
@Nullable
CompoundTag tag)
public abstract Scoreboard getScoreboard()
public LocalDifficulty getLocalDifficulty(BlockPos pos)
getLocalDifficulty in interface WorldAccesspublic int getAmbientDarkness()
getAmbientDarkness in interface WorldViewpublic void setLightningTicksLeft(int lightningTicksLeft)
public WorldBorder getWorldBorder()
getWorldBorder in interface CollisionViewpublic void sendPacket(Packet<?> packet)
public DimensionType getDimension()
getDimension in interface WorldViewpublic RegistryKey<DimensionType> getDimensionRegistryKey()
public RegistryKey<World> getRegistryKey()
public Random getRandom()
getRandom in interface WorldAccesspublic boolean testBlockState(BlockPos pos, Predicate<BlockState> state)
testBlockState in interface TestableWorldpublic abstract RecipeManager getRecipeManager()
public abstract RegistryTagManager getTagManager()
public BlockPos getRandomPosInChunk(int x, int y, int z, int int2)
public boolean isSavingDisabled()
public Profiler getProfiler()
public BiomeAccess getBiomeAccess()
getBiomeAccess in interface WorldViewpublic final boolean isDebugWorld()