Class RegionFile
java.lang.Object
net.minecraft.world.level.chunk.storage.RegionFile
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Modifier and TypeClassDescription(package private) class
(package private) static interface
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
private static final int
private static final int
private static final String
private static final int
private final Path
private final FileChannel
private final ByteBuffer
private static final int
private static final org.slf4j.Logger
private final IntBuffer
private static final ByteBuffer
private static final int
protected static final int
private final IntBuffer
protected final RegionBitmap
(package private) final RegionFileVersion
-
Constructor Summary
ConstructorDescriptionRegionFile
(Path p_196950_, Path p_196951_, boolean p_196952_) RegionFile
(Path p_63633_, Path p_63634_, RegionFileVersion p_63635_, boolean p_63636_) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
close()
private DataInputStream
createChunkInputStream
(ChunkPos p_63651_, byte p_63652_, InputStream p_63653_) private DataInputStream
createExternalChunkInputStream
(ChunkPos p_63648_, byte p_63649_) private ByteBuffer
private static ByteArrayInputStream
createStream
(ByteBuffer p_63660_, int p_63661_) boolean
doesChunkExist
(ChunkPos p_63674_) void
flush()
getChunkDataInputStream
(ChunkPos p_63646_) getChunkDataOutputStream
(ChunkPos p_63679_) private Path
getExternalChunkPath
(ChunkPos p_63685_) private static byte
getExternalChunkVersion
(byte p_63670_) private static int
getNumSectors
(int p_63641_) private int
private static int
getOffsetIndex
(ChunkPos p_63689_) private static int
getSectorNumber
(int p_63672_) private static int
boolean
private static boolean
isExternalStreamChunk
(byte p_63639_) private int
packSectorOffset
(int p_63643_, int p_63644_) private void
private static int
sizeToSectors
(int p_63677_) protected void
write
(ChunkPos p_63655_, ByteBuffer p_63656_) private void
private RegionFile.CommitOp
writeToExternalFile
(Path p_63663_, ByteBuffer p_63664_)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
SECTOR_BYTES
private static final int SECTOR_BYTES- See Also:
-
SECTOR_INTS
protected static final int SECTOR_INTS- See Also:
-
CHUNK_HEADER_SIZE
private static final int CHUNK_HEADER_SIZE- See Also:
-
HEADER_OFFSET
private static final int HEADER_OFFSET- See Also:
-
PADDING_BUFFER
-
EXTERNAL_FILE_EXTENSION
- See Also:
-
EXTERNAL_STREAM_FLAG
private static final int EXTERNAL_STREAM_FLAG- See Also:
-
EXTERNAL_CHUNK_THRESHOLD
private static final int EXTERNAL_CHUNK_THRESHOLD- See Also:
-
CHUNK_NOT_PRESENT
private static final int CHUNK_NOT_PRESENT- See Also:
-
file
-
externalFileDir
-
version
-
header
-
offsets
-
timestamps
-
usedSectors
-
-
Constructor Details
-
RegionFile
- Throws:
IOException
-
RegionFile
public RegionFile(Path p_63633_, Path p_63634_, RegionFileVersion p_63635_, boolean p_63636_) throws IOException - Throws:
IOException
-
-
Method Details
-
getExternalChunkPath
-
getChunkDataInputStream
- Throws:
IOException
-
getTimestamp
private static int getTimestamp() -
isExternalStreamChunk
private static boolean isExternalStreamChunk(byte p_63639_) -
getExternalChunkVersion
private static byte getExternalChunkVersion(byte p_63670_) -
createChunkInputStream
@Nullable private DataInputStream createChunkInputStream(ChunkPos p_63651_, byte p_63652_, InputStream p_63653_) throws IOException - Throws:
IOException
-
createExternalChunkInputStream
@Nullable private DataInputStream createExternalChunkInputStream(ChunkPos p_63648_, byte p_63649_) throws IOException - Throws:
IOException
-
createStream
-
packSectorOffset
private int packSectorOffset(int p_63643_, int p_63644_) -
getNumSectors
private static int getNumSectors(int p_63641_) -
getSectorNumber
private static int getSectorNumber(int p_63672_) -
sizeToSectors
private static int sizeToSectors(int p_63677_) -
doesChunkExist
-
getChunkDataOutputStream
- Throws:
IOException
-
flush
- Throws:
IOException
-
clear
- Throws:
IOException
-
write
- Throws:
IOException
-
createExternalStub
-
writeToExternalFile
private RegionFile.CommitOp writeToExternalFile(Path p_63663_, ByteBuffer p_63664_) throws IOException - Throws:
IOException
-
writeHeader
- Throws:
IOException
-
getOffset
-
hasChunk
-
getOffsetIndex
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
-
padToFullSector
- Throws:
IOException
-