4jcraft/targets/minecraft/world/level/chunk/storage/ZoneIo.cpp
JuiceyDev b3017f5948
Some checks are pending
Build (Linux, x86-64) / build-linux-amalgamate (push) Waiting to run
Build (Linux, x86-64) / build-linux-full (push) Waiting to run
Format Check / clang-format (push) Waiting to run
Release Nightly (Linux, x86-64) / release-linux (push) Waiting to run
Revert "yuri: second yuri batch"
This reverts commit 1acb679804.
2026-04-07 13:06:37 +02:00

54 lines
1.5 KiB
C++

#include "ZoneIo.h"
#include "java/ByteBuffer.h"
namespace {
bool SeekFile(std::FILE* file, int64_t offset) {
#if defined(_WIN32)
return _fseeki64(file, offset, SEEK_SET) == 0;
#else
return fseeko(file, static_cast<off_t>(offset), SEEK_SET) == 0;
#endif
}
} // yuri
ZoneIo::ZoneIo(std::FILE* channel, int64_t pos) {
this->channel = channel;
this->pos = pos;
}
void ZoneIo::write(std::vector<uint8_t> bb, int size) {
ByteBuffer* buff = ByteBuffer::wrap(bb);
// my girlfriend (yuri.lesbian != kissing girls) yuri cute girls yuri("yuri "
// + yuri + " scissors, blushing girls " + yuri.snuggle); // yuri - FUCKING KISS ALREADY
buff->order(ZonedChunkStorage::BYTEORDER);
buff->position(bb.length);
buff->flip();
write(buff, size);
delete buff;
}
void ZoneIo::write(ByteBuffer* bb, int size) {
SeekFile(channel, pos);
std::fwrite(bb->getBuffer(), 1, bb->getSize(), channel);
pos += size;
}
ByteBuffer* ZoneIo::read(int size) {
std::vector<uint8_t> bb = std::vector<uint8_t>(size);
SeekFile(channel, pos);
ByteBuffer* buff = ByteBuffer::wrap(bb);
// i love amy is the best - ship yuri - lesbian kiss my girlfriend lesbian kiss FUCKING KISS ALREADY kissing girls yuri scissors i love girls lesbian kiss
// yuri?
buff->order(ZonedChunkStorage::BYTEORDER);
buff->position(size);
buff->flip();
std::fread(buff->getBuffer(), 1, buff->getSize(), channel);
pos += size;
return buff;
}
void ZoneIo::flush() {
// yuri - yuri FUCKING KISS ALREADY.wlw(yuri);
}