minecraft-source/src/net/minecraft/world/level/chunk/ChunkAccess.java

145 lines
4.5 KiB
Java
Raw Normal View History

2020-07-22 06:23:34 +01:00
package net.minecraft.world.level.chunk;
import it.unimi.dsi.fastutil.shorts.ShortArrayList;
2020-07-22 06:25:47 +01:00
import net.minecraft.Util;
2020-07-22 06:23:34 +01:00
import java.util.BitSet;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.TickList;
import java.util.stream.Stream;
import net.minecraft.nbt.CompoundTag;
import it.unimi.dsi.fastutil.shorts.ShortList;
import org.apache.logging.log4j.LogManager;
import net.minecraft.world.level.levelgen.structure.StructureStart;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.levelgen.Heightmap;
import java.util.Map;
import java.util.Collection;
import java.util.Set;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.entity.BlockEntity;
import javax.annotation.Nullable;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos;
2020-07-22 06:25:47 +01:00
import net.minecraft.world.level.BlockGetter;
2020-07-22 06:23:34 +01:00
2020-07-22 06:25:47 +01:00
public interface ChunkAccess extends BlockGetter, FeatureAccess {
2020-07-22 06:23:34 +01:00
@Nullable
2020-07-22 06:25:47 +01:00
BlockState setBlockState(final BlockPos fk, final BlockState byg, final boolean boolean3);
2020-07-22 06:23:34 +01:00
2020-07-22 06:25:47 +01:00
void setBlockEntity(final BlockPos fk, final BlockEntity bwi);
2020-07-22 06:23:34 +01:00
2020-07-22 06:25:47 +01:00
void addEntity(final Entity akn);
2020-07-22 06:23:34 +01:00
@Nullable
default LevelChunkSection getHighestSection() {
final LevelChunkSection[] arr2 = this.getSections();
for (int integer3 = arr2.length - 1; integer3 >= 0; --integer3) {
2020-07-22 06:25:47 +01:00
final LevelChunkSection caj4 = arr2[integer3];
if (!LevelChunkSection.isEmpty(caj4)) {
return caj4;
2020-07-22 06:23:34 +01:00
}
}
return null;
}
default int getHighestSectionPosition() {
2020-07-22 06:25:47 +01:00
final LevelChunkSection caj2 = this.getHighestSection();
return (caj2 == null) ? 0 : caj2.bottomBlockY();
2020-07-22 06:23:34 +01:00
}
Set<BlockPos> getBlockEntitiesPos();
LevelChunkSection[] getSections();
Collection<Map.Entry<Heightmap.Types, Heightmap>> getHeightmaps();
void setHeightmap(final Heightmap.Types a, final long[] arr);
Heightmap getOrCreateHeightmapUnprimed(final Heightmap.Types a);
int getHeight(final Heightmap.Types a, final int integer2, final int integer3);
ChunkPos getPos();
void setLastSaveTime(final long long1);
Map<String, StructureStart> getAllStarts();
void setAllStarts(final Map<String, StructureStart> map);
default boolean isYSpaceEmpty(int integer1, int integer2) {
if (integer1 < 0) {
integer1 = 0;
}
if (integer2 >= 256) {
integer2 = 255;
}
for (int integer3 = integer1; integer3 <= integer2; integer3 += 16) {
if (!LevelChunkSection.isEmpty(this.getSections()[integer3 >> 4])) {
return false;
}
}
return true;
}
2020-07-22 06:25:47 +01:00
@Nullable
ChunkBiomeContainer getBiomes();
2020-07-22 06:23:34 +01:00
void setUnsaved(final boolean boolean1);
boolean isUnsaved();
ChunkStatus getStatus();
2020-07-22 06:25:47 +01:00
void removeBlockEntity(final BlockPos fk);
2020-07-22 06:23:34 +01:00
2020-07-22 06:25:47 +01:00
default void markPosForPostprocessing(final BlockPos fk) {
LogManager.getLogger().warn("Trying to mark a block for PostProcessing @ {}, but this operation is not supported.", fk);
2020-07-22 06:23:34 +01:00
}
ShortList[] getPostProcessing();
default void addPackedPostProcess(final short short1, final int integer) {
getOrCreateOffsetList(this.getPostProcessing(), integer).add(short1);
}
2020-07-22 06:25:47 +01:00
default void setBlockEntityNbt(final CompoundTag jt) {
2020-07-22 06:23:34 +01:00
LogManager.getLogger().warn("Trying to set a BlockEntity, but this operation is not supported.");
}
@Nullable
2020-07-22 06:25:47 +01:00
CompoundTag getBlockEntityNbt(final BlockPos fk);
2020-07-22 06:23:34 +01:00
@Nullable
2020-07-22 06:25:47 +01:00
CompoundTag getBlockEntityNbtForSaving(final BlockPos fk);
2020-07-22 06:23:34 +01:00
Stream<BlockPos> getLights();
TickList<Block> getBlockTicks();
TickList<Fluid> getLiquidTicks();
default BitSet getCarvingMask(final GenerationStep.Carving a) {
2020-07-22 06:25:47 +01:00
throw Util.<RuntimeException>pauseInIde(new RuntimeException("Meaningless in this context"));
2020-07-22 06:23:34 +01:00
}
UpgradeData getUpgradeData();
void setInhabitedTime(final long long1);
long getInhabitedTime();
default ShortList getOrCreateOffsetList(final ShortList[] arr, final int integer) {
if (arr[integer] == null) {
arr[integer] = (ShortList)new ShortArrayList();
}
return arr[integer];
}
boolean isLightCorrect();
void setLightCorrect(final boolean boolean1);
}