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 sequence)
    • setServerVerifiedBlockState

      public void setServerVerifiedBlockState(BlockPos pos, BlockState state, int flags)
    • syncBlockState

      public void syncBlockState(BlockPos pos, BlockState state, Vec3 playerPos)
    • 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 task)
    • pollLightUpdates

      public void pollLightUpdates()
    • effects

      public DimensionSpecialEffects effects()
    • tick

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

      private void tickTime()
    • setTimeFromServer

      public void setTimeFromServer(long gameTime, long dayTime, boolean tickDayTime)
    • entitiesForRendering

      public Iterable<Entity> entitiesForRendering()
    • tickEntities

      public void tickEntities()
    • isTickingEntity

      public boolean isTickingEntity(Entity entity)
    • shouldTickDeath

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

      public void tickNonPassenger(Entity entity)
    • tickPassenger

      private void tickPassenger(Entity mount, Entity rider)
    • unload

      public void unload(LevelChunk chunk)
    • onChunkLoaded

      public void onChunkLoaded(ChunkPos chunkPos)
    • onSectionBecomingNonEmpty

      public void onSectionBecomingNonEmpty(long sectionPos)
    • clearTintCaches

      public void clearTintCaches()
    • hasChunk

      public boolean hasChunk(int chunkX, int chunkZ)
    • getEntityCount

      public int getEntityCount()
    • addEntity

      public void addEntity(Entity entity)
    • removeEntity

      public void removeEntity(int entityId, Entity.RemovalReason reason)
    • getEntity

      @Nullable public Entity getEntity(int id)
      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 posX, int posY, int posZ)
    • getMarkerParticleTarget

      @Nullable private Block 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

      public CrashReportCategory fillReportDetails(CrashReport report)
      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 x, double y, double z, SoundEvent sound, SoundSource category, float volume, float pitch, boolean distanceDelay)
      Overrides:
      playLocalSound in class Level
    • 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 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<?> packet)
      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 mapId, MapItemSavedData mapData)
    • 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 pos, BlockState oldState, BlockState newState, int flags)
      Flags are as in setBlockState
      Specified by:
      sendBlockUpdated in class Level
    • setBlocksDirty

      public void setBlocksDirty(BlockPos blockPos, BlockState oldState, BlockState newState)
      Overrides:
      setBlocksDirty in class Level
    • setSectionDirtyWithNeighbors

      public void setSectionDirtyWithNeighbors(int sectionX, int sectionY, int sectionZ)
    • setSectionRangeDirty

      public void setSectionRangeDirty(int minY, int minX, int minZ, int maxY, int maxX, int maxZ)
    • destroyBlockProgress

      public void destroyBlockProgress(int breakerId, BlockPos pos, int progress)
      Specified by:
      destroyBlockProgress in class Level
    • globalLevelEvent

      public void globalLevelEvent(int id, BlockPos pos, int data)
      Overrides:
      globalLevelEvent in class Level
    • levelEvent

      public void levelEvent(@Nullable Player player, int type, BlockPos pos, int data)
    • addParticle

      public void addParticle(ParticleOptions particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed)
      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 particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed)
      Overrides:
      addAlwaysVisibleParticle in class Level
    • addAlwaysVisibleParticle

      public void addAlwaysVisibleParticle(ParticleOptions particleData, boolean ignoreRange, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed)
      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 partialTick)
    • getSkyColor

      public int getSkyColor(Vec3 cameraPosition, float partialTick)
    • getCloudColor

      public int getCloudColor(float partialTick)
    • getStarBrightness

      public float getStarBrightness(float partialTick)
    • getSkyFlashTime

      public int getSkyFlashTime()
    • setSkyFlashTime

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

      public float getShade(Direction p_104703_, boolean p_104704_)
    • getBlockTint

      public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver)
    • calculateBlockTint

      public int calculateBlockTint(BlockPos blockPos, ColorResolver colorResolver)
    • setDefaultSpawnPos

      public void setDefaultSpawnPos(BlockPos spawnPos, float spawnAngle)
    • 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> map)
    • 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 serverSimulationDistance)
    • 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