Package net.minecraft.world
Class ChunkRegion
java.lang.Object
net.minecraft.world.ChunkRegion
- All Implemented Interfaces:
class_5423,BiomeAccess.Storage,BlockRenderView,BlockView,CollisionView,EntityView,HeightLimitView,LunarWorldView,ModifiableTestableWorld,ModifiableWorld,ServerWorldAccess,StructureWorldAccess,TestableWorld,WorldAccess,WorldView
public class ChunkRegion extends Object implements StructureWorldAccess
-
Field Summary
Fields Modifier and Type Field Description private BiomeAccessbiomeAccessprivate TickScheduler<Block>blockTickSchedulerprivate intcenterChunkXprivate intcenterChunkZprivate List<Chunk>chunksprivate DimensionTypedimensionprivate StructureAccessorfield_26822private TickScheduler<Fluid>fluidTickSchedulerprivate WorldPropertieslevelPropertiesprivate static LoggerLOGGERprivate ChunkPoslowerCornerprivate Randomrandomprivate longseedprivate ChunkPosupperCornerprivate intwidthprivate ServerWorldworld -
Constructor Summary
Constructors Constructor Description ChunkRegion(ServerWorld world, List<Chunk> chunks) -
Method Summary
Modifier and Type Method Description voidaddParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)booleanbreakBlock(BlockPos pos, boolean drop, Entity breakingEntity, int maxUpdateDepth)voidemitGameEvent(Entity entity, GameEvent event, BlockPos pos)intgetAmbientDarkness()BiomeAccessgetBiomeAccess()BlockEntitygetBlockEntity(BlockPos pos)BlockStategetBlockState(BlockPos pos)TickScheduler<Block>getBlockTickScheduler()intgetBottomSectionLimit()floatgetBrightness(Direction direction, boolean shaded)intgetCenterChunkX()intgetCenterChunkZ()ChunkgetChunk(int chunkX, int chunkZ)ChunkgetChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create)ChunkManagergetChunkManager()PlayerEntitygetClosestPlayer(double x, double y, double z, double maxDistance, Predicate<Entity> targetPredicate)DimensionTypegetDimension()<T extends Entity>
List<T>getEntitiesByType(class_5575<Entity,T> class_5575, Box box, Predicate<? super T> predicate)FluidStategetFluidState(BlockPos pos)TickScheduler<Fluid>getFluidTickScheduler()BiomegetGeneratorStoredBiome(int biomeX, int biomeY, int biomeZ)WorldPropertiesgetLevelProperties()LightingProvidergetLightingProvider()LocalDifficultygetLocalDifficulty(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()RandomgetRandom()DynamicRegistryManagergetRegistryManager()intgetSeaLevel()intgetSectionCount()longgetSeed()Stream<? extends StructureStart<?>>getStructures(ChunkSectionPos pos, StructureFeature<?> feature)intgetTopY(Heightmap.Type heightmap, int x, int z)WorldBordergetWorldBorder()booleanisChunkLoaded(int chunkX, int chunkZ)booleanisClient()Checks if this world view is on the logical client.private voidmarkBlockForPostProcessing(BlockPos pos)voidplaySound(PlayerEntity player, BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch)booleanremoveBlock(BlockPos pos, boolean move)booleansetBlockState(BlockPos pos, BlockState state, int flags, int maxUpdateDepth)Updates the block state at a position, calling appropriate callbacks.booleanspawnEntity(Entity entity)voidsyncWorldEvent(PlayerEntity player, int eventId, BlockPos pos, int data)booleantestBlockState(BlockPos pos, Predicate<BlockState> state)ServerWorldtoServerWorld()Deprecated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.biome.source.BiomeAccess.Storage
method_31609Methods inherited from interface net.minecraft.world.BlockRenderView
getBaseLightLevel, getLightLevel, isSkyVisibleMethods inherited from interface net.minecraft.world.BlockView
getDismountHeight, getDismountHeight, getLuminance, getMaxLightLevel, getStatesInBox, raycast, raycast, raycastBlockMethods inherited from interface net.minecraft.class_5423
getBiomeKey, getEntityCollisions, getTopPosition, intersectsEntitiesMethods inherited from interface net.minecraft.world.CollisionView
canPlace, getBlockCollisions, getBlockCollisions, getCollisions, getEntityCollisions, intersectsEntities, intersectsEntities, isBlockSpaceEmpty, isSpaceEmpty, isSpaceEmpty, isSpaceEmpty, isSpaceEmptyMethods inherited from interface net.minecraft.world.EntityView
getClosestEntity, getClosestEntity, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getEntitiesByClass, getNonSpectatingEntities, getOtherEntities, getPlayerByUuid, getPlayers, getTargets, isPlayerInRangeMethods inherited from interface net.minecraft.world.HeightLimitView
getSection, getSectionIndex, getSectionIndexFromSection, getTopHeightLimit, getTopSectionLimit, isOutOfHeightLimit, isOutOfHeightLimit, method_32890, method_32891Methods inherited from interface net.minecraft.world.LunarWorldView
getMoonPhase, getMoonSize, getSkyAngleMethods inherited from interface net.minecraft.world.ModifiableWorld
breakBlock, breakBlock, setBlockStateMethods inherited from interface net.minecraft.world.ServerWorldAccess
spawnEntityAndPassengersMethods inherited from interface net.minecraft.world.WorldAccess
emitGameEvent, emitGameEvent, getDifficulty, getLunarTime, syncWorldEvent, updateNeighborsMethods 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:
isChunkLoadedin interfaceWorldAccess- Specified by:
isChunkLoadedin interfaceWorldView
-
getBlockState
- Specified by:
getBlockStatein interfaceBlockView
-
getFluidState
- Specified by:
getFluidStatein interfaceBlockView
-
getClosestPlayer
@Nullable public PlayerEntity getClosestPlayer(double x, double y, double z, double maxDistance, Predicate<Entity> targetPredicate)- Specified by:
getClosestPlayerin interfaceEntityView
-
getAmbientDarkness
public int getAmbientDarkness()- Specified by:
getAmbientDarknessin interfaceWorldView
-
getBiomeAccess
- Specified by:
getBiomeAccessin interfaceWorldView
-
getGeneratorStoredBiome
- Specified by:
getGeneratorStoredBiomein interfaceWorldView
-
getBrightness
- Specified by:
getBrightnessin interfaceBlockRenderView
-
getLightingProvider
- Specified by:
getLightingProviderin interfaceBlockRenderView
-
breakBlock
public boolean breakBlock(BlockPos pos, boolean drop, @Nullable Entity breakingEntity, int maxUpdateDepth)- Specified by:
breakBlockin interfaceModifiableWorld
-
getBlockEntity
- Specified by:
getBlockEntityin 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:
setBlockStatein 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:
spawnEntityin interfaceModifiableWorld
-
removeBlock
- Specified by:
removeBlockin interfaceModifiableWorld
-
getWorldBorder
- Specified by:
getWorldBorderin 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:
toServerWorldin interfaceServerWorldAccess
-
getRegistryManager
- Specified by:
getRegistryManagerin interfaceclass_5423
-
getLevelProperties
- Specified by:
getLevelPropertiesin interfaceWorldAccess
-
getLocalDifficulty
- Specified by:
getLocalDifficultyin interfaceWorldAccess
-
getChunkManager
- Specified by:
getChunkManagerin interfaceWorldAccess
-
getSeed
public long getSeed()- Specified by:
getSeedin interfaceStructureWorldAccess
-
getBlockTickScheduler
- Specified by:
getBlockTickSchedulerin interfaceWorldAccess
-
getFluidTickScheduler
- Specified by:
getFluidTickSchedulerin interfaceWorldAccess
-
getSeaLevel
public int getSeaLevel()- Specified by:
getSeaLevelin interfaceWorldView
-
getRandom
- Specified by:
getRandomin interfaceWorldAccess
-
getTopY
-
playSound
public void playSound(@Nullable PlayerEntity player, BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch)- Specified by:
playSoundin interfaceWorldAccess
-
addParticle
public void addParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)- Specified by:
addParticlein interfaceWorldAccess
-
syncWorldEvent
- Specified by:
syncWorldEventin interfaceWorldAccess
-
emitGameEvent
- Specified by:
emitGameEventin interfaceWorldAccess
-
getDimension
- Specified by:
getDimensionin interfaceWorldView
-
testBlockState
- Specified by:
testBlockStatein interfaceTestableWorld
-
getEntitiesByType
public <T extends Entity> List<T> getEntitiesByType(class_5575<Entity,T> class_5575, Box box, Predicate<? super T> predicate)- Specified by:
getEntitiesByTypein interfaceEntityView
-
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:
getOtherEntitiesin 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:
getPlayersin interfaceEntityView
-
getStructures
public Stream<? extends StructureStart<?>> getStructures(ChunkSectionPos pos, StructureFeature<?> feature)- Specified by:
getStructuresin interfaceStructureWorldAccess
-
getSectionCount
public int getSectionCount()- Specified by:
getSectionCountin interfaceHeightLimitView- Specified by:
getSectionCountin interfaceWorldView
-
getBottomSectionLimit
public int getBottomSectionLimit()- Specified by:
getBottomSectionLimitin interfaceHeightLimitView- Specified by:
getBottomSectionLimitin interfaceWorldView
-