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 int
private static int
private static int
private static String
private static int
private Path
private FileChannel
private ByteBuffer
private static int
private static org.apache.logging.log4j.Logger
private IntBuffer
private static ByteBuffer
private static int
protected static int
private IntBuffer
protected RegionBitmap
(package private) RegionFileVersion
-
Constructor Summary
ConstructorDescriptionRegionFile(File p_63629_, File p_63630_, boolean p_63631_)
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.apache.logging.log4j.Logger LOGGER -
SECTOR_BYTES
private static final int SECTOR_BYTES- See Also:
- Constant Field Values
-
SECTOR_INTS
protected static final int SECTOR_INTS- See Also:
- Constant Field Values
-
CHUNK_HEADER_SIZE
private static final int CHUNK_HEADER_SIZE- See Also:
- Constant Field Values
-
HEADER_OFFSET
private static final int HEADER_OFFSET- See Also:
- Constant Field Values
-
PADDING_BUFFER
-
EXTERNAL_FILE_EXTENSION
- See Also:
- Constant Field Values
-
EXTERNAL_STREAM_FLAG
private static final int EXTERNAL_STREAM_FLAG- See Also:
- Constant Field Values
-
EXTERNAL_CHUNK_THRESHOLD
private static final int EXTERNAL_CHUNK_THRESHOLD- See Also:
- Constant Field Values
-
CHUNK_NOT_PRESENT
private static final int CHUNK_NOT_PRESENT- See Also:
- Constant Field Values
-
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
-