Package net.minecraft.client.multiplayer
Class ClientLevel
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.Level
net.minecraft.client.multiplayer.ClientLevel
- All Implemented Interfaces:
AutoCloseable
,BiomeManager.NoiseBiomeSource
,BlockAndTintGetter
,BlockGetter
,CollisionGetter
,CommonLevelAccessor
,EntityGetter
,LevelAccessor
,LevelHeightAccessor
,LevelReader
,LevelSimulatedReader
,LevelSimulatedRW
,LevelTimeAccess
,LevelWriter
,SignalGetter
,IAttachmentHolder
,IBlockAndTintGetterExtension
,IBlockGetterExtension
,ILevelExtension
,ILevelReaderExtension
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
(package private) final class
Nested classes/interfaces inherited from class net.minecraft.world.level.Level
Level.ExplosionInteraction
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BlockStatePredictionHandler
private final ClientChunkCache
private final ClientLevel.ClientLevelData
private static final long
private final ClientPacketListener
private float
private float
private final DimensionSpecialEffects
private final TransientEntitySectionManager
<Entity> private static final double
private final LevelRenderer
private static final int
private static final org.slf4j.Logger
private final Map
<MapId, MapItemSavedData> private final Minecraft
private final ModelDataManager
private static final int
private final it.unimi.dsi.fastutil.ints.Int2ObjectMap
<PartEntity<?>> (package private) final List
<AbstractClientPlayer> private int
private int
(package private) final EntityTickList
private final TickRateManager
private final it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap
<ColorResolver, BlockTintCache> Fields inherited from class net.minecraft.world.level.Level
addend, blockEntityTickers, captureBlockSnapshots, capturedBlockSnapshots, END, isClientSide, levelData, LONG_PARTICLE_CLIP_RANGE, MAX_BRIGHTNESS, MAX_ENTITY_SPAWN_Y, MAX_LEVEL_SIZE, MIN_ENTITY_SPAWN_Y, neighborUpdater, NETHER, oRainLevel, oThunderLevel, OVERWORLD, rainLevel, random, randValue, RESOURCE_KEY_CODEC, restoringBlockSnapshots, SHORT_PARTICLE_CLIP_RANGE, thunderLevel, TICKS_PER_DAY
Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY
Fields inherited from interface net.neoforged.neoforge.common.extensions.ILevelExtension
TRANSLATION_PREFIX
Fields inherited from interface net.minecraft.world.level.SignalGetter
DIRECTIONS
-
Constructor Summary
ConstructorsConstructorDescriptionClientLevel
(ClientPacketListener connection, ClientLevel.ClientLevelData clientLevelData, ResourceKey<Level> dimension, Holder<DimensionType> dimensionType, int viewDistance, int serverSimulationDistance, Supplier<ProfilerFiller> profiler, LevelRenderer levelRenderer, boolean isDebug, long biomeZoomSeed) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAlwaysVisibleParticle
(ParticleOptions particleData, boolean ignoreRange, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) void
addAlwaysVisibleParticle
(ParticleOptions particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) void
addDestroyBlockEffect
(BlockPos pos, BlockState state) void
protected void
addMapData
(Map<MapId, MapItemSavedData> map) void
addParticle
(ParticleOptions particleData, boolean forceAlwaysRender, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) void
addParticle
(ParticleOptions particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) void
animateTick
(int posX, int posY, int posZ) int
calculateBlockTint
(BlockPos blockPos, ColorResolver colorResolver) void
void
createFireworks
(double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, List<FireworkExplosion> explosions) void
destroyBlockProgress
(int breakerId, BlockPos pos, int progress) void
void
doAnimateTick
(int posX, int posY, int posZ, int range, RandomSource random, Block block, BlockPos.MutableBlockPos blockPos) effects()
fillReportDetails
(CrashReport report) Adds some basic stats of the world to the given crash report.void
gameEvent
(Holder<GameEvent> gameEvent, Vec3 pos, GameEvent.Context context) protected Map
<MapId, MapItemSavedData> (package private) BlockStatePredictionHandler
int
getBlockTint
(BlockPos blockPos, ColorResolver colorResolver) getCloudColor
(float partialTick) float
float
Returns the current ratio between game ticks and clock ticks.protected LevelEntityGetter
<Entity> getEntity
(int id) Returns the Entity with the given ID, or null if it doesn't exist in this World.int
getMapData
(MapId mapId) private Block
getModelData
(BlockPos pos) Retrieves model data for a block at the given position.Retrieves the model data manager for the given level.Collection
<PartEntity<?>> All part entities in this world.int
float
getShade
(float normalX, float normalY, float normalZ, boolean shade) Computes the shade for a given normal.float
getSkyColor
(Vec3 pos, float partialTick) float
getSkyDarken
(float partialTick) int
float
getStarBrightness
(float partialTick) getUncachedNoiseBiome
(int x, int y, int z) void
globalLevelEvent
(int id, BlockPos pos, int data) void
handleBlockChangedAck
(int sequence) boolean
hasChunk
(int chunkX, int chunkZ) boolean
void
levelEvent
(Player player, int type, BlockPos pos, int data) void
onChunkLoaded
(ChunkPos chunkPos) void
overrideMapData
(MapId mapId, MapItemSavedData mapData) players()
void
playLocalSound
(double x, double y, double z, SoundEvent sound, SoundSource category, float volume, float pitch, boolean distanceDelay) void
playLocalSound
(Entity entity, SoundEvent sound, SoundSource category, float volume, float pitch) void
playSeededSound
(Player player, double x, double y, double z, Holder<SoundEvent> sound, SoundSource category, float volume, float pitch, long seed) void
playSeededSound
(Player player, Entity entity, Holder<SoundEvent> sound, SoundSource category, float volume, float pitch, long seed) private void
playSound
(double x, double y, double z, SoundEvent soundEvent, SoundSource source, float volume, float pitch, boolean distanceDelay, long seed) void
void
queueLightUpdate
(Runnable task) void
removeEntity
(int entityId, Entity.RemovalReason reason) void
sendBlockUpdated
(BlockPos pos, BlockState oldState, BlockState newState, int flags) Flags are as in setBlockStatevoid
sendPacketToServer
(Packet<?> packet) boolean
setBlock
(BlockPos pos, BlockState state, int flags, int recursionLeft) void
setBlocksDirty
(BlockPos blockPos, BlockState oldState, BlockState newState) void
setDayTime
(long time) Sets the world time.void
setDayTimeFraction
(float dayTimeFraction) void
setDayTimePerTick
(float dayTimePerTick) DO NOT CALL.void
setDefaultSpawnPos
(BlockPos spawnPos, float spawnAngle) void
setGameTime
(long time) void
setMapData
(MapId mapId, MapItemSavedData mapData) void
setSectionDirtyWithNeighbors
(int sectionX, int sectionY, int sectionZ) void
setServerSimulationDistance
(int serverSimulationDistance) void
setServerVerifiedBlockState
(BlockPos pos, BlockState state, int flags) void
setSkyFlashTime
(int timeFlash) boolean
shouldTickDeath
(Entity entity) private void
spawnFluidParticle
(double xStart, double xEnd, double zStart, double zEnd, double y, ParticleOptions particleData) private void
spawnParticle
(BlockPos pos, ParticleOptions particleData, VoxelShape voxelShape, double y) void
syncBlockState
(BlockPos pos, BlockState state, Vec3 playerPos) void
tick
(BooleanSupplier hasTimeLeft) Runs a single tick for the worldvoid
void
tickNonPassenger
(Entity p_entity) private void
tickPassenger
(Entity mount, Entity rider) private void
tickTime()
toString()
private void
trySpawnDripParticles
(BlockPos blockPos, BlockState blockState, ParticleOptions particleData, boolean shapeDownSolid) void
unload
(LevelChunk chunk) Methods inherited from class net.minecraft.world.level.Level
addBlockEntityTicker, addFreshBlockEntities, advanceDaytime, blockEntityChanged, blockEvent, broadcastDamageEvent, broadcastEntityEvent, close, damageSources, destroyBlock, dimension, dimensionType, dimensionTypeRegistration, explode, explode, explode, explode, explode, explode, getBiomeManager, getBlockEntity, getBlockRandomPos, getBlockState, getChunk, getChunk, getChunkAt, getChunkForCollisions, getCurrentDifficultyAt, getDayTime, getEntities, getEntities, getEntities, getEntities, getFluidState, getGameRules, getGameTime, getHeight, getLightEngine, getMaxEntityRadius, getProfiler, getProfilerSupplier, getRainLevel, getRandom, getSeaLevel, getServer, getSharedSpawnAngle, getSharedSpawnPos, getSkyDarken, getSunAngle, getThunderLevel, getWorldBorder, guardEntityTick, increaseMaxEntityRadius, isClientSide, isDay, isDebug, isFluidAtPosition, isInSpawnableBounds, isInWorldBounds, isLoaded, isNight, isRaining, isRainingAt, isStateAtPosition, isThundering, loadedAndEntityCanStandOn, loadedAndEntityCanStandOnFace, markAndNotifyBlock, mayInteract, neighborChanged, neighborChanged, neighborShapeChanged, nextSubTickCount, noSave, onBlockStateChange, playLocalSound, playSeededSound, playSound, playSound, playSound, playSound, playSound, playSound, prepareWeather, registryAccess, removeBlock, removeBlockEntity, setBlock, setBlockAndUpdate, setBlockEntity, setRainLevel, setSpawnSettings, setThunderLevel, shouldTickBlocksAt, shouldTickBlocksAt, tickBlockEntities, updateNeighborsAt, updateNeighborsAtExceptFromFacing, updateNeighbourForOutputSignal, updateSkyBrightness
Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, removeData, serializeAttachments, setData
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.world.level.BlockAndTintGetter
canSeeSky, getBrightness, getRawBrightness
Methods inherited from interface net.minecraft.world.level.BlockGetter
clip, clipWithInteractionOverride, getBlockFloorHeight, getBlockFloorHeight, getBlockStates, getLightEmission, getMaxLightLevel, isBlockInLine
Methods inherited from interface net.minecraft.world.level.CollisionGetter
collidesWithSuffocatingBlock, findFreePosition, findSupportingBlock, getBlockCollisions, getCollisions, getEntityCollisions, isUnobstructed, isUnobstructed, isUnobstructed, noBlockCollision, noCollision, noCollision, noCollision
Methods inherited from interface net.minecraft.world.level.CommonLevelAccessor
getBlockEntity, getEntityCollisions, getHeightmapPos, isUnobstructed
Methods inherited from interface net.minecraft.world.level.EntityGetter
getEntities, getEntitiesOfClass, getEntitiesOfClass, getNearbyEntities, getNearbyPlayers, getNearestEntity, getNearestEntity, getNearestPlayer, getNearestPlayer, getNearestPlayer, getNearestPlayer, getNearestPlayer, getNearestPlayer, getPlayerByUUID, hasNearbyAlivePlayer
Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData
Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockGetterExtension
getAuxLightManager, getAuxLightManager
Methods inherited from interface net.neoforged.neoforge.common.extensions.ILevelExtension
getCapability, getCapability, getCapability, getCapability, getDescription, getDescriptionKey, invalidateCapabilities, invalidateCapabilities
Methods inherited from interface net.neoforged.neoforge.common.extensions.ILevelReaderExtension
holder, holderOrThrow, isAreaLoaded
Methods inherited from interface net.minecraft.world.level.LevelAccessor
blockUpdated, dayTime, gameEvent, gameEvent, gameEvent, gameEvent, getDifficulty, levelEvent, playSound, scheduleTick, scheduleTick, scheduleTick, scheduleTick
Methods inherited from interface net.minecraft.world.level.LevelHeightAccessor
getMaxBuildHeight, getMaxSection, getMinSection, getSectionIndex, getSectionIndexFromSectionY, getSectionsCount, getSectionYFromSectionIndex, isOutsideBuildHeight, isOutsideBuildHeight
Methods inherited from interface net.minecraft.world.level.LevelReader
canSeeSkyFromBelowWater, containsAnyLiquid, getBiome, getBlockStatesIfLoaded, getChunk, getChunk, getHeight, getLightLevelDependentMagicValue, getMaxLocalRawBrightness, getMaxLocalRawBrightness, getMinBuildHeight, getNoiseBiome, getPathfindingCostFromLightLevels, hasChunkAt, hasChunkAt, hasChunksAt, hasChunksAt, hasChunksAt, holderLookup, isEmptyBlock, isWaterAt
Methods inherited from interface net.minecraft.world.level.LevelTimeAccess
getMoonBrightness, getMoonPhase, getTimeOfDay
Methods inherited from interface net.minecraft.world.level.LevelWriter
addFreshEntity, destroyBlock, destroyBlock
Methods inherited from interface net.minecraft.world.level.SignalGetter
getBestNeighborSignal, getControlInputSignal, getDirectSignal, getDirectSignalTo, getSignal, hasNeighborSignal, hasSignal
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
FLUID_PARTICLE_SPAWN_OFFSET
private static final double FLUID_PARTICLE_SPAWN_OFFSET- See Also:
-
NORMAL_LIGHT_UPDATES_PER_FRAME
private static final int NORMAL_LIGHT_UPDATES_PER_FRAME- See Also:
-
LIGHT_UPDATE_QUEUE_SIZE_THRESHOLD
private static final int LIGHT_UPDATE_QUEUE_SIZE_THRESHOLD- See Also:
-
tickingEntities
-
entityStorage
-
connection
-
levelRenderer
-
clientLevelData
-
effects
-
tickRateManager
-
minecraft
-
players
-
mapData
-
CLOUD_COLOR
private static final long CLOUD_COLOR- See Also:
-
skyFlashTime
private int skyFlashTime -
tintCaches
private final it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap<ColorResolver,BlockTintCache> tintCaches -
chunkSource
-
lightUpdateQueue
-
serverSimulationDistance
private int serverSimulationDistance -
blockStatePredictionHandler
-
MARKER_PARTICLE_ITEMS
-
partEntities
-
modelDataManager
-
dayTimeFraction
private float dayTimeFraction -
dayTimePerTick
private float dayTimePerTick
-
-
Constructor Details
-
ClientLevel
public ClientLevel(ClientPacketListener connection, ClientLevel.ClientLevelData clientLevelData, ResourceKey<Level> dimension, Holder<DimensionType> dimensionType, int viewDistance, int serverSimulationDistance, Supplier<ProfilerFiller> profiler, LevelRenderer levelRenderer, boolean isDebug, long biomeZoomSeed)
-
-
Method Details
-
handleBlockChangedAck
public void handleBlockChangedAck(int sequence) -
setServerVerifiedBlockState
-
syncBlockState
-
getBlockStatePredictionHandler
BlockStatePredictionHandler getBlockStatePredictionHandler() -
setBlock
- Specified by:
setBlock
in interfaceLevelWriter
- Overrides:
setBlock
in classLevel
-
queueLightUpdate
-
pollLightUpdates
public void pollLightUpdates() -
isLightUpdateQueueEmpty
public boolean isLightUpdateQueueEmpty() -
effects
-
tick
Runs a single tick for the world -
tickTime
private void tickTime() -
setGameTime
public void setGameTime(long time) -
setDayTime
public void setDayTime(long time) Sets the world time. -
entitiesForRendering
-
tickEntities
public void tickEntities() -
shouldTickDeath
- Overrides:
shouldTickDeath
in classLevel
-
tickNonPassenger
-
tickPassenger
-
unload
-
onChunkLoaded
-
clearTintCaches
public void clearTintCaches() -
hasChunk
public boolean hasChunk(int chunkX, int chunkZ) -
getEntityCount
public int getEntityCount() -
addEntity
-
removeEntity
-
getEntity
Returns the Entity with the given ID, or null if it doesn't exist in this World. -
disconnect
public void disconnect()- Overrides:
disconnect
in classLevel
-
animateTick
public void animateTick(int posX, int posY, int posZ) -
getMarkerParticleTarget
-
doAnimateTick
public void doAnimateTick(int posX, int posY, int posZ, int range, RandomSource random, @Nullable Block block, BlockPos.MutableBlockPos blockPos) -
trySpawnDripParticles
private void trySpawnDripParticles(BlockPos blockPos, BlockState blockState, ParticleOptions particleData, boolean shapeDownSolid) -
spawnParticle
private void spawnParticle(BlockPos pos, ParticleOptions particleData, VoxelShape voxelShape, double y) -
spawnFluidParticle
private void spawnFluidParticle(double xStart, double xEnd, double zStart, double zEnd, double y, ParticleOptions particleData) -
fillReportDetails
Adds some basic stats of the world to the given crash report.- Overrides:
fillReportDetails
in classLevel
-
playSeededSound
public void playSeededSound(@Nullable Player player, double x, double y, double z, Holder<SoundEvent> sound, SoundSource category, float volume, float pitch, long seed) - Specified by:
playSeededSound
in classLevel
-
playSeededSound
public void playSeededSound(@Nullable Player player, Entity entity, Holder<SoundEvent> sound, SoundSource category, float volume, float pitch, long seed) - Specified by:
playSeededSound
in classLevel
-
playLocalSound
public void playLocalSound(Entity entity, SoundEvent sound, SoundSource category, float volume, float pitch) - Overrides:
playLocalSound
in classLevel
-
playLocalSound
public void playLocalSound(double x, double y, double z, SoundEvent sound, SoundSource category, float volume, float pitch, boolean distanceDelay) - Overrides:
playLocalSound
in classLevel
-
playSound
private void playSound(double x, double y, double z, SoundEvent soundEvent, SoundSource source, float volume, float pitch, boolean distanceDelay, long seed) -
createFireworks
public void createFireworks(double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, List<FireworkExplosion> explosions) - Overrides:
createFireworks
in classLevel
-
sendPacketToServer
- Overrides:
sendPacketToServer
in classLevel
-
getRecipeManager
- Specified by:
getRecipeManager
in classLevel
-
tickRateManager
- Specified by:
tickRateManager
in classLevel
-
getBlockTicks
-
getFluidTicks
-
getChunkSource
-
getMapData
- Specified by:
getMapData
in classLevel
-
overrideMapData
-
setMapData
- Specified by:
setMapData
in classLevel
-
getFreeMapId
- Specified by:
getFreeMapId
in classLevel
-
getScoreboard
- Specified by:
getScoreboard
in classLevel
-
sendBlockUpdated
Flags are as in setBlockState- Specified by:
sendBlockUpdated
in classLevel
-
setBlocksDirty
- Overrides:
setBlocksDirty
in classLevel
-
setSectionDirtyWithNeighbors
public void setSectionDirtyWithNeighbors(int sectionX, int sectionY, int sectionZ) -
destroyBlockProgress
- Specified by:
destroyBlockProgress
in classLevel
-
globalLevelEvent
- Overrides:
globalLevelEvent
in classLevel
-
levelEvent
-
addParticle
public void addParticle(ParticleOptions particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) - Specified by:
addParticle
in interfaceLevelAccessor
- Overrides:
addParticle
in classLevel
-
addParticle
public void addParticle(ParticleOptions particleData, boolean forceAlwaysRender, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) - Overrides:
addParticle
in classLevel
-
addAlwaysVisibleParticle
public void addAlwaysVisibleParticle(ParticleOptions particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) - Overrides:
addAlwaysVisibleParticle
in classLevel
-
addAlwaysVisibleParticle
public void addAlwaysVisibleParticle(ParticleOptions particleData, boolean ignoreRange, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) - Overrides:
addAlwaysVisibleParticle
in classLevel
-
players
-
getUncachedNoiseBiome
-
getSkyDarken
public float getSkyDarken(float partialTick) -
getSkyColor
-
getCloudColor
-
getStarBrightness
public float getStarBrightness(float partialTick) -
getSkyFlashTime
public int getSkyFlashTime() -
setSkyFlashTime
public void setSkyFlashTime(int timeFlash) - Overrides:
setSkyFlashTime
in classLevel
-
getShade
-
getBlockTint
-
calculateBlockTint
-
setDefaultSpawnPos
-
toString
-
getLevelData
- Specified by:
getLevelData
in interfaceLevelAccessor
- Overrides:
getLevelData
in classLevel
-
gameEvent
-
getAllMapData
-
addMapData
-
getEntities
- Specified by:
getEntities
in classLevel
-
gatherChunkSourceStats
- Specified by:
gatherChunkSourceStats
in classLevel
-
addDestroyBlockEffect
- Overrides:
addDestroyBlockEffect
in classLevel
-
setServerSimulationDistance
public void setServerSimulationDistance(int serverSimulationDistance) -
getServerSimulationDistance
public int getServerSimulationDistance() -
enabledFeatures
-
potionBrewing
- Specified by:
potionBrewing
in classLevel
-
getPartEntities
Description copied from interface:ILevelExtension
All part entities in this world. Used when collecting entities in an AABB to fix parts being ignored whose parent entity is in a chunk that does not intersect with the AABB. -
getModelDataManager
Description copied from interface:ILevelExtension
Retrieves the model data manager for the given level. May be null on a server level.For model data retrieval, prefer calling
IBlockGetterExtension.getModelData(BlockPos)
rather than this method, as it works on more than just a level. -
getModelData
Description copied from interface:IBlockGetterExtension
Retrieves model data for a block at the given position.- Parameters:
pos
- the position to query- Returns:
- the model data at this position, or
ModelData.EMPTY
if none exists
-
getShade
public float getShade(float normalX, float normalY, float normalZ, boolean shade) Description copied from interface:IBlockAndTintGetterExtension
Computes the shade for a given normal. Alternate version of the vanilla method taking in aDirection
. -
setDayTimeFraction
@Internal public void setDayTimeFraction(float dayTimeFraction) - Specified by:
setDayTimeFraction
in classLevel
-
getDayTimeFraction
@Internal public float getDayTimeFraction()- Specified by:
getDayTimeFraction
in classLevel
-
getDayTimePerTick
public float getDayTimePerTick()Description copied from class:Level
Returns the current ratio between game ticks and clock ticks. If this value is negative, no speed has been set and those two are coupled 1:1 (i.e. vanilla mode).- Specified by:
getDayTimePerTick
in classLevel
-
setDayTimePerTick
@Internal public void setDayTimePerTick(float dayTimePerTick) Description copied from class:Level
DO NOT CALL.Use
ServerLevel.setDayTimePerTick(float)
instead.- Specified by:
setDayTimePerTick
in classLevel
-