public class ChunkRegion extends Object implements StructureWorldAccess
| 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 StructureAccessor |
field_26822 |
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) |
boolean |
breakBlock(BlockPos pos,
boolean drop,
Entity breakingEntity,
int maxUpdateDepth) |
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> |
getEntitiesByClass(Class<? extends T> entityClass,
Box box,
Predicate<? super T> predicate)
Computes a list of entities within some box whose runtime Java class is the same as or is
a subclass of the given class.
|
FluidState |
getFluidState(BlockPos pos) |
TickScheduler<Fluid> |
getFluidTickScheduler() |
Biome |
getGeneratorStoredBiome(int biomeX,
int biomeY,
int biomeZ) |
WorldProperties |
getLevelProperties() |
LightingProvider |
getLightingProvider() |
LocalDifficulty |
getLocalDifficulty(BlockPos pos) |
List<Entity> |
getOtherEntities(Entity except,
Box box,
Predicate<? super Entity> predicate)
Computes a list of entities within some box, excluding the given entity, that satisfy the given predicate.
|
List<PlayerEntity> |
getPlayers() |
Random |
getRandom() |
DynamicRegistryManager |
getRegistryManager() |
int |
getSeaLevel() |
long |
getSeed() |
Stream<? extends StructureStart<?>> |
getStructures(ChunkSectionPos pos,
StructureFeature<?> feature) |
int |
getTopY(Heightmap.Type heightmap,
int x,
int z) |
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) |
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) |
ServerWorld |
toServerWorld()
Deprecated.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitspawnEntityAndPassengersgetDifficulty, getDimensionHeight, getLunarTime, syncWorldEvent, updateNeighborsgetEntityCollisions, getTopPosition, intersectsEntities, method_31081getClosestEntity, getClosestEntity, getClosestEntityIncludingUngeneratedChunks, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getEntitiesIncludingUngeneratedChunks, getEntitiesIncludingUngeneratedChunks, getNonSpectatingEntities, getOtherEntities, getPlayerByUuid, getPlayers, getTargets, isPlayerInRangebreakBlock, breakBlock, setBlockStategetMoonPhase, getMoonSize, getSkyAnglecontainsFluid, getBiome, getBiomeForNoiseGen, getBrightness, getChunk, getChunk, getColor, getExistingChunk, getLightLevel, getLightLevel, getStrongRedstonePower, isAir, isChunkLoaded, isRegionLoaded, isRegionLoaded, isSkyVisibleAllowingSea, isWater, method_29556getBaseLightLevel, getLightLevel, isSkyVisiblecanPlace, getBlockCollisions, getBlockCollisions, getCollisions, intersectsEntities, isBlockSpaceEmpty, isSpaceEmpty, isSpaceEmpty, isSpaceEmpty, isSpaceEmptygetDismountHeight, getDismountHeight, getHeight, getLuminance, getMaxLightLevel, method_29546, raycast, raycast, raycastBlockprivate 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
private final StructureAccessor field_26822
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 breakBlock(BlockPos pos, boolean drop, @Nullable Entity breakingEntity, int maxUpdateDepth)
breakBlock 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 toServerWorld()
toServerWorld in interface ServerWorldAccesspublic DynamicRegistryManager getRegistryManager()
getRegistryManager in interface class_5423public 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 StructureWorldAccesspublic 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> getEntitiesByClass(Class<? extends T> entityClass, Box box, @Nullable Predicate<? super T> predicate)
getEntitiesByClass in interface EntityViewentityClass - the class the list of entities must extendbox - the box in which to search for entitiespredicate - a predicate which entities must satisfy in order to be included in the returned listpublic List<Entity> getOtherEntities(@Nullable Entity except, Box box, @Nullable Predicate<? super Entity> predicate)
getOtherEntities in interface EntityViewexcept - the entity the box logically surrounds. This entity is ignored if it is inside the box.box - the box in which to search for entitiespredicate - a predicate which entities must satisfy in order to be included in the returned list.public List<PlayerEntity> getPlayers()
getPlayers in interface EntityViewpublic Stream<? extends StructureStart<?>> getStructures(ChunkSectionPos pos, StructureFeature<?> feature)
getStructures in interface StructureWorldAccess