Package net.minecraft.world
Class ChunkRegion
java.lang.Object
net.minecraft.world.ChunkRegion
- All Implemented Interfaces:
class_5423
,BiomeAccess.Storage
,BlockRenderView
,BlockView
,CollisionView
,EntityView
,LunarWorldView
,ModifiableTestableWorld
,ModifiableWorld
,ServerWorldAccess
,StructureWorldAccess
,TestableWorld
,WorldAccess
,WorldView
public class ChunkRegion extends Object implements StructureWorldAccess
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description ChunkRegion(ServerWorld world, List<Chunk> chunks)
-
Method Summary
Modifier and Type Method 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>
List<T>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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.world.BlockRenderView
getBaseLightLevel, getLightLevel, isSkyVisible
Methods inherited from interface net.minecraft.world.BlockView
getDismountHeight, getDismountHeight, getHeight, getLuminance, getMaxLightLevel, method_29546, raycast, raycastBlock
Methods inherited from interface net.minecraft.class_5423
getEntityCollisions, getTopPosition, intersectsEntities, method_31081
Methods inherited from interface net.minecraft.world.CollisionView
canPlace, getBlockCollisions, getBlockCollisions, getCollisions, getEntityCollisions, intersectsEntities, intersectsEntities, isBlockSpaceEmpty, isSpaceEmpty, isSpaceEmpty, isSpaceEmpty, isSpaceEmpty
Methods inherited from interface net.minecraft.world.EntityView
getClosestEntity, getClosestEntity, getClosestEntityIncludingUngeneratedChunks, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getEntitiesIncludingUngeneratedChunks, getEntitiesIncludingUngeneratedChunks, getNonSpectatingEntities, getOtherEntities, getPlayerByUuid, getPlayers, getTargets, isPlayerInRange
Methods inherited from interface net.minecraft.world.LunarWorldView
getMoonPhase, getMoonSize, getSkyAngle
Methods inherited from interface net.minecraft.world.ModifiableWorld
breakBlock, breakBlock, setBlockState
Methods inherited from interface net.minecraft.world.ServerWorldAccess
spawnEntityAndPassengers
Methods inherited from interface net.minecraft.world.WorldAccess
getDifficulty, getDimensionHeight, getLunarTime, syncWorldEvent, updateNeighbors
Methods inherited from interface net.minecraft.world.WorldView
containsFluid, getBiome, getBiomeForNoiseGen, getBrightness, getChunk, getChunk, getColor, getExistingChunk, getLightLevel, getLightLevel, getStrongRedstonePower, isAir, isChunkLoaded, isRegionLoaded, isRegionLoaded, isSkyVisibleAllowingSea, isWater, method_29556
-
Field Details
-
LOGGER
-
chunks
-
centerChunkX
private final int centerChunkX -
centerChunkZ
private final int centerChunkZ -
width
private final int width -
world
-
seed
private final long seed -
levelProperties
-
random
-
dimension
-
blockTickScheduler
-
fluidTickScheduler
-
biomeAccess
-
lowerCorner
-
upperCorner
-
field_26822
-
-
Constructor Details
-
ChunkRegion
-
-
Method Details
-
getCenterChunkX
public int getCenterChunkX() -
getCenterChunkZ
public int getCenterChunkZ() -
getChunk
-
getChunk
-
isChunkLoaded
public boolean isChunkLoaded(int chunkX, int chunkZ)- Specified by:
isChunkLoaded
in interfaceWorldAccess
- Specified by:
isChunkLoaded
in interfaceWorldView
-
getBlockState
- Specified by:
getBlockState
in interfaceBlockView
-
getFluidState
- Specified by:
getFluidState
in interfaceBlockView
-
getClosestPlayer
@Nullable public PlayerEntity getClosestPlayer(double x, double y, double z, double maxDistance, Predicate<Entity> targetPredicate)- Specified by:
getClosestPlayer
in interfaceEntityView
-
getAmbientDarkness
public int getAmbientDarkness()- Specified by:
getAmbientDarkness
in interfaceWorldView
-
getBiomeAccess
- Specified by:
getBiomeAccess
in interfaceWorldView
-
getGeneratorStoredBiome
- Specified by:
getGeneratorStoredBiome
in interfaceWorldView
-
getBrightness
- Specified by:
getBrightness
in interfaceBlockRenderView
-
getLightingProvider
- Specified by:
getLightingProvider
in interfaceBlockRenderView
-
breakBlock
public boolean breakBlock(BlockPos pos, boolean drop, @Nullable Entity breakingEntity, int maxUpdateDepth)- Specified by:
breakBlock
in interfaceModifiableWorld
-
getBlockEntity
- Specified by:
getBlockEntity
in interfaceBlockView
-
setBlockState
Updates the block state at a position, calling appropriate callbacks.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:
- 0b0000001 // 1 - PROPAGATE_CHANGE - Propagates a change event to surrounding blocks.
- 0b0000010 // 2 - NOTIFY_LISTENERS - Notifies listeners and clients who need to react when the block changes
- 0b0000100 // 4 - NO_REDRAW - Used in conjunction with NOTIFY_LISTENERS to suppress the render pass on clients.
- 0b0001000 // 8 - REDRAW_ON_MAIN_THREAD - Forces a synchronous redraw on clients.
- 0b0010000 // 16 - FORCE_STATE - Bypass virtual block state changes and forces the passed state to be stored as-is.
- 0b0100000 // 32 - SKIP_DROPS - Prevents the previous block (container) from dropping items when destroyed.
- 0b1000000 // 64 - MOVED - Signals that the current block is being moved to a different location, usually because of a piston.
- Specified by:
setBlockState
in interfaceModifiableWorld
- Parameters:
pos
- the target positionstate
- the block state to setflags
- the bitwise flag combination, as described abovemaxUpdateDepth
- the limit for the cascading block updates
-
markBlockForPostProcessing
-
spawnEntity
- Specified by:
spawnEntity
in interfaceModifiableWorld
-
removeBlock
- Specified by:
removeBlock
in interfaceModifiableWorld
-
getWorldBorder
- Specified by:
getWorldBorder
in interfaceCollisionView
-
isClient
public boolean isClient()Checks if this world view is on the logical client.If the value returned is false, it is expected that this world is present on a logical server.
-
toServerWorld
Deprecated.- Specified by:
toServerWorld
in interfaceServerWorldAccess
-
getRegistryManager
- Specified by:
getRegistryManager
in interfaceclass_5423
-
getLevelProperties
- Specified by:
getLevelProperties
in interfaceWorldAccess
-
getLocalDifficulty
- Specified by:
getLocalDifficulty
in interfaceWorldAccess
-
getChunkManager
- Specified by:
getChunkManager
in interfaceWorldAccess
-
getSeed
public long getSeed()- Specified by:
getSeed
in interfaceStructureWorldAccess
-
getBlockTickScheduler
- Specified by:
getBlockTickScheduler
in interfaceWorldAccess
-
getFluidTickScheduler
- Specified by:
getFluidTickScheduler
in interfaceWorldAccess
-
getSeaLevel
public int getSeaLevel()- Specified by:
getSeaLevel
in interfaceWorldView
-
getRandom
- Specified by:
getRandom
in interfaceWorldAccess
-
getTopY
-
playSound
public void playSound(@Nullable PlayerEntity player, BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch)- Specified by:
playSound
in interfaceWorldAccess
-
addParticle
public void addParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)- Specified by:
addParticle
in interfaceWorldAccess
-
syncWorldEvent
- Specified by:
syncWorldEvent
in interfaceWorldAccess
-
getDimension
- Specified by:
getDimension
in interfaceWorldView
-
testBlockState
- Specified by:
testBlockState
in interfaceTestableWorld
-
getEntitiesByClass
public <T extends Entity> List<T> getEntitiesByClass(Class<? extends T> entityClass, Box box, @Nullable 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.- Specified by:
getEntitiesByClass
in interfaceEntityView
- Parameters:
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 list- Returns:
- a list of entities within the box whose runtime class is a subclass of the given class
-
getOtherEntities
public List<Entity> getOtherEntities(@Nullable Entity except, Box box, @Nullable Predicate<? super Entity> predicate)Computes a list of entities within some box, excluding the given entity, that satisfy the given predicate.- Specified by:
getOtherEntities
in interfaceEntityView
- Parameters:
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.- Returns:
- a list of entities within a box, excluding the given entity, all satisfying the given predicate
-
getPlayers
- Specified by:
getPlayers
in interfaceEntityView
-
getStructures
public Stream<? extends StructureStart<?>> getStructures(ChunkSectionPos pos, StructureFeature<?> feature)- Specified by:
getStructures
in interfaceStructureWorldAccess
-