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, wait
spawnEntityAndPassengers
getDifficulty, getDimensionHeight, getLunarTime, syncWorldEvent, updateNeighbors
getEntityCollisions, getTopPosition, intersectsEntities, method_31081
getClosestEntity, getClosestEntity, getClosestEntityIncludingUngeneratedChunks, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getEntitiesIncludingUngeneratedChunks, getEntitiesIncludingUngeneratedChunks, getNonSpectatingEntities, getOtherEntities, getPlayerByUuid, getPlayers, getTargets, isPlayerInRange
breakBlock, breakBlock, setBlockState
getMoonPhase, getMoonSize, getSkyAngle
containsFluid, getBiome, getBiomeForNoiseGen, getBrightness, getChunk, getChunk, getColor, getExistingChunk, getLightLevel, getLightLevel, getStrongRedstonePower, isAir, isChunkLoaded, isRegionLoaded, isRegionLoaded, isSkyVisibleAllowingSea, isWater, method_29556
getBaseLightLevel, getLightLevel, isSkyVisible
canPlace, getBlockCollisions, getBlockCollisions, getCollisions, intersectsEntities, isBlockSpaceEmpty, isSpaceEmpty, isSpaceEmpty, isSpaceEmpty, isSpaceEmpty
getDismountHeight, getDismountHeight, getHeight, getLuminance, getMaxLightLevel, method_29546, raycast, raycast, raycastBlock
private 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 WorldAccess
isChunkLoaded
in interface WorldView
public BlockState getBlockState(BlockPos pos)
getBlockState
in interface BlockView
public 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 EntityView
public int getAmbientDarkness()
getAmbientDarkness
in interface WorldView
public BiomeAccess getBiomeAccess()
getBiomeAccess
in interface WorldView
public 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 BlockRenderView
public LightingProvider getLightingProvider()
getLightingProvider
in interface BlockRenderView
public boolean breakBlock(BlockPos pos, boolean drop, @Nullable Entity breakingEntity, int maxUpdateDepth)
breakBlock
in interface ModifiableWorld
@Nullable public BlockEntity getBlockEntity(BlockPos pos)
getBlockEntity
in interface BlockView
public 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 ModifiableWorld
pos
- 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 ModifiableWorld
public boolean removeBlock(BlockPos pos, boolean move)
removeBlock
in interface ModifiableWorld
public WorldBorder getWorldBorder()
getWorldBorder
in interface CollisionView
public 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 ServerWorldAccess
public DynamicRegistryManager getRegistryManager()
getRegistryManager
in interface class_5423
public WorldProperties getLevelProperties()
getLevelProperties
in interface WorldAccess
public LocalDifficulty getLocalDifficulty(BlockPos pos)
getLocalDifficulty
in interface WorldAccess
public ChunkManager getChunkManager()
getChunkManager
in interface WorldAccess
public long getSeed()
getSeed
in interface StructureWorldAccess
public TickScheduler<Block> getBlockTickScheduler()
getBlockTickScheduler
in interface WorldAccess
public TickScheduler<Fluid> getFluidTickScheduler()
getFluidTickScheduler
in interface WorldAccess
public int getSeaLevel()
getSeaLevel
in interface WorldView
public Random getRandom()
getRandom
in interface WorldAccess
public 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 WorldAccess
public void addParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)
addParticle
in interface WorldAccess
public void syncWorldEvent(@Nullable PlayerEntity player, int eventId, BlockPos pos, int data)
syncWorldEvent
in interface WorldAccess
public DimensionType getDimension()
getDimension
in interface WorldView
public boolean testBlockState(BlockPos pos, Predicate<BlockState> state)
testBlockState
in interface TestableWorld
public <T extends Entity> List<T> getEntitiesByClass(Class<? extends T> entityClass, Box box, @Nullable Predicate<? super T> predicate)
getEntitiesByClass
in interface EntityView
entityClass
- 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 EntityView
except
- 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 EntityView
public Stream<? extends StructureStart<?>> getStructures(ChunkSectionPos pos, StructureFeature<?> feature)
getStructures
in interface StructureWorldAccess