refactor: consistent include paths in java/nbt

This commit is contained in:
Tropical 2026-03-30 15:47:05 -05:00
parent 44f6982e96
commit 0817878fe1
23 changed files with 53 additions and 52 deletions

View file

@ -1,4 +1,4 @@
#include "Buffer.h" #include "java/Buffer.h"
Buffer::Buffer(unsigned int capacity) Buffer::Buffer(unsigned int capacity)
: m_capacity(capacity), : m_capacity(capacity),

View file

@ -1,7 +1,7 @@
#include "IntBuffer.h" #include "java/IntBuffer.h"
#include "FloatBuffer.h" #include "java/FloatBuffer.h"
#include "ByteBuffer.h" #include "java/ByteBuffer.h"
ByteBuffer::ByteBuffer(unsigned int capacity) : Buffer(capacity) { ByteBuffer::ByteBuffer(unsigned int capacity) : Buffer(capacity) {
hasBackingArray = false; hasBackingArray = false;

View file

@ -1,4 +1,4 @@
#include "Class.h" #include "java/Class.h"
// 4J Stu - To ensure that other classes can get the _class object of it's // 4J Stu - To ensure that other classes can get the _class object of it's
// superclass, we also need the BaseObject to have that member // superclass, we also need the BaseObject to have that member

View file

@ -1,7 +1,7 @@
#include <cassert> #include <cassert>
#include <cmath> #include <cmath>
#include "Color.h" #include "java/Color.h"
// Creates an opaque sRGB color with the specified red, green, and blue values // Creates an opaque sRGB color with the specified red, green, and blue values
// in the range (0.0 - 1.0). Alpha is defaulted to 1.0. The actual color used in // in the range (0.0 - 1.0). Alpha is defaulted to 1.0. The actual color used in

View file

@ -1,12 +1,12 @@
#include "FileFilter.h" #include <chrono>
#include "File.h" #include <filesystem>
#include "java/FileFilter.h"
#include "java/File.h"
#include "../../../Minecraft.World/ConsoleHelpers/PathHelper.h" // 4jcraft TODO #include "../../../Minecraft.World/ConsoleHelpers/PathHelper.h" // 4jcraft TODO
#include "../../../Minecraft.World/ConsoleHelpers/StringHelpers.h" // 4jcraft TODO #include "../../../Minecraft.World/ConsoleHelpers/StringHelpers.h" // 4jcraft TODO
#include <chrono>
#include <filesystem>
const wchar_t File::pathSeparator = L'/'; const wchar_t File::pathSeparator = L'/';
const std::wstring File::pathRoot = const std::wstring File::pathRoot =

View file

@ -1,4 +1,4 @@
#include "FloatBuffer.h" #include "java/FloatBuffer.h"
// Allocates a new float buffer. // Allocates a new float buffer.
// The new buffer's position will be zero, its limit will be its capacity, and // The new buffer's position will be zero, its limit will be its capacity, and

View file

@ -1,4 +1,4 @@
#include "InputOutputStream/BufferedOutputStream.h" #include "java/InputOutputStream/BufferedOutputStream.h"
// Creates a new buffered output stream to write data to the specified // Creates a new buffered output stream to write data to the specified
// underlying output stream with the specified buffer size. Parameters: out - // underlying output stream with the specified buffer size. Parameters: out -

View file

@ -1,4 +1,4 @@
#include "InputOutputStream/BufferedReader.h" #include "java/InputOutputStream/BufferedReader.h"
// Creates a buffering character-input stream that uses a default-sized input // Creates a buffering character-input stream that uses a default-sized input
// buffer. Parameters: in - A Reader // buffer. Parameters: in - A Reader

View file

@ -1,4 +1,4 @@
#include "InputOutputStream/InputOutputStream.h" #include "java/InputOutputStream/InputOutputStream.h"
// Creates ByteArrayInputStream that uses buf as its buffer array. The initial // Creates ByteArrayInputStream that uses buf as its buffer array. The initial
// value of pos is offset and the initial value of count is the minimum of // value of pos is offset and the initial value of count is the minimum of

View file

@ -1,4 +1,4 @@
#include "InputOutputStream/ByteArrayOutputStream.h" #include "java/InputOutputStream/ByteArrayOutputStream.h"
// Creates a new byte array output stream. The buffer capacity is initially 32 // Creates a new byte array output stream. The buffer capacity is initially 32
// bytes, though its size increases if necessary. // bytes, though its size increases if necessary.

View file

@ -1,7 +1,8 @@
#include "InputOutputStream/DataInputStream.h"
#include <bit> #include <bit>
#include <cstdint> #include <cstdint>
#include "java/InputOutputStream/DataInputStream.h"
// Creates a DataInputStream that uses the specified underlying InputStream. // Creates a DataInputStream that uses the specified underlying InputStream.
// Parameters: // Parameters:
// in - the specified input stream // in - the specified input stream

View file

@ -1,8 +1,8 @@
#include "InputOutputStream/DataOutputStream.h"
#include <bit> #include <bit>
#include <cstdint> #include <cstdint>
#include "java/InputOutputStream/DataOutputStream.h"
// Creates a new data output stream to write data to the specified underlying // Creates a new data output stream to write data to the specified underlying
// output stream. The counter written is set to zero. Parameters: out - the // output stream. The counter written is set to zero. Parameters: out - the
// underlying output stream, to be saved for later use. // underlying output stream, to be saved for later use.

View file

@ -1,6 +1,6 @@
#include "File.h" #include "java/File.h"
#include "InputOutputStream/FileInputStream.h" #include "java/InputOutputStream/FileInputStream.h"
#include <algorithm> #include <algorithm>
#include "../../../Minecraft.World/ConsoleHelpers/StringHelpers.h" #include "../../../Minecraft.World/ConsoleHelpers/StringHelpers.h"

View file

@ -1,8 +1,8 @@
#include "File.h"
#include "InputOutputStream/FileOutputStream.h"
#include "../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO #include "../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
#include "java/File.h"
#include "java/InputOutputStream/FileOutputStream.h"
// Creates a file output stream to write to the file represented by the // Creates a file output stream to write to the file represented by the
// specified File object. A new FileDescriptor object is created to represent // specified File object. A new FileDescriptor object is created to represent
// this file connection. First, if there is a security manager, its checkWrite // this file connection. First, if there is a security manager, its checkWrite

View file

@ -1,6 +1,6 @@
#include "File.h" #include "java/File.h"
#include "InputOutputStream/InputOutputStream.h" #include "java/InputOutputStream/InputOutputStream.h"
#include "InputOutputStream/InputStream.h" #include "java/InputOutputStream/InputStream.h"
InputStream* InputStream::getResourceAsStream(const std::wstring& fileName) { InputStream* InputStream::getResourceAsStream(const std::wstring& fileName) {
File file(fileName); File file(fileName);

View file

@ -1,7 +1,6 @@
#include "java/InputOutputStream/InputStream.h"
#include "InputOutputStream/InputStream.h" #include "java/InputOutputStream/DataInputStream.h"
#include "InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/InputStreamReader.h"
#include "InputOutputStream/InputStreamReader.h"
// Creates an InputStreamReader that uses the default charset. // Creates an InputStreamReader that uses the default charset.
// Parameters: // Parameters:

View file

@ -1,5 +1,4 @@
#include "java/IntBuffer.h"
#include "IntBuffer.h"
// Allocates a new int buffer. // Allocates a new int buffer.
// The new buffer's position will be zero, its limit will be its capacity, and // The new buffer's position will be zero, its limit will be its capacity, and

View file

@ -1,4 +1,4 @@
#include "JavaMath.h" #include "java/JavaMath.h"
#include <cmath> #include <cmath>

View file

@ -1,7 +1,8 @@
#include "Random.h"
#include <ctime> #include <ctime>
#include <cstdint> // for int64_t #include <cstdint> // for int64_t
#include "System.h"
#include "java/System.h"
#include "java/Random.h"
Random::Random() { Random::Random() {
// 4J - jave now uses the system nanosecond counter added to a // 4J - jave now uses the system nanosecond counter added to a

View file

@ -1,10 +1,11 @@
#include "System.h"
#if defined(__linux__) #if defined(__linux__)
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>
#include <ctime> #include <ctime>
#endif #endif
#include "java/System.h"
template <class T> template <class T>
void System::arraycopy(arrayWithLength<T> src, unsigned int srcPos, void System::arraycopy(arrayWithLength<T> src, unsigned int srcPos,
arrayWithLength<T>* dst, unsigned int dstPos, arrayWithLength<T>* dst, unsigned int dstPos,

View file

@ -6,7 +6,7 @@ nbt_sources = files(
lib_nbt = static_library('nbt', lib_nbt = static_library('nbt',
nbt_sources, nbt_sources,
dependencies: [java_dep], dependencies: [java_dep],
include_directories : include_directories('include/nbt'), include_directories : include_directories('include'),
cpp_args : global_cpp_args + global_cpp_defs, cpp_args : global_cpp_args + global_cpp_defs,
) )

View file

@ -1,5 +1,5 @@
#include "java/InputOutputStream/InputOutputStream.h" #include "java/InputOutputStream/InputOutputStream.h"
#include "NbtIo.h" #include "nbt/NbtIo.h"
CompoundTag* NbtIo::readCompressed(InputStream* in) { CompoundTag* NbtIo::readCompressed(InputStream* in) {
// MemSect(26); // MemSect(26);

View file

@ -1,18 +1,18 @@
#include "Tag.h"
#include "EndTag.h"
#include "ByteTag.h"
#include "ByteArrayTag.h"
#include "DoubleTag.h"
#include "FloatTag.h"
#include "IntTag.h"
#include "LongTag.h"
#include "ShortTag.h"
#include "StringTag.h"
#include "ListTag.h"
#include "CompoundTag.h"
#include <cstdio> #include <cstdio>
#include "nbt/Tag.h"
#include "nbt/EndTag.h"
#include "nbt/ByteTag.h"
#include "nbt/ByteArrayTag.h"
#include "nbt/DoubleTag.h"
#include "nbt/FloatTag.h"
#include "nbt/IntTag.h"
#include "nbt/LongTag.h"
#include "nbt/ShortTag.h"
#include "nbt/StringTag.h"
#include "nbt/ListTag.h"
#include "nbt/CompoundTag.h"
Tag::Tag(const std::wstring& name) { Tag::Tag(const std::wstring& name) {
if (name.empty()) { if (name.empty()) {
this->name = L""; this->name = L"";