Class ClientLevel

All Implemented Interfaces:
AutoCloseable, BiomeManager.NoiseBiomeSource, BlockAndTintGetter, BlockGetter, CollisionGetter, CommonLevelAccessor, EntityGetter, LevelAccessor, LevelHeightAccessor, LevelReader, LevelSimulatedReader, LevelSimulatedRW, LevelTimeAccess, LevelWriter, ScheduledTickAccess, 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 p_233643_, BlockState p_233644_, int p_233645_, int p_233646_)
      Specified by:
      setBlock in interface LevelWriter
      Overrides:
      setBlock in class Level
    • queueLightUpdate

      public void queueLightUpdate(Runnable pTask)
    • pollLightUpdates

      public void pollLightUpdates()
    • effects

      public DimensionSpecialEffects effects()
    • tick

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

      private void tickTime()
    • setTimeFromServer

      public void setTimeFromServer(long pGameTime, long pDayTime, boolean pTickDayTime)
    • entitiesForRendering

      public Iterable<Entity> entitiesForRendering()
    • tickEntities

      public void tickEntities()
    • isTickingEntity

      public boolean isTickingEntity(Entity pEntity)
    • shouldTickDeath

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

      public void tickNonPassenger(Entity pEntity)
    • tickPassenger

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

      public void unload(LevelChunk pChunk)
    • onChunkLoaded

      public void onChunkLoaded(ChunkPos pChunkPos)
    • onSectionBecomingNonEmpty

      public void onSectionBecomingNonEmpty(long pSectionPos)
    • 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 p_263381_, double p_263372_, double p_263404_, double p_263365_, Holder<SoundEvent> p_263335_, SoundSource p_263417_, float p_263416_, float p_263349_, long p_263408_)
      Specified by:
      playSeededSound in class Level
    • playSeededSound

      public void playSeededSound(@Nullable Player p_263514_, Entity p_263536_, Holder<SoundEvent> p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_)
      Specified by:
      playSeededSound in class Level
    • playLocalSound

      public void playLocalSound(Entity p_312749_, SoundEvent p_312635_, SoundSource p_312007_, float p_312298_, float p_312772_)
      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 p_104585_, double p_104586_, double p_104587_, double p_104588_, double p_104589_, double p_104590_, List<FireworkExplosion> p_330281_)
      Overrides:
      createFireworks in class Level
    • sendPacketToServer

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

      public RecipeAccess recipeAccess()
      Specified by:
      recipeAccess 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 p_323873_)
      Specified by:
      getMapData in class Level
    • overrideMapData

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

      public void setMapData(MapId p_324501_, MapItemSavedData p_171671_)
      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)
    • setSectionRangeDirty

      public void setSectionRangeDirty(int pMinY, int pMinX, int pMinZ, int pMaxY, int pMaxX, int pMaxZ)
    • 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 p_104714_, boolean p_104715_, boolean p_383197_, double p_104716_, double p_104717_, double p_104718_, double p_104719_, double p_104720_, double p_104721_)
      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()
    • dragonParts

      public List<PartEntity<?>> dragonParts()
      Specified by:
      dragonParts in class Level
    • getUncachedNoiseBiome

      public Holder<Biome> getUncachedNoiseBiome(int p_205516_, int p_205517_, int p_205518_)
    • getSkyDarken

      public float getSkyDarken(float pPartialTick)
    • getSkyColor

      public int getSkyColor(Vec3 pCameraPosition, float pPartialTick)
    • getCloudColor

      public int 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 p_104703_, boolean p_104704_)
    • 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> p_316478_, Vec3 p_233640_, GameEvent.Context p_233641_)
    • 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 p_171667_, BlockState p_171668_)
      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
    • fuelValues

      public FuelValues fuelValues()
      Specified by:
      fuelValues in class Level
    • explode

      public void explode(@Nullable Entity p_363686_, @Nullable DamageSource p_365268_, @Nullable ExplosionDamageCalculator p_363795_, double p_360494_, double p_360591_, double p_364949_, float p_361233_, boolean p_364900_, Level.ExplosionInteraction p_365033_, ParticleOptions p_361889_, ParticleOptions p_361473_, Holder<SoundEvent> p_362359_)
      Specified by:
      explode in class Level
    • getSeaLevel

      public int getSeaLevel()
    • 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