From 9dd73aaa0df1cafa458f7aac2956bf549a08c13e Mon Sep 17 00:00:00 2001 From: JuiceyDev Date: Fri, 6 Mar 2026 07:31:16 +0100 Subject: [PATCH] udjfjdkd --- .github/workflows/build-linux.yml | 2 +- Minecraft.Client/Textures/TextureHolder.h | 4 +-- .../IO/Files/ConsoleSaveFileSplit.cpp | 2 +- Minecraft.World/IO/Files/File.h | 12 ++++---- Minecraft.World/IO/Files/FileInputStream.cpp | 6 ++-- Minecraft.World/IO/Files/FileOutputStream.cpp | 12 ++++---- Minecraft.World/Level/ChunkPos.h | 9 +++--- Minecraft.World/Level/TickNextTickData.h | 14 ++++----- Minecraft.World/Level/TilePos.h | 9 +++--- Minecraft.World/Player/Player.h | 9 +++--- Minecraft.World/Util/JavaIntHash.h | 29 +++++++++---------- 11 files changed, 50 insertions(+), 58 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index b58d8d4da..abda7c9f0 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -17,7 +17,7 @@ jobs: - name: Install system dependencies run: | sudo apt-get update - sudo apt-get install -y build-essential python3 python3-pip python3-setuptools libgl1-mesa-dev libglu1-mesa-dev libglfw3-dev libpng-dev pkg-config clang ccache + sudo apt-get install -y build-essential python3 python3-pip python3-setuptools libgl1-mesa-dev libglu1-mesa-dev libglfw3-dev libpng-dev pkg-config clang lld ccache libssl-dev # Set a reasonable ccache size ccache -M 5G || true diff --git a/Minecraft.Client/Textures/TextureHolder.h b/Minecraft.Client/Textures/TextureHolder.h index 304d03e75..57fd2ca2e 100644 --- a/Minecraft.Client/Textures/TextureHolder.h +++ b/Minecraft.Client/Textures/TextureHolder.h @@ -30,7 +30,7 @@ public: int compareTo(const TextureHolder *other) const; }; -typedef struct +struct TextureHolderLessThan { bool operator() (const TextureHolder *first, const TextureHolder *second) const { return first->compareTo(second) >= 0; } -} TextureHolderLessThan; \ No newline at end of file +}; \ No newline at end of file diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 68942b20f..2bc246ab3 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -463,7 +463,7 @@ void ConsoleSaveFileSplit::_init(const wstring &fileName, LPVOID pvSaveData, DWO unsigned char *regionDataCompressed; unsigned int regionSizeCompressed; - StorageManager.GetSubfileDetails(i, ®ionIndex, ®ionDataCompressed, ®ionSizeCompressed); + StorageManager.GetSubfileDetails(i, (int*)®ionIndex, (void**)®ionDataCompressed, ®ionSizeCompressed); RegionFileReference *regionFileRef = new RegionFileReference(i, regionIndex, regionSizeCompressed, regionDataCompressed); if( regionSizeCompressed > 0 ) diff --git a/Minecraft.World/IO/Files/File.h b/Minecraft.World/IO/Files/File.h index 0b710cd46..adca156f2 100644 --- a/Minecraft.World/IO/Files/File.h +++ b/Minecraft.World/IO/Files/File.h @@ -43,14 +43,12 @@ private: //File(vector *path); }; -typedef struct +struct FileKeyHash { int operator() (const File &k) const { return File::hash_fnct(k); } +}; -} FileKeyHash; - -typedef struct +struct FileKeyEq { - bool operator() (const File &x, const File &y) const {return File::eq_test(x,y); } - -} FileKeyEq; \ No newline at end of file + bool operator() (const File &x, const File &y) const { return File::eq_test(x, y); } +}; \ No newline at end of file diff --git a/Minecraft.World/IO/Files/FileInputStream.cpp b/Minecraft.World/IO/Files/FileInputStream.cpp index 4be557bf1..59fc3b61a 100644 --- a/Minecraft.World/IO/Files/FileInputStream.cpp +++ b/Minecraft.World/IO/Files/FileInputStream.cpp @@ -34,7 +34,7 @@ FileInputStream::FileInputStream(const File &file) NULL // Unsupported ); #elif defined(__linux__) - m_fileHandle = open(pchFilename, O_RDONLY); + m_fileHandle = (HANDLE)(intptr_t)open(pchFilename, O_RDONLY); #else m_fileHandle = CreateFile( pchFilename, // file name @@ -61,7 +61,7 @@ FileInputStream::~FileInputStream() #ifndef __linux__ CloseHandle( m_fileHandle ); #else - ::close( m_fileHandle ); + ::close( (int)(intptr_t)m_fileHandle ); #endif } @@ -190,7 +190,7 @@ void FileInputStream::close() return; } - BOOL result = ::close( m_fileHandle ); + int result = ::close( (int)(intptr_t)m_fileHandle ); if( result == 0 ) { diff --git a/Minecraft.World/IO/Files/FileOutputStream.cpp b/Minecraft.World/IO/Files/FileOutputStream.cpp index 9eba5e649..bea46104c 100644 --- a/Minecraft.World/IO/Files/FileOutputStream.cpp +++ b/Minecraft.World/IO/Files/FileOutputStream.cpp @@ -42,7 +42,7 @@ FileOutputStream::FileOutputStream(const File &file) : m_fileHandle( INVALID_HAN char* convertedPath = new char[path.size() + 1]; std::wcstombs(convertedPath, path.c_str(), path.size() + 1); - m_fileHandle = open(convertedPath, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR); + m_fileHandle = (HANDLE)(intptr_t)open(convertedPath, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR); delete[] convertedPath; #else m_fileHandle = CreateFile( @@ -66,7 +66,7 @@ FileOutputStream::FileOutputStream(const File &file) : m_fileHandle( INVALID_HAN FileOutputStream::~FileOutputStream() { if( m_fileHandle != INVALID_HANDLE_VALUE ) - ::close( m_fileHandle ); + ::close( (int)(intptr_t)m_fileHandle ); } //Writes the specified byte to this file output stream. Implements the write method of OutputStream. @@ -85,7 +85,7 @@ void FileOutputStream::write(unsigned int b) NULL // overlapped buffer ); #else // LINUX - int fileDescriptor = reinterpret_cast(m_fileHandle); + int fileDescriptor = (int)(intptr_t)(m_fileHandle); ssize_t numberOfBytesWritten = ::write(fileDescriptor, NULL, 1); int result = static_cast(numberOfBytesWritten); #endif // _WIN32 @@ -114,7 +114,7 @@ void FileOutputStream::write(byteArray b) NULL // overlapped buffer ); #else // Linux - int fileDescriptor = reinterpret_cast(m_fileHandle); + int fileDescriptor = (int)(intptr_t)(m_fileHandle); ssize_t numberOfBytesWritten = ::write(fileDescriptor, NULL, 1); int result = static_cast(numberOfBytesWritten); #endif // _WIN32 @@ -150,7 +150,7 @@ void FileOutputStream::write(byteArray b, unsigned int offset, unsigned int leng NULL // overlapped buffer ); #else - int fileDescriptor = reinterpret_cast(m_fileHandle); + int fileDescriptor = (int)(intptr_t)(m_fileHandle); ssize_t numberOfBytesWritten = ::write(fileDescriptor, static_cast(&b[offset]), length); int result = static_cast(numberOfBytesWritten); #endif // _WIN32 @@ -173,7 +173,7 @@ void FileOutputStream::close() #ifdef _WIN32 BOOL result = CloseHandle( m_fileHandle ); #else // __linux__ - int result = ::close( m_fileHandle ); + int result = ::close( (int)(intptr_t)m_fileHandle ); #endif // _WIN32 if( result == 0 ) { diff --git a/Minecraft.World/Level/ChunkPos.h b/Minecraft.World/Level/ChunkPos.h index f1d483c7e..119ee86cc 100644 --- a/Minecraft.World/Level/ChunkPos.h +++ b/Minecraft.World/Level/ChunkPos.h @@ -28,13 +28,12 @@ public: ChunkPos & operator= (const ChunkPos & other) { x = other.x; z = other.z; return *this; } }; -typedef struct +struct ChunkPosKeyHash { __int64 operator() (const ChunkPos &k) const { return ChunkPos::hash_fnct(k); } +}; -} ChunkPosKeyHash; - -typedef struct +struct ChunkPosKeyEq { bool operator() (const ChunkPos &x, const ChunkPos &y) const { return ChunkPos::eq_test(x, y); } -} ChunkPosKeyEq; \ No newline at end of file +}; \ No newline at end of file diff --git a/Minecraft.World/Level/TickNextTickData.h b/Minecraft.World/Level/TickNextTickData.h index 41ee99da1..bb05844b3 100644 --- a/Minecraft.World/Level/TickNextTickData.h +++ b/Minecraft.World/Level/TickNextTickData.h @@ -28,19 +28,17 @@ public: static bool eq_test(const TickNextTickData &x, const TickNextTickData &y); }; -typedef struct +struct TickNextTickDataKeyHash { int operator() (const TickNextTickData &k) const { return TickNextTickData::hash_fnct (k); } +}; -} TickNextTickDataKeyHash; - -typedef struct +struct TickNextTickDataKeyEq { bool operator() (const TickNextTickData &x, const TickNextTickData &y) const { return TickNextTickData::eq_test (x, y); } -} TickNextTickDataKeyEq; +}; -typedef struct +struct TickNextTickDataKeyCompare { bool operator() (const TickNextTickData &x, const TickNextTickData &y) const { return TickNextTickData::compare_fnct (x, y); } - -} TickNextTickDataKeyCompare; \ No newline at end of file +}; \ No newline at end of file diff --git a/Minecraft.World/Level/TilePos.h b/Minecraft.World/Level/TilePos.h index d4a3e84eb..df23e5f9c 100644 --- a/Minecraft.World/Level/TilePos.h +++ b/Minecraft.World/Level/TilePos.h @@ -14,14 +14,13 @@ public: static bool eq_test(const TilePos &x, const TilePos &y); }; -typedef struct +struct TilePosKeyHash { int operator() (const TilePos &k) const { return TilePos::hash_fnct (k); } +}; -} TilePosKeyHash; - -typedef struct +struct TilePosKeyEq { bool operator() (const TilePos &x, const TilePos &y) const { return TilePos::eq_test (x, y); } -} TilePosKeyEq; +}; diff --git a/Minecraft.World/Player/Player.h b/Minecraft.World/Player/Player.h index c19d90ee6..f66c0c1aa 100644 --- a/Minecraft.World/Player/Player.h +++ b/Minecraft.World/Player/Player.h @@ -539,13 +539,12 @@ private: #endif }; -typedef struct +struct PlayerKeyHash { int operator() (const shared_ptr k) const { return Player::hash_fnct (k); } +}; -} PlayerKeyHash; - -typedef struct +struct PlayerKeyEq { bool operator() (const shared_ptr x, const shared_ptr y) const { return Player::eq_test (x, y); } -} PlayerKeyEq; +}; diff --git a/Minecraft.World/Util/JavaIntHash.h b/Minecraft.World/Util/JavaIntHash.h index 447b8052a..7a1ba7710 100644 --- a/Minecraft.World/Util/JavaIntHash.h +++ b/Minecraft.World/Util/JavaIntHash.h @@ -5,7 +5,7 @@ // would appear to be a bit expensive so matching the java one for now anyway. This code implements the supplemental // hashing that happens in java so we can match what their maps are doing with ints. -typedef struct +struct IntKeyHash { int operator() (const int &k) const { @@ -16,18 +16,17 @@ typedef struct h ^= (((unsigned int)h) >> 10); return h; } +}; -} IntKeyHash; - -typedef struct +struct IntKeyEq { bool operator() (const int &x, const int &y) const { return x==y; } -} IntKeyEq; +}; // This hash functor is taken from the IntHashMap java class used by the game, so that we can use a standard std hashmap with this hash rather // than implement the class itself -typedef struct +struct IntKeyHash2 { int operator() (const int &k) const { @@ -35,12 +34,12 @@ typedef struct h ^= (h >> 20) ^ (h >> 12); return (int)(h ^ (h >> 7) ^ (h >> 4)); } -} IntKeyHash2; +}; // This hash functor is taken from the LongHashMap java class used by the game, so that we can use a standard std hashmap with this hash rather // than implement the class itself -typedef struct +struct LongKeyHash { int hash(const int &k) const { @@ -53,14 +52,14 @@ typedef struct { return hash((int) ( k ^ (((__uint64)k) >> 32 ))); } -} LongKeyHash; +}; -typedef struct +struct LongKeyEq { bool operator() (const __int64 &x, const __int64 &y) const { return x==y; } -} LongKeyEq; +}; -typedef struct +struct eINSTANCEOFKeyHash { int operator() (const eINSTANCEOF &k) const { @@ -68,10 +67,10 @@ typedef struct h ^= (h >> 20) ^ (h >> 12); return (int)(h ^ (h >> 7) ^ (h >> 4)); } -} eINSTANCEOFKeyHash; +}; -typedef struct +struct eINSTANCEOFKeyEq { bool operator() (const eINSTANCEOF &x, const eINSTANCEOF &y) const { return x==y; } -} eINSTANCEOFKeyEq; +};