Package net.minecraft.world
Class ChunkRegion
java.lang.Object
net.minecraft.world.ChunkRegion
- All Implemented Interfaces:
BiomeAccess.Storage,BlockRenderView,BlockView,CollisionView,EntityView,ModifiableTestableWorld,ModifiableWorld,ServerWorldAccess,TestableWorld,WorldAccess,WorldView
public class ChunkRegion extends Object implements ServerWorldAccess
-
Field Summary
Fields Modifier and Type Field Description private BiomeAccessbiomeAccessprivate TickScheduler<Block>blockTickSchedulerprivate intcenterChunkXprivate intcenterChunkZprivate List<Chunk>chunksprivate DimensionTypedimensionprivate 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)intgetAmbientDarkness()BiomeAccessgetBiomeAccess()BlockEntitygetBlockEntity(BlockPos pos)BlockStategetBlockState(BlockPos pos)TickScheduler<Block>getBlockTickScheduler()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>getEntities(Class<? extends T> entityClass, Box box, Predicate<? super T> predicate)List<Entity>getEntities(Entity except, Box box, Predicate<? super Entity> predicate)FluidStategetFluidState(BlockPos pos)TickScheduler<Fluid>getFluidTickScheduler()BiomegetGeneratorStoredBiome(int biomeX, int biomeY, int biomeZ)WorldPropertiesgetLevelProperties()LightingProvidergetLightingProvider()LocalDifficultygetLocalDifficulty(BlockPos pos)List<PlayerEntity>getPlayers()RandomgetRandom()intgetSeaLevel()longgetSeed()intgetTopY(Heightmap.Type heightmap, int x, int z)ServerWorldgetWorld()Deprecated.WorldBordergetWorldBorder()booleanisChunkLoaded(int chunkX, int chunkZ)booleanisClient()Checks if this world view is on the logical client.private voidmarkBlockForPostProcessing(BlockPos pos)booleanmethod_30093(BlockPos blockPos, boolean bool, Entity entity, int int2)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)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.BlockRenderView
getBaseLightLevel, getLightLevel, isSkyVisibleMethods inherited from interface net.minecraft.world.BlockView
getHeight, getLuminance, getMaxLightLevel, method_29546, rayTrace, rayTraceBlockMethods inherited from interface net.minecraft.world.CollisionView
canPlace, doesNotCollide, doesNotCollide, doesNotCollide, doesNotCollide, getBlockCollisions, getCollisions, intersectsEntities, method_30030Methods inherited from interface net.minecraft.world.EntityView
getClosestEntity, getClosestEntity, getClosestEntityIncludingUngeneratedChunks, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getClosestPlayer, getEntities, getEntitiesIncludingUngeneratedChunks, getEntitiesIncludingUngeneratedChunks, getNonSpectatingEntities, getPlayerByUuid, getPlayers, getTargets, isPlayerInRangeMethods inherited from interface net.minecraft.world.ModifiableWorld
breakBlock, breakBlock, setBlockStateMethods inherited from interface net.minecraft.world.WorldAccess
getDifficulty, getDimensionHeight, getEntityCollisions, getMoonPhase, getMoonSize, getSkyAngle, getTopPosition, intersectsEntities, 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
-
-
Constructor Details
-
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
-
method_30093
- Specified by:
method_30093in 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 blockstate 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.
-
getWorld
Deprecated.- Specified by:
getWorldin interfaceWorldAccess
-
getLevelProperties
- Specified by:
getLevelPropertiesin interfaceWorldAccess
-
getLocalDifficulty
- Specified by:
getLocalDifficultyin interfaceWorldAccess
-
getChunkManager
- Specified by:
getChunkManagerin interfaceWorldAccess
-
getSeed
public long getSeed()- Specified by:
getSeedin interfaceServerWorldAccess
-
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
-
getDimension
- Specified by:
getDimensionin interfaceWorldView
-
testBlockState
- Specified by:
testBlockStatein interfaceTestableWorld
-
getEntities
public <T extends Entity> List<T> getEntities(Class<? extends T> entityClass, Box box, @Nullable Predicate<? super T> predicate)- Specified by:
getEntitiesin interfaceEntityView
-
getEntities
public List<Entity> getEntities(@Nullable Entity except, Box box, @Nullable Predicate<? super Entity> predicate)- Specified by:
getEntitiesin interfaceEntityView
-
getPlayers
- Specified by:
getPlayersin interfaceEntityView
-