public abstract class World extends Object implements IWorld, AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
private int |
ambientDarkness |
private BiomeAccess |
biomeAccess |
List<BlockEntity> |
blockEntities |
private WorldBorder |
border |
protected ChunkManager |
chunkManager |
Dimension |
dimension |
private static Direction[] |
DIRECTIONS |
boolean |
isClient |
protected boolean |
iteratingTickingBlockEntities |
protected int |
lcgBlockSeed |
protected static Logger |
LOGGER |
protected List<BlockEntity> |
pendingBlockEntities |
private Supplier<Profiler> |
profiler |
protected LevelProperties |
properties |
protected float |
rainGradient |
protected float |
rainGradientPrev |
Random |
random |
private Thread |
thread |
protected float |
thunderGradient |
protected float |
thunderGradientPrev |
List<BlockEntity> |
tickingBlockEntities |
protected List<BlockEntity> |
unloadedBlockEntities |
protected int |
unusedIncrement |
| Modifier | Constructor and Description |
|---|---|
protected |
World(LevelProperties levelProperties,
DimensionType dimensionType,
BiFunction<World,Dimension,ChunkManager> chunkManagerProvider,
Supplier<Profiler> profiler,
boolean isClient) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBlockAction(BlockPos pos,
Block block,
int type,
int data) |
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) |
boolean |
breakBlock(BlockPos pos,
boolean drop,
Entity breakingEntity) |
void |
calculateAmbientDarkness() |
boolean |
canPlayerModifyAt(PlayerEntity player,
BlockPos pos) |
boolean |
canSetBlock(BlockPos pos) |
void |
checkBlockRerender(BlockPos pos,
BlockState old,
BlockState updated) |
void |
close() |
boolean |
containsBlockWithMaterial(Box area,
Material material) |
Explosion |
createExplosion(Entity entity,
DamageSource damageSource,
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,
boolean createFire,
Explosion.DestructionType destructionType) |
Explosion |
createExplosion(Entity entity,
double x,
double y,
double z,
float power,
Explosion.DestructionType destructionType) |
void |
disconnect() |
boolean |
doesAreaContainFireSource(Box box) |
int |
getAmbientDarkness() |
BiomeAccess |
getBiomeAccess() |
BlockEntity |
getBlockEntity(BlockPos pos) |
BlockState |
getBlockState(BlockPos pos) |
BlockState |
getBlockState(Box area,
Block block) |
WorldChunk |
getChunk(int int2,
int int3) |
Chunk |
getChunk(int chunkX,
int chunkZ,
ChunkStatus leastStatus,
boolean create) |
ChunkManager |
getChunkManager() |
String |
getDebugString() |
Dimension |
getDimension() |
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() |
LevelGeneratorType |
getGeneratorType() |
LevelProperties |
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 float2) |
Random |
getRandom() |
BlockPos |
getRandomPosInChunk(int x,
int y,
int z,
int int2) |
int |
getReceivedRedstonePower(BlockPos pos) |
int |
getReceivedStrongRedstonePower(BlockPos pos) |
abstract RecipeManager |
getRecipeManager() |
abstract Scoreboard |
getScoreboard() |
int |
getSeaLevel() |
long |
getSeed() |
MinecraftServer |
getServer() |
float |
getSkyAngleRadians(float float2) |
BlockPos |
getSpawnPos() |
abstract RegistryTagManager |
getTagManager() |
float |
getThunderGradient(float float2) |
long |
getTime() |
long |
getTimeOfDay() |
BlockState |
getTopNonAirState(BlockPos pos) |
int |
getTopY(Heightmap.Type heightmap,
int x,
int z) |
World |
getWorld() |
WorldBorder |
getWorldBorder() |
WorldChunk |
getWorldChunk(BlockPos blockPos) |
boolean |
hasHighHumidity(BlockPos pos) |
boolean |
hasRain(BlockPos pos) |
protected void |
initWeatherGradients() |
boolean |
isAreaNotEmpty(Box box) |
boolean |
isClient() |
boolean |
isDay() |
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) |
double |
method_26097(BlockPos blockPos,
Predicate<BlockState> predicate) |
double |
method_26372(BlockPos blockPos) |
void |
onBlockChanged(BlockPos pos,
BlockState oldBlock,
BlockState newBlock) |
void |
playGlobalEvent(int type,
BlockPos pos,
int data) |
void |
playSound(double x,
double y,
double z,
SoundEvent sound,
SoundCategory category,
float float2,
float float3,
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 |
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.
|
void |
setLightningTicksLeft(int lightningTicksLeft) |
void |
setMobSpawnOptions(boolean spawnMonsters,
boolean spawnAnimals) |
void |
setRainGradient(float rainGradient) |
void |
setSpawnPos(BlockPos pos) |
void |
setThunderGradient(float thunderGradient) |
void |
setTime(long time) |
void |
setTimeOfDay(long time) |
boolean |
testBlockState(BlockPos pos,
Predicate<BlockState> state) |
void |
tickBlockEntities() |
void |
tickEntity(Consumer<Entity> consumer,
Entity entity) |
protected void |
tickTime() |
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, getDifficulty, getDimensionHeight, getEntityCollisions, getFluidTickScheduler, getMoonPhase, getMoonSize, getSkyAngle, getTopPosition, intersectsEntities, isChunkLoaded, playLevelEvent, playLevelEvent, 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, isWatergetBaseLightLevel, getBrightness, getLightLevel, isSkyVisiblecanPlace, doesNotCollide, doesNotCollide, doesNotCollide, doesNotCollide, getBlockCollisions, getCollisions, intersectsEntities, method_27087getHeight, getLuminance, getMaxLightLevel, rayTrace, rayTrace, rayTraceBlockbreakBlock, spawnEntityprotected static final Logger LOGGER
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 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
public final Dimension dimension
protected final ChunkManager chunkManager
protected final LevelProperties properties
public final boolean isClient
protected boolean iteratingTickingBlockEntities
private final WorldBorder border
private final BiomeAccess biomeAccess
protected World(LevelProperties levelProperties, DimensionType dimensionType, BiFunction<World,Dimension,ChunkManager> chunkManagerProvider, Supplier<Profiler> profiler, boolean isClient)
@Nullable public MinecraftServer getServer()
public BlockState getTopNonAirState(BlockPos pos)
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 method_26372(BlockPos blockPos)
public double method_26097(BlockPos blockPos, Predicate<BlockState> predicate)
public double method_26096(BlockPos blockPos, double double2)
public WorldChunk getWorldChunk(BlockPos blockPos)
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 void onBlockChanged(BlockPos pos, BlockState oldBlock, BlockState newBlock)
public boolean removeBlock(BlockPos pos, boolean move)
removeBlock in interface ModifiableWorldpublic boolean breakBlock(BlockPos pos, boolean drop, @Nullable Entity breakingEntity)
breakBlock in interface ModifiableWorldpublic boolean setBlockState(BlockPos pos, BlockState state)
public abstract void updateListeners(BlockPos pos, BlockState oldState, BlockState newState, int flags)
public void checkBlockRerender(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)
public 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 float2,
float float3,
boolean bool)
public void addParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)
addParticle in interface IWorld@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 float2)
public boolean addBlockEntity(BlockEntity blockEntity)
public void addBlockEntities(Collection<BlockEntity> blockEntities)
public void tickBlockEntities()
public boolean isAreaNotEmpty(Box box)
public boolean doesAreaContainFireSource(Box box)
@Environment(value=CLIENT) @Nullable public BlockState getBlockState(Box area, Block block)
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, double x, double y, double z, float power, boolean createFire, 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 LevelGeneratorType getGeneratorType()
public int getReceivedStrongRedstonePower(BlockPos pos)
public boolean isReceivingRedstonePower(BlockPos pos)
public int getReceivedRedstonePower(BlockPos pos)
@Environment(value=CLIENT) public void disconnect()
public void setTime(long time)
public long getTime()
public long getTimeOfDay()
public void setTimeOfDay(long time)
protected void tickTime()
public BlockPos getSpawnPos()
public void setSpawnPos(BlockPos pos)
public boolean canPlayerModifyAt(PlayerEntity player, BlockPos pos)
public void sendEntityStatus(Entity entity, byte status)
public ChunkManager getChunkManager()
getChunkManager in interface IWorldpublic LevelProperties getLevelProperties()
getLevelProperties in interface IWorldpublic GameRules getGameRules()
public float getThunderGradient(float float2)
@Environment(value=CLIENT) public void setThunderGradient(float thunderGradient)
public float getRainGradient(float float2)
@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 playGlobalEvent(int type,
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 IWorldpublic int getAmbientDarkness()
getAmbientDarkness in interface WorldViewpublic void setLightningTicksLeft(int lightningTicksLeft)
public WorldBorder getWorldBorder()
getWorldBorder in interface CollisionViewpublic void sendPacket(Packet<?> packet)
public Dimension getDimension()
getDimension in interface WorldViewpublic 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 WorldView