public class ChunkRegion extends Object implements ServerWorldAccess
| Modifier and Type | Field and Description |
|---|---|
private BiomeAccess |
biomeAccess |
private TickScheduler<Block> |
blockTickScheduler |
private int |
centerChunkX |
private int |
centerChunkZ |
private List<Chunk> |
chunks |
private DimensionType |
dimension |
private TickScheduler<Fluid> |
fluidTickScheduler |
private WorldProperties |
levelProperties |
private static Logger |
LOGGER |
private ChunkPos |
lowerCorner |
private Random |
random |
private long |
seed |
private ChunkPos |
upperCorner |
private int |
width |
private ServerWorld |
world |
| Constructor and Description |
|---|
ChunkRegion(ServerWorld world,
List<Chunk> chunks) |
| Modifier and Type | Method and Description |
|---|---|
void |
addParticle(ParticleEffect parameters,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ) |
int |
getAmbientDarkness() |
BiomeAccess |
getBiomeAccess() |
BlockEntity |
getBlockEntity(BlockPos pos) |
BlockState |
getBlockState(BlockPos pos) |
TickScheduler<Block> |
getBlockTickScheduler() |
float |
getBrightness(Direction direction,
boolean shaded) |
int |
getCenterChunkX() |
int |
getCenterChunkZ() |
Chunk |
getChunk(int chunkX,
int chunkZ) |
Chunk |
getChunk(int chunkX,
int chunkZ,
ChunkStatus leastStatus,
boolean create) |
ChunkManager |
getChunkManager() |
PlayerEntity |
getClosestPlayer(double x,
double y,
double z,
double maxDistance,
Predicate<Entity> targetPredicate) |
DimensionType |
getDimension() |
<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) |
FluidState |
getFluidState(BlockPos pos) |
TickScheduler<Fluid> |
getFluidTickScheduler() |
Biome |
getGeneratorStoredBiome(int biomeX,
int biomeY,
int biomeZ) |
WorldProperties |
getLevelProperties() |
LightingProvider |
getLightingProvider() |
LocalDifficulty |
getLocalDifficulty(BlockPos pos) |
List<PlayerEntity> |
getPlayers() |
Random |
getRandom() |
int |
getSeaLevel() |
long |
getSeed() |
int |
getTopY(Heightmap.Type heightmap,
int x,
int z) |
ServerWorld |
getWorld()
Deprecated.
|
WorldBorder |
getWorldBorder() |
boolean |
isChunkLoaded(int chunkX,
int chunkZ) |
boolean |
isClient()
Checks if this world view is on the logical client.
|
private void |
markBlockForPostProcessing(BlockPos pos) |
boolean |
method_30093(BlockPos blockPos,
boolean bool,
Entity entity,
int int2) |
void |
playSound(PlayerEntity player,
BlockPos pos,
SoundEvent sound,
SoundCategory category,
float volume,
float pitch) |
boolean |
removeBlock(BlockPos pos,
boolean move) |
boolean |
setBlockState(BlockPos pos,
BlockState state,
int flags,
int maxUpdateDepth)
Updates the block state at a position, calling appropriate callbacks.
|
boolean |
spawnEntity(Entity entity) |
void |
syncWorldEvent(PlayerEntity player,
int eventId,
BlockPos pos,
int data) |
boolean |
testBlockState(BlockPos pos,
Predicate<BlockState> state) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDifficulty, getDimensionHeight, getEntityCollisions, getMoonPhase, getMoonSize, getSkyAngle, getTopPosition, intersectsEntities, syncWorldEvent, updateNeighborsgetClosestEntity, getClosestEntity, getClosestEntityIncludingUngeneratedChunks, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getEntities, getEntitiesIncludingUngeneratedChunks, getEntitiesIncludingUngeneratedChunks, getNonSpectatingEntities, getPlayerByUuid, getPlayers, getTargets, isPlayerInRangecontainsFluid, getBiome, getBiomeForNoiseGen, getBrightness, getChunk, getChunk, getColor, getExistingChunk, getLightLevel, getLightLevel, getStrongRedstonePower, isAir, isChunkLoaded, isRegionLoaded, isRegionLoaded, isSkyVisibleAllowingSea, isWater, method_29556getBaseLightLevel, getLightLevel, isSkyVisiblecanPlace, doesNotCollide, doesNotCollide, doesNotCollide, doesNotCollide, getBlockCollisions, getCollisions, intersectsEntities, method_30030getHeight, getLuminance, getMaxLightLevel, method_29546, rayTrace, rayTrace, rayTraceBlockbreakBlock, breakBlock, setBlockStateprivate static final Logger LOGGER
private final int centerChunkX
private final int centerChunkZ
private final int width
private final ServerWorld world
private final long seed
private final WorldProperties levelProperties
private final Random random
private final DimensionType dimension
private final TickScheduler<Block> blockTickScheduler
private final TickScheduler<Fluid> fluidTickScheduler
private final BiomeAccess biomeAccess
private final ChunkPos lowerCorner
private final ChunkPos upperCorner
public ChunkRegion(ServerWorld world, List<Chunk> chunks)
public int getCenterChunkX()
public int getCenterChunkZ()
public Chunk getChunk(int chunkX, int chunkZ)
@Nullable public Chunk getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create)
public boolean isChunkLoaded(int chunkX,
int chunkZ)
isChunkLoaded in interface WorldAccessisChunkLoaded in interface WorldViewpublic BlockState getBlockState(BlockPos pos)
getBlockState in interface BlockViewpublic FluidState getFluidState(BlockPos pos)
getFluidState in interface BlockView@Nullable public PlayerEntity getClosestPlayer(double x, double y, double z, double maxDistance, Predicate<Entity> targetPredicate)
getClosestPlayer in interface EntityViewpublic int getAmbientDarkness()
getAmbientDarkness in interface WorldViewpublic BiomeAccess getBiomeAccess()
getBiomeAccess in interface WorldViewpublic Biome getGeneratorStoredBiome(int biomeX, int biomeY, int biomeZ)
getGeneratorStoredBiome in interface WorldView@Environment(value=CLIENT) public float getBrightness(Direction direction, boolean shaded)
getBrightness in interface BlockRenderViewpublic LightingProvider getLightingProvider()
getLightingProvider in interface BlockRenderViewpublic boolean method_30093(BlockPos blockPos, boolean bool, @Nullable Entity entity, int int2)
method_30093 in interface ModifiableWorld@Nullable public BlockEntity getBlockEntity(BlockPos pos)
getBlockEntity in interface BlockViewpublic 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 updatesprivate void markBlockForPostProcessing(BlockPos pos)
public boolean spawnEntity(Entity entity)
spawnEntity in interface ModifiableWorldpublic boolean removeBlock(BlockPos pos, boolean move)
removeBlock in interface ModifiableWorldpublic WorldBorder getWorldBorder()
getWorldBorder in interface CollisionViewpublic boolean isClient()
If the value returned is false, it is expected that this world is present on a logical server.
@Deprecated public ServerWorld getWorld()
getWorld in interface WorldAccesspublic WorldProperties getLevelProperties()
getLevelProperties in interface WorldAccesspublic LocalDifficulty getLocalDifficulty(BlockPos pos)
getLocalDifficulty in interface WorldAccesspublic ChunkManager getChunkManager()
getChunkManager in interface WorldAccesspublic long getSeed()
getSeed in interface ServerWorldAccesspublic TickScheduler<Block> getBlockTickScheduler()
getBlockTickScheduler in interface WorldAccesspublic TickScheduler<Fluid> getFluidTickScheduler()
getFluidTickScheduler in interface WorldAccesspublic int getSeaLevel()
getSeaLevel in interface WorldViewpublic Random getRandom()
getRandom in interface WorldAccesspublic int getTopY(Heightmap.Type heightmap, int x, int z)
public void playSound(@Nullable PlayerEntity player, BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch)
playSound in interface WorldAccesspublic void addParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)
addParticle in interface WorldAccesspublic void syncWorldEvent(@Nullable PlayerEntity player, int eventId, BlockPos pos, int data)
syncWorldEvent in interface WorldAccesspublic DimensionType getDimension()
getDimension in interface WorldViewpublic boolean testBlockState(BlockPos pos, Predicate<BlockState> state)
testBlockState in interface TestableWorldpublic <T extends Entity> List<T> getEntities(Class<? extends T> entityClass, Box box, @Nullable Predicate<? super T> predicate)
getEntities in interface EntityViewpublic List<Entity> getEntities(@Nullable Entity except, Box box, @Nullable Predicate<? super Entity> predicate)
getEntities in interface EntityViewpublic List<PlayerEntity> getPlayers()
getPlayers in interface EntityView