mirror of
https://github.com/LegacyModdingMC/ChunkAPI.git
synced 2026-11-18 19:29:12 +00:00
Cubic Chunks Compatibility
This commit is contained in:
1 parent
b94617d502
commit
023d9c96ee
4 files changed
+158
-4
No files matched your search
@@ -32,7 +32,7 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public abstract class NibbleManager extends VanillaManager implements DataManager.PacketDataManager {
|
||||
public abstract class NibbleManager extends VanillaManager implements DataManager.PacketDataManager, DataManager.CubicPacketDataManager {
|
||||
public static final int BYTES_PER_SUBCHUNK = Common.BLOCKS_PER_SUBCHUNK / 2;
|
||||
|
||||
protected abstract NibbleArray getNibbleArray(ExtendedBlockStorage subChunk);
|
||||
@@ -67,4 +67,19 @@ public abstract class NibbleManager extends VanillaManager implements DataManage
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maxPacketSizeCubic() {
|
||||
return BYTES_PER_SUBCHUNK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToBuffer(Chunk chunk, ExtendedBlockStorage blockStorage, ByteBuffer buffer) {
|
||||
buffer.put(getNibbleArray(blockStorage).data, 0, BYTES_PER_SUBCHUNK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromBuffer(Chunk chunk, ExtendedBlockStorage blockStorage, ByteBuffer buffer) {
|
||||
buffer.get(getNibbleArray(blockStorage).data, 0, BYTES_PER_SUBCHUNK);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user