Class 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

public class ClientLevel extends Level
  • Field Details

  • Constructor Details

  • Method Details

    • handleBlockChangedAck

      public void handleBlockChangedAck(int pSequence)
    • setServerVerifiedBlockState

      public void setServerVerifiedBlockState(BlockPos pPos, BlockState pState, int pFlags)
    • syncBlockState

      public void syncBlockState(BlockPos pPos, BlockState pState, Vec3 pPlayerPos)
    • getBlockStatePredictionHandler

      BlockStatePredictionHandler getBlockStatePredictionHandler()
    • setBlock

      public boolean setBlock(BlockPos pPos, BlockState pState, int pFlags, int pRecursionLeft)
      Specified by:
      setBlock in interface LevelWriter
      Overrides:
      setBlock in class Level
    • queueLightUpdate

      public void queueLightUpdate(Runnable pTask)
    • pollLightUpdates

      public void pollLightUpdates()
    • isLightUpdateQueueEmpty

      public boolean isLightUpdateQueueEmpty()
    • effects

      public DimensionSpecialEffects effects()
    • tick

      public void tick(BooleanSupplier pHasTimeLeft)
      Runs a single tick for the world
    • tickTime

      private void tickTime()
    • setGameTime

      public void setGameTime(long pTime)
    • setDayTime

      public void setDayTime(long pTime)
      Sets the world time.
    • entitiesForRendering

      public Iterable<Entity> entitiesForRendering()
    • tickEntities

      public void tickEntities()
    • shouldTickDeath

      public boolean shouldTickDeath(Entity pEntity)
      Overrides:
      shouldTickDeath in class Level
    • tickNonPassenger

      public void tickNonPassenger(Entity p_104640_)
    • tickPassenger

      private void tickPassenger(Entity pMount, Entity pRider)
    • unload

      public void unload(LevelChunk pChunk)
    • onChunkLoaded

      public void onChunkLoaded(ChunkPos pChunkPos)
    • clearTintCaches

      public void clearTintCaches()
    • hasChunk

      public boolean hasChunk(int pChunkX, int pChunkZ)
    • getEntityCount

      public int getEntityCount()
    • addEntity

      public void addEntity(Entity pEntity)
    • removeEntity

      public void removeEntity(int pEntityId, Entity.RemovalReason pReason)
    • getEntity

      @Nullable public Entity getEntity(int pId)
      Returns the Entity with the given ID, or null if it doesn't exist in this World.
      Specified by:
      getEntity in class Level
    • disconnect

      public void disconnect()
      Overrides:
      disconnect in class Level
    • animateTick

      public void animateTick(int pPosX, int pPosY, int pPosZ)
    • getMarkerParticleTarget

      @Nullable private Block getMarkerParticleTarget()
    • doAnimateTick

      public void doAnimateTick(int pPosX, int pPosY, int pPosZ, int pRange, RandomSource pRandom, @Nullable Block pBlock, BlockPos.MutableBlockPos pBlockPos)
    • trySpawnDripParticles

      private void trySpawnDripParticles(BlockPos pBlockPos, BlockState pBlockState, ParticleOptions pParticleData, boolean pShapeDownSolid)
    • spawnParticle

      private void spawnParticle(BlockPos pPos, ParticleOptions pParticleData, VoxelShape pVoxelShape, double pY)
    • spawnFluidParticle

      private void spawnFluidParticle(double pXStart, double pXEnd, double pZStart, double pZEnd, double pY, ParticleOptions pParticleData)
    • fillReportDetails

      public CrashReportCategory fillReportDetails(CrashReport pReport)
      Adds some basic stats of the world to the given crash report.
      Overrides:
      fillReportDetails in class Level
    • playSeededSound

      public void playSeededSound(@Nullable Player pPlayer, double pX, double pY, double pZ, Holder<SoundEvent> pSound, SoundSource pCategory, float pVolume, float pPitch, long pSeed)
      Specified by:
      playSeededSound in class Level
    • playSeededSound

      public void playSeededSound(@Nullable Player pPlayer, Entity pEntity, Holder<SoundEvent> pSound, SoundSource pCategory, float pVolume, float pPitch, long pSeed)
      Specified by:
      playSeededSound in class Level
    • playLocalSound

      public void playLocalSound(Entity pEntity, SoundEvent pSound, SoundSource pCategory, float pVolume, float pPitch)
      Overrides:
      playLocalSound in class Level
    • playLocalSound

      public void playLocalSound(double pX, double pY, double pZ, SoundEvent pSound, SoundSource pCategory, float pVolume, float pPitch, boolean pDistanceDelay)
      Overrides:
      playLocalSound in class Level
    • playSound

      private void playSound(double pX, double pY, double pZ, SoundEvent pSoundEvent, SoundSource pSource, float pVolume, float pPitch, boolean pDistanceDelay, long pSeed)
    • createFireworks

      public void createFireworks(double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed, List<FireworkExplosion> pExplosions)
      Overrides:
      createFireworks in class Level
    • sendPacketToServer

      public void sendPacketToServer(Packet<?> pPacket)
      Overrides:
      sendPacketToServer in class Level
    • getRecipeManager

      public RecipeManager getRecipeManager()
      Specified by:
      getRecipeManager in class Level
    • tickRateManager

      public TickRateManager tickRateManager()
      Specified by:
      tickRateManager in class Level
    • getBlockTicks

      public LevelTickAccess<Block> getBlockTicks()
    • getFluidTicks

      public LevelTickAccess<Fluid> getFluidTicks()
    • getChunkSource

      public ClientChunkCache getChunkSource()
    • getMapData

      @Nullable public MapItemSavedData getMapData(MapId pMapId)
      Specified by:
      getMapData in class Level
    • overrideMapData

      public void overrideMapData(MapId pMapId, MapItemSavedData pMapData)
    • setMapData

      public void setMapData(MapId pMapId, MapItemSavedData pMapData)
      Specified by:
      setMapData in class Level
    • getFreeMapId

      public MapId getFreeMapId()
      Specified by:
      getFreeMapId in class Level
    • getScoreboard

      public Scoreboard getScoreboard()
      Specified by:
      getScoreboard in class Level
    • sendBlockUpdated

      public void sendBlockUpdated(BlockPos pPos, BlockState pOldState, BlockState pNewState, int pFlags)
      Flags are as in setBlockState
      Specified by:
      sendBlockUpdated in class Level
    • setBlocksDirty

      public void setBlocksDirty(BlockPos pBlockPos, BlockState pOldState, BlockState pNewState)
      Overrides:
      setBlocksDirty in class Level
    • setSectionDirtyWithNeighbors

      public void setSectionDirtyWithNeighbors(int pSectionX, int pSectionY, int pSectionZ)
    • destroyBlockProgress

      public void destroyBlockProgress(int pBreakerId, BlockPos pPos, int pProgress)
      Specified by:
      destroyBlockProgress in class Level
    • globalLevelEvent

      public void globalLevelEvent(int pId, BlockPos pPos, int pData)
      Overrides:
      globalLevelEvent in class Level
    • levelEvent

      public void levelEvent(@Nullable Player pPlayer, int pType, BlockPos pPos, int pData)
    • addParticle

      public void addParticle(ParticleOptions pParticleData, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed)
      Specified by:
      addParticle in interface LevelAccessor
      Overrides:
      addParticle in class Level
    • addParticle

      public void addParticle(ParticleOptions pParticleData, boolean pForceAlwaysRender, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed)
      Overrides:
      addParticle in class Level
    • addAlwaysVisibleParticle

      public void addAlwaysVisibleParticle(ParticleOptions pParticleData, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed)
      Overrides:
      addAlwaysVisibleParticle in class Level
    • addAlwaysVisibleParticle

      public void addAlwaysVisibleParticle(ParticleOptions pParticleData, boolean pIgnoreRange, double pX, double pY, double pZ, double pXSpeed, double pYSpeed, double pZSpeed)
      Overrides:
      addAlwaysVisibleParticle in class Level
    • players

      public List<AbstractClientPlayer> players()
    • getUncachedNoiseBiome

      public Holder<Biome> getUncachedNoiseBiome(int pX, int pY, int pZ)
    • getSkyDarken

      public float getSkyDarken(float pPartialTick)
    • getSkyColor

      public Vec3 getSkyColor(Vec3 pPos, float pPartialTick)
    • getCloudColor

      public Vec3 getCloudColor(float pPartialTick)
    • getStarBrightness

      public float getStarBrightness(float pPartialTick)
    • getSkyFlashTime

      public int getSkyFlashTime()
    • setSkyFlashTime

      public void setSkyFlashTime(int pTimeFlash)
      Overrides:
      setSkyFlashTime in class Level
    • getShade

      public float getShade(Direction pDirection, boolean pShade)
    • getBlockTint

      public int getBlockTint(BlockPos pBlockPos, ColorResolver pColorResolver)
    • calculateBlockTint

      public int calculateBlockTint(BlockPos pBlockPos, ColorResolver pColorResolver)
    • setDefaultSpawnPos

      public void setDefaultSpawnPos(BlockPos pSpawnPos, float pSpawnAngle)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLevelData

      public ClientLevel.ClientLevelData getLevelData()
      Specified by:
      getLevelData in interface LevelAccessor
      Overrides:
      getLevelData in class Level
    • gameEvent

      public void gameEvent(Holder<GameEvent> pGameEvent, Vec3 pPos, GameEvent.Context pContext)
    • getAllMapData

      protected Map<MapId,MapItemSavedData> getAllMapData()
    • addMapData

      protected void addMapData(Map<MapId,MapItemSavedData> pMap)
    • getEntities

      protected LevelEntityGetter<Entity> getEntities()
      Specified by:
      getEntities in class Level
    • gatherChunkSourceStats

      public String gatherChunkSourceStats()
      Specified by:
      gatherChunkSourceStats in class Level
    • addDestroyBlockEffect

      public void addDestroyBlockEffect(BlockPos pPos, BlockState pState)
      Overrides:
      addDestroyBlockEffect in class Level
    • setServerSimulationDistance

      public void setServerSimulationDistance(int pServerSimulationDistance)
    • getServerSimulationDistance

      public int getServerSimulationDistance()
    • enabledFeatures

      public FeatureFlagSet enabledFeatures()
    • potionBrewing

      public PotionBrewing potionBrewing()
      Specified by:
      potionBrewing in class Level
    • getPartEntities

      public Collection<PartEntity<?>> 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

      public ModelDataManager 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

      public ModelData getModelData(BlockPos pos)
      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 a Direction.
    • setDayTimeFraction

      @Internal public void setDayTimeFraction(float dayTimeFraction)
      Specified by:
      setDayTimeFraction in class Level
    • getDayTimeFraction

      @Internal public float getDayTimeFraction()
      Specified by:
      getDayTimeFraction in class Level
    • 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 class Level
    • setDayTimePerTick

      @Internal public void setDayTimePerTick(float dayTimePerTick)
      Description copied from class: Level
      DO NOT CALL.

      Use ServerLevel.setDayTimePerTick(float) instead.

      Specified by:
      setDayTimePerTick in class Level