Package net.minecraft.world.level
Class Level
- All Implemented Interfaces:
AutoCloseable
,BiomeManager.NoiseBiomeSource
,BlockAndTintGetter
,BlockGetter
,CollisionGetter
,CommonLevelAccessor
,EntityGetter
,LevelAccessor
,LevelHeightAccessor
,LevelReader
,LevelSimulatedReader
,LevelSimulatedRW
,LevelTimeAccess
,LevelWriter
,ICapabilityProvider
,ICapabilityProviderImpl<Level>
,IForgeBlockGetter
,IForgeLevel
- Direct Known Subclasses:
ClientLevel
,ServerLevel
public abstract class Level
extends CapabilityProvider<Level>
implements LevelAccessor, AutoCloseable, IForgeLevel
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
CapabilityProvider.AsField<B extends ICapabilityProviderImpl<B>>
-
Field Summary
Modifier and TypeFieldDescriptionprotected final int
private final BiomeManager
protected final List<TickingBlockEntity>
boolean
private final ResourceKey<Level>
(package private) final DimensionType
private final Holder<DimensionType>
private static final Direction[]
static final ResourceKey<Level>
private final ArrayList<BlockEntity>
final boolean
private final boolean
protected final WritableLevelData
static final int
static final int
static final int
static final int
private double
static final int
static final ResourceKey<Level>
float
float
static final ResourceKey<Level>
private final List<TickingBlockEntity>
private final ArrayList<BlockEntity>
private final Supplier<ProfilerFiller>
float
final Random
protected int
static final com.mojang.serialization.Codec<ResourceKey<Level>>
boolean
static final int
private int
private long
private final Thread
float
private boolean
static final int
private final WorldBorder
-
Constructor Summary
ModifierConstructorDescriptionprotected
Level
(WritableLevelData p_204149_, ResourceKey<Level> p_204150_, Holder<DimensionType> p_204151_, Supplier<ProfilerFiller> p_204152_, boolean p_204153_, boolean p_204154_, long p_204155_) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAlwaysVisibleParticle
(ParticleOptions p_46691_, boolean p_46692_, double p_46693_, double p_46694_, double p_46695_, double p_46696_, double p_46697_, double p_46698_) void
addAlwaysVisibleParticle
(ParticleOptions p_46684_, double p_46685_, double p_46686_, double p_46687_, double p_46688_, double p_46689_, double p_46690_) void
addBlockEntityTicker
(TickingBlockEntity p_151526_) void
addDestroyBlockEffect
(BlockPos p_151531_, BlockState p_151532_) void
addFreshBlockEntities
(Collection<BlockEntity> beList) void
addParticle
(ParticleOptions p_46638_, boolean p_46639_, double p_46640_, double p_46641_, double p_46642_, double p_46643_, double p_46644_, double p_46645_) void
addParticle
(ParticleOptions p_46631_, double p_46632_, double p_46633_, double p_46634_, double p_46635_, double p_46636_, double p_46637_) void
blockEntityChanged
(BlockPos p_151544_) Deprecated.void
blockEntityChangedWithoutNeighborUpdates
(BlockPos p_151544_) void
blockEvent
(BlockPos p_46582_, Block p_46583_, int p_46584_, int p_46585_) void
broadcastEntityEvent
(Entity p_46509_, byte p_46510_) void
close()
void
createFireworks
(double p_46475_, double p_46476_, double p_46477_, double p_46478_, double p_46479_, double p_46480_, CompoundTag p_46481_) boolean
destroyBlock
(BlockPos p_46626_, boolean p_46627_, Entity p_46628_, int p_46629_) abstract void
destroyBlockProgress
(int p_46506_, BlockPos p_46507_, int p_46508_) void
explode
(Entity p_46519_, double p_46520_, double p_46521_, double p_46522_, float p_46523_, boolean p_46524_, Explosion.BlockInteraction p_46525_) explode
(Entity p_46512_, double p_46513_, double p_46514_, double p_46515_, float p_46516_, Explosion.BlockInteraction p_46517_) explode
(Entity p_46526_, DamageSource p_46527_, ExplosionDamageCalculator p_46528_, double p_46529_, double p_46530_, double p_46531_, float p_46532_, boolean p_46533_, Explosion.BlockInteraction p_46534_) fillReportDetails
(CrashReport p_46656_) abstract String
int
getBestNeighborSignal
(BlockPos p_46756_) getBlockEntity
(BlockPos p_46716_) getBlockRandomPos
(int p_46497_, int p_46498_, int p_46499_, int p_46500_) getBlockState
(BlockPos p_46732_) getChunk
(int p_46727_, int p_46728_) getChunk
(int p_46502_, int p_46503_, ChunkStatus p_46504_, boolean p_46505_) getChunkAt
(BlockPos p_46746_) getChunkForCollisions
(int p_46711_, int p_46712_) getCurrentDifficultyAt
(BlockPos p_46730_) long
int
getDirectSignalTo
(BlockPos p_46752_) protected abstract LevelEntityGetter<Entity>
getEntities
(Entity p_46536_, AABB p_46537_, Predicate<? super Entity> p_46538_) getEntities
(EntityTypeTest<Entity, T> p_151528_, AABB p_151529_, Predicate<? super T> p_151530_) abstract Entity
getEntity
(int p_46492_) getFluidState
(BlockPos p_46671_) abstract int
long
int
getHeight
(Heightmap.Types p_46571_, int p_46572_, int p_46573_) abstract MapItemSavedData
getMapData
(String p_46650_) double
The maximum radius to scan for entities when trying to check bounding boxes.float
getRainLevel
(float p_46723_) abstract RecipeManager
abstract Scoreboard
int
int
int
float
getSunAngle
(float p_46491_) float
getThunderLevel
(float p_46662_) void
globalLevelEvent
(int p_46665_, BlockPos p_46666_, int p_46667_) <T extends Entity>
voidguardEntityTick
(Consumer<T> p_46654_, T p_46655_) boolean
hasNeighborSignal
(BlockPos p_46754_) boolean
double
increaseMaxEntityRadius
(double value) Increases the max entity radius, this is safe to call with any value.boolean
boolean
isDay()
final boolean
isDebug()
boolean
isFluidAtPosition
(BlockPos p_151541_, Predicate<FluidState> p_151542_) boolean
static boolean
isInSpawnableBounds
(BlockPos p_46742_) boolean
isInWorldBounds
(BlockPos p_46740_) private static boolean
isInWorldBoundsHorizontal
(BlockPos p_46458_) boolean
boolean
isNight()
private static boolean
isOutsideSpawnableHeight
(int p_46725_) boolean
boolean
isRainingAt
(BlockPos p_46759_) boolean
isStateAtPosition
(BlockPos p_46620_, Predicate<BlockState> p_46621_) boolean
boolean
loadedAndEntityCanStandOn
(BlockPos p_46576_, Entity p_46577_) boolean
loadedAndEntityCanStandOnFace
(BlockPos p_46579_, Entity p_46580_, Direction p_46581_) void
markAndNotifyBlock
(BlockPos p_46605_, LevelChunk levelchunk, BlockState blockstate, BlockState p_46606_, int p_46607_, int p_46608_) boolean
mayInteract
(Player p_46557_, BlockPos p_46558_) void
neighborChanged
(BlockPos p_46587_, Block p_46588_, BlockPos p_46589_) long
boolean
noSave()
void
onBlockStateChange
(BlockPos p_46609_, BlockState p_46610_, BlockState p_46611_) void
playLocalSound
(double p_46482_, double p_46483_, double p_46484_, SoundEvent p_46485_, SoundSource p_46486_, float p_46487_, float p_46488_, boolean p_46489_) abstract void
playSound
(Player p_46543_, double p_46544_, double p_46545_, double p_46546_, SoundEvent p_46547_, SoundSource p_46548_, float p_46549_, float p_46550_) void
playSound
(Player p_46560_, BlockPos p_46561_, SoundEvent p_46562_, SoundSource p_46563_, float p_46564_, float p_46565_) abstract void
playSound
(Player p_46551_, Entity p_46552_, SoundEvent p_46553_, SoundSource p_46554_, float p_46555_, float p_46556_) protected void
postGameEventInRadius
(Entity p_151514_, GameEvent p_151515_, BlockPos p_151516_, int p_151517_) protected void
boolean
removeBlock
(BlockPos p_46623_, boolean p_46624_) void
removeBlockEntity
(BlockPos p_46748_) abstract void
sendBlockUpdated
(BlockPos p_46612_, BlockState p_46613_, BlockState p_46614_, int p_46615_) void
sendPacketToServer
(Packet<?> p_46657_) boolean
setBlock
(BlockPos p_46601_, BlockState p_46602_, int p_46603_) boolean
setBlock
(BlockPos p_46605_, BlockState p_46606_, int p_46607_, int p_46608_) boolean
setBlockAndUpdate
(BlockPos p_46598_, BlockState p_46599_) void
setBlockEntity
(BlockEntity p_151524_) void
setBlocksDirty
(BlockPos p_46678_, BlockState p_46679_, BlockState p_46680_) abstract void
setMapData
(String p_151533_, MapItemSavedData p_151534_) void
setRainLevel
(float p_46735_) void
setSkyFlashTime
(int p_46709_) void
setSpawnSettings
(boolean p_46704_, boolean p_46705_) void
setThunderLevel
(float p_46708_) boolean
shouldTickBlocksAt
(long p_186456_) boolean
shouldTickDeath
(Entity p_186458_) protected void
void
updateNeighborsAt
(BlockPos p_46673_, Block p_46674_) void
updateNeighborsAtExceptFromFacing
(BlockPos p_46591_, Block p_46592_, Direction p_46593_) void
updateNeighbourForOutputSignal
(BlockPos p_46718_, Block p_46719_) void
Methods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, getCapability, invalidateCaps, reviveCaps, serializeCaps
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.world.level.BlockAndTintGetter
canSeeSky, getBrightness, getRawBrightness, getShade
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, getBlockCollisions, getCollisions, getEntityCollisions, isUnobstructed, isUnobstructed, isUnobstructed, noCollision, noCollision, noCollision
Methods inherited from interface net.minecraft.world.level.CommonLevelAccessor
getBlockEntity, getEntityCollisions, getHeightmapPos, isUnobstructed, registryAccess
Methods inherited from interface net.minecraft.world.level.EntityGetter
getEntities, getEntitiesOfClass, getEntitiesOfClass, getNearbyEntities, getNearbyPlayers, getNearestEntity, getNearestEntity, getNearestPlayer, getNearestPlayer, getNearestPlayer, getNearestPlayer, getNearestPlayer, getNearestPlayer, getPlayerByUUID, hasNearbyAlivePlayer, players
Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapability, getCapability
Methods inherited from interface net.minecraftforge.common.extensions.IForgeBlockGetter
getExistingBlockEntity
Methods inherited from interface net.minecraftforge.common.extensions.IForgeLevel
getPartEntities
Methods inherited from interface net.minecraft.world.level.LevelAccessor
blockUpdated, dayTime, gameEvent, gameEvent, gameEvent, gameEvent, getBlockTicks, getChunkSource, getDifficulty, getFluidTicks, hasChunk, levelEvent, levelEvent, 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, getBlockTint, getBrightness, getChunk, getChunk, getDirectSignal, getHeight, getMaxLocalRawBrightness, getMaxLocalRawBrightness, getMinBuildHeight, getNoiseBiome, getUncachedNoiseBiome, hasChunkAt, hasChunkAt, hasChunksAt, hasChunksAt, hasChunksAt, isAreaLoaded, 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
-
Field Details
-
RESOURCE_KEY_CODEC
-
OVERWORLD
-
NETHER
-
END
-
MAX_LEVEL_SIZE
public static final int MAX_LEVEL_SIZE- See Also:
-
LONG_PARTICLE_CLIP_RANGE
public static final int LONG_PARTICLE_CLIP_RANGE- See Also:
-
SHORT_PARTICLE_CLIP_RANGE
public static final int SHORT_PARTICLE_CLIP_RANGE- See Also:
-
DIRECTIONS
-
MAX_BRIGHTNESS
public static final int MAX_BRIGHTNESS- See Also:
-
TICKS_PER_DAY
public static final int TICKS_PER_DAY- See Also:
-
MAX_ENTITY_SPAWN_Y
public static final int MAX_ENTITY_SPAWN_Y- See Also:
-
MIN_ENTITY_SPAWN_Y
public static final int MIN_ENTITY_SPAWN_Y- See Also:
-
blockEntityTickers
-
pendingBlockEntityTickers
-
tickingBlockEntities
private boolean tickingBlockEntities -
thread
-
isDebug
private final boolean isDebug -
skyDarken
private int skyDarken -
randValue
protected int randValue -
addend
protected final int addend- See Also:
-
oRainLevel
public float oRainLevel -
rainLevel
public float rainLevel -
oThunderLevel
public float oThunderLevel -
thunderLevel
public float thunderLevel -
random
-
dimensionType
-
dimensionTypeRegistration
-
levelData
-
profiler
-
isClientSide
public final boolean isClientSide -
worldBorder
-
biomeManager
-
dimension
-
subTickCount
private long subTickCount -
restoringBlockSnapshots
public boolean restoringBlockSnapshots -
captureBlockSnapshots
public boolean captureBlockSnapshots -
capturedBlockSnapshots
-
freshBlockEntities
-
pendingFreshBlockEntities
-
maxEntityRadius
private double maxEntityRadius
-
-
Constructor Details
-
Level
protected Level(WritableLevelData p_204149_, ResourceKey<Level> p_204150_, Holder<DimensionType> p_204151_, Supplier<ProfilerFiller> p_204152_, boolean p_204153_, boolean p_204154_, long p_204155_)
-
-
Method Details
-
isClientSide
public boolean isClientSide()- Specified by:
isClientSide
in interfaceLevelReader
-
getServer
- Specified by:
getServer
in interfaceLevelAccessor
-
isInWorldBounds
-
isInSpawnableBounds
-
isInWorldBoundsHorizontal
-
isOutsideSpawnableHeight
private static boolean isOutsideSpawnableHeight(int p_46725_) -
getChunkAt
-
getChunk
- Specified by:
getChunk
in interfaceLevelReader
-
getChunk
@Nullable public ChunkAccess getChunk(int p_46502_, int p_46503_, ChunkStatus p_46504_, boolean p_46505_) - Specified by:
getChunk
in interfaceLevelReader
-
setBlock
- Specified by:
setBlock
in interfaceLevelWriter
-
setBlock
- Specified by:
setBlock
in interfaceLevelWriter
-
markAndNotifyBlock
public void markAndNotifyBlock(BlockPos p_46605_, @Nullable LevelChunk levelchunk, BlockState blockstate, BlockState p_46606_, int p_46607_, int p_46608_) -
onBlockStateChange
-
removeBlock
- Specified by:
removeBlock
in interfaceLevelWriter
-
destroyBlock
public boolean destroyBlock(BlockPos p_46626_, boolean p_46627_, @Nullable Entity p_46628_, int p_46629_) - Specified by:
destroyBlock
in interfaceLevelWriter
-
addDestroyBlockEffect
-
setBlockAndUpdate
-
sendBlockUpdated
public abstract void sendBlockUpdated(BlockPos p_46612_, BlockState p_46613_, BlockState p_46614_, int p_46615_) -
setBlocksDirty
-
updateNeighborsAt
-
updateNeighborsAtExceptFromFacing
-
neighborChanged
-
getHeight
- Specified by:
getHeight
in interfaceLevelReader
-
getLightEngine
- Specified by:
getLightEngine
in interfaceBlockAndTintGetter
-
getBlockState
- Specified by:
getBlockState
in interfaceBlockGetter
-
getFluidState
- Specified by:
getFluidState
in interfaceBlockGetter
-
isDay
public boolean isDay() -
isNight
public boolean isNight() -
playSound
public void playSound(@Nullable Player p_46560_, BlockPos p_46561_, SoundEvent p_46562_, SoundSource p_46563_, float p_46564_, float p_46565_) - Specified by:
playSound
in interfaceLevelAccessor
-
playSound
public abstract void playSound(@Nullable Player p_46543_, double p_46544_, double p_46545_, double p_46546_, SoundEvent p_46547_, SoundSource p_46548_, float p_46549_, float p_46550_) -
playSound
public abstract void playSound(@Nullable Player p_46551_, Entity p_46552_, SoundEvent p_46553_, SoundSource p_46554_, float p_46555_, float p_46556_) -
playLocalSound
public void playLocalSound(double p_46482_, double p_46483_, double p_46484_, SoundEvent p_46485_, SoundSource p_46486_, float p_46487_, float p_46488_, boolean p_46489_) -
addParticle
public void addParticle(ParticleOptions p_46631_, double p_46632_, double p_46633_, double p_46634_, double p_46635_, double p_46636_, double p_46637_) - Specified by:
addParticle
in interfaceLevelAccessor
-
addParticle
public void addParticle(ParticleOptions p_46638_, boolean p_46639_, double p_46640_, double p_46641_, double p_46642_, double p_46643_, double p_46644_, double p_46645_) -
addAlwaysVisibleParticle
public void addAlwaysVisibleParticle(ParticleOptions p_46684_, double p_46685_, double p_46686_, double p_46687_, double p_46688_, double p_46689_, double p_46690_) -
addAlwaysVisibleParticle
public void addAlwaysVisibleParticle(ParticleOptions p_46691_, boolean p_46692_, double p_46693_, double p_46694_, double p_46695_, double p_46696_, double p_46697_, double p_46698_) -
getSunAngle
public float getSunAngle(float p_46491_) -
addBlockEntityTicker
-
addFreshBlockEntities
-
tickBlockEntities
protected void tickBlockEntities() -
guardEntityTick
-
shouldTickDeath
-
shouldTickBlocksAt
public boolean shouldTickBlocksAt(long p_186456_) -
explode
public Explosion explode(@Nullable Entity p_46512_, double p_46513_, double p_46514_, double p_46515_, float p_46516_, Explosion.BlockInteraction p_46517_) -
explode
public Explosion explode(@Nullable Entity p_46519_, double p_46520_, double p_46521_, double p_46522_, float p_46523_, boolean p_46524_, Explosion.BlockInteraction p_46525_) -
explode
public Explosion explode(@Nullable Entity p_46526_, @Nullable DamageSource p_46527_, @Nullable ExplosionDamageCalculator p_46528_, double p_46529_, double p_46530_, double p_46531_, float p_46532_, boolean p_46533_, Explosion.BlockInteraction p_46534_) -
gatherChunkSourceStats
-
getBlockEntity
- Specified by:
getBlockEntity
in interfaceBlockGetter
-
setBlockEntity
-
removeBlockEntity
-
isLoaded
-
loadedAndEntityCanStandOnFace
-
loadedAndEntityCanStandOn
-
updateSkyBrightness
public void updateSkyBrightness() -
setSpawnSettings
public void setSpawnSettings(boolean p_46704_, boolean p_46705_) -
prepareWeather
protected void prepareWeather() -
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
-
getChunkForCollisions
- Specified by:
getChunkForCollisions
in interfaceCollisionGetter
- Specified by:
getChunkForCollisions
in interfaceLevelReader
-
getEntities
public List<Entity> getEntities(@Nullable Entity p_46536_, AABB p_46537_, Predicate<? super Entity> p_46538_) - Specified by:
getEntities
in interfaceEntityGetter
-
getEntities
public <T extends Entity> List<T> getEntities(EntityTypeTest<Entity, T> p_151528_, AABB p_151529_, Predicate<? super T> p_151530_) - Specified by:
getEntities
in interfaceEntityGetter
-
getEntity
-
blockEntityChangedWithoutNeighborUpdates
-
blockEntityChanged
Deprecated.CallblockEntityChangedWithoutNeighborUpdates(BlockPos)
instead. See #9235 for details. -
getSeaLevel
public int getSeaLevel()- Specified by:
getSeaLevel
in interfaceLevelReader
-
getDirectSignalTo
-
hasSignal
-
getSignal
-
hasNeighborSignal
-
getBestNeighborSignal
-
disconnect
public void disconnect() -
getGameTime
public long getGameTime() -
getDayTime
public long getDayTime() -
mayInteract
-
broadcastEntityEvent
-
blockEvent
-
getLevelData
- Specified by:
getLevelData
in interfaceLevelAccessor
-
getGameRules
-
getThunderLevel
public float getThunderLevel(float p_46662_) -
setThunderLevel
public void setThunderLevel(float p_46708_) -
getRainLevel
public float getRainLevel(float p_46723_) -
setRainLevel
public void setRainLevel(float p_46735_) -
isThundering
public boolean isThundering() -
isRaining
public boolean isRaining() -
isRainingAt
-
isHumidAt
-
getMapData
-
setMapData
-
getFreeMapId
public abstract int getFreeMapId() -
globalLevelEvent
-
fillReportDetails
-
destroyBlockProgress
-
createFireworks
public void createFireworks(double p_46475_, double p_46476_, double p_46477_, double p_46478_, double p_46479_, double p_46480_, @Nullable CompoundTag p_46481_) -
getScoreboard
-
updateNeighbourForOutputSignal
-
getCurrentDifficultyAt
- Specified by:
getCurrentDifficultyAt
in interfaceLevelAccessor
-
getSkyDarken
public int getSkyDarken()- Specified by:
getSkyDarken
in interfaceLevelReader
-
setSkyFlashTime
public void setSkyFlashTime(int p_46709_) -
getWorldBorder
- Specified by:
getWorldBorder
in interfaceCollisionGetter
-
sendPacketToServer
-
dimensionType
- Specified by:
dimensionType
in interfaceLevelReader
-
dimensionTypeRegistration
-
dimension
-
getRandom
- Specified by:
getRandom
in interfaceLevelAccessor
-
isStateAtPosition
- Specified by:
isStateAtPosition
in interfaceLevelSimulatedReader
-
isFluidAtPosition
- Specified by:
isFluidAtPosition
in interfaceLevelSimulatedReader
-
getRecipeManager
-
getBlockRandomPos
-
noSave
public boolean noSave() -
getProfiler
-
getProfilerSupplier
-
getBiomeManager
- Specified by:
getBiomeManager
in interfaceLevelReader
-
getMaxEntityRadius
public double getMaxEntityRadius()Description copied from interface:IForgeLevel
The maximum radius to scan for entities when trying to check bounding boxes. Vanilla's default is 2.0D But mods that add larger entities may increase this.- Specified by:
getMaxEntityRadius
in interfaceIForgeLevel
-
increaseMaxEntityRadius
public double increaseMaxEntityRadius(double value) Description copied from interface:IForgeLevel
Increases the max entity radius, this is safe to call with any value. The setter will verify the input value is larger then the current setting.- Specified by:
increaseMaxEntityRadius
in interfaceIForgeLevel
- Parameters:
value
- New max radius to set.- Returns:
- The new max radius
-
isDebug
public final boolean isDebug() -
getEntities
-
postGameEventInRadius
-
nextSubTickCount
public long nextSubTickCount()- Specified by:
nextSubTickCount
in interfaceLevelAccessor
-
blockEntityChangedWithoutNeighborUpdates(BlockPos)
instead.