From aff677a995c73b292446a55529d3dbdf0b83f5ef Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Wed, 25 Mar 2026 16:08:00 -0500 Subject: [PATCH] chore: fmt --- Minecraft.Client/Rendering/Chunk.cpp | 8 ++----- Minecraft.Client/Rendering/Tesselator.cpp | 24 ++++++++++----------- Minecraft.World/Blocks/PistonBaseTile.cpp | 8 ++----- Minecraft.World/Blocks/TheEndPortalTile.cpp | 8 ++----- Minecraft.World/Blocks/Tile.cpp | 14 +++++------- Minecraft.World/Blocks/TopSnowTile.cpp | 3 +-- Minecraft.World/Blocks/TripWireTile.cpp | 3 +-- Minecraft.World/Level/Level.cpp | 16 +++++--------- Minecraft.World/Level/Level.h | 4 ++-- Minecraft.World/Recipes/FireworksRecipe.cpp | 4 ++-- Minecraft.World/Recipes/FireworksRecipe.h | 10 ++------- 11 files changed, 36 insertions(+), 66 deletions(-) diff --git a/Minecraft.Client/Rendering/Chunk.cpp b/Minecraft.Client/Rendering/Chunk.cpp index f3074f407..fa311aed4 100644 --- a/Minecraft.Client/Rendering/Chunk.cpp +++ b/Minecraft.Client/Rendering/Chunk.cpp @@ -26,13 +26,9 @@ void Chunk::CreateNewThreadStorage() { m_tlsTileIds = new unsigned char[16 * 16 * Level::maxBuildHeight]; } -void Chunk::ReleaseThreadStorage() { - delete m_tlsTileIds; -} +void Chunk::ReleaseThreadStorage() { delete m_tlsTileIds; } -uint8_t* Chunk::GetTileIdsStorage() { - return m_tlsTileIds; -} +uint8_t* Chunk::GetTileIdsStorage() { return m_tlsTileIds; } #else // 4J Stu - Don't want this when multi-threaded Tesselator* Chunk::t = Tesselator::getInstance(); diff --git a/Minecraft.Client/Rendering/Tesselator.cpp b/Minecraft.Client/Rendering/Tesselator.cpp index 6135d75dc..a08a9f9b9 100644 --- a/Minecraft.Client/Rendering/Tesselator.cpp +++ b/Minecraft.Client/Rendering/Tesselator.cpp @@ -26,9 +26,7 @@ int normal; */ thread_local Tesselator* Tesselator::m_tlsInstance = nullptr; -Tesselator* Tesselator::getInstance() { - return m_tlsInstance; -} +Tesselator* Tesselator::getInstance() { return m_tlsInstance; } void Tesselator::CreateNewThreadStorage(int bytes) { Tesselator::m_tlsInstance = new Tesselator(bytes / 4); @@ -349,7 +347,7 @@ void Tesselator::vertexUV(float x, float y, float z, float u, float v) { // where: cccc is a 15-bit (5 bits per x/y/z) origin position / offset // for the whole quad. Each // component is unsigned, and offset by 16 -//so has a range 0 to 31 actually representing -16 to 15 +// so has a range 0 to 31 actually representing -16 to 15 // xx,yy,zz are 8-bit deltas from this origin to each vertex. These are // unsigned 1.7 fixed point, ie // representing a range of 0 to 1.9921875 @@ -358,14 +356,16 @@ void Tesselator::vertexUV(float x, float y, float z, float u, float v) { // v required by the quad ud,vd are 8-bit unsigned fixed pont // UV deltas, which can be added to umin/vmin to get umax, vmax // and therefore define the 4 corners of -//an axis aligned UV mapping +// an axis aligned UV mapping // i is a code per vertex that indicates which of umin/umax // should be used for u, and which // of vmin/vmax should be used for v for -//this vertex. The coding is: 0 - u = umin, v = vmin 1 - u = umin, v = vmax 2 - -//u = umax, v = vmin 3 - u = umax, v = vmax 4 - not axis aligned, use uv stored -//in the vertex data 4 on from this one ll is an 8-bit (4 bit per -//u/v) index into the current lighting texture +// this vertex. The coding is: 0 - u = +// umin, v = vmin 1 - u = umin, v +// = vmax 2 - u = umax, v = vmin +// 3 - u = umax, v = vmax 4 - not +// axis aligned, use uv stored in the vertex data 4 on from this one ll +// is an 8-bit (4 bit per u/v) index into the current lighting texture // // For quads that don't have axis aligned UVs (ie have a code for 4 in i as // described above) the 8 byte vertex is followed by a further 8 bytes which @@ -747,7 +747,8 @@ void packLinuxLightmapCoords(int tex2, std::int16_t& u, std::int16_t& v) { v = static_cast((tex2 >> 16) & 0xffff); // Linux 4jlibs consumes packed UV2 values by dividing them by 256 directly - // for chunk and other non-scaleLight draws, so offset to texel centers here. + // for chunk and other non-scaleLight draws, so offset to texel centers + // here. u += 8; v += 8; } @@ -853,8 +854,7 @@ void Tesselator::vertex(float x, float y, float z) { pShortData[4] = (((int)(uu * 8192.0f)) & 0xffff); pShortData[5] = (((int)(v * 8192.0f)) & 0xffff); std::int16_t u2 = static_cast(_tex2 & 0xffff); - std::int16_t v2 = - static_cast((_tex2 >> 16) & 0xffff); + std::int16_t v2 = static_cast((_tex2 >> 16) & 0xffff); #ifdef __linux__ packLinuxLightmapCoords(_tex2, u2, v2); logLinuxPackedLightmapCoords("compact", _tex2, u2, v2); diff --git a/Minecraft.World/Blocks/PistonBaseTile.cpp b/Minecraft.World/Blocks/PistonBaseTile.cpp index 489a4cbd2..de8c30b23 100644 --- a/Minecraft.World/Blocks/PistonBaseTile.cpp +++ b/Minecraft.World/Blocks/PistonBaseTile.cpp @@ -31,13 +31,9 @@ thread_local bool PistonBaseTile::m_tlsIgnoreUpdate = false; // leaving the piston in a bad (simultaneously extended & not extended) state. // 4J - ignoreUpdate is a static in java, implementing as TLS here to make // thread safe -bool PistonBaseTile::ignoreUpdate() { - return m_tlsIgnoreUpdate; -} +bool PistonBaseTile::ignoreUpdate() { return m_tlsIgnoreUpdate; } -void PistonBaseTile::ignoreUpdate(bool set) { - m_tlsIgnoreUpdate = set; -} +void PistonBaseTile::ignoreUpdate(bool set) { m_tlsIgnoreUpdate = set; } PistonBaseTile::PistonBaseTile(int id, bool isSticky) : Tile(id, Material::piston, false) { diff --git a/Minecraft.World/Blocks/TheEndPortalTile.cpp b/Minecraft.World/Blocks/TheEndPortalTile.cpp index 0bca60a44..89a41c0dc 100644 --- a/Minecraft.World/Blocks/TheEndPortalTile.cpp +++ b/Minecraft.World/Blocks/TheEndPortalTile.cpp @@ -13,13 +13,9 @@ thread_local bool TheEndPortal::m_tlsAllowAnywhere = false; // 4J - allowAnywhere is a static in java, implementing as TLS here to make // thread safe -bool TheEndPortal::allowAnywhere() { - return m_tlsAllowAnywhere; -} +bool TheEndPortal::allowAnywhere() { return m_tlsAllowAnywhere; } -void TheEndPortal::allowAnywhere(bool set) { - m_tlsAllowAnywhere = set; -} +void TheEndPortal::allowAnywhere(bool set) { m_tlsAllowAnywhere = set; } TheEndPortal::TheEndPortal(int id, Material* material) : BaseEntityTile(id, material, false) { diff --git a/Minecraft.World/Blocks/Tile.cpp b/Minecraft.World/Blocks/Tile.cpp index 9b1693afd..73dc4a523 100644 --- a/Minecraft.World/Blocks/Tile.cpp +++ b/Minecraft.World/Blocks/Tile.cpp @@ -229,13 +229,9 @@ Tile::ThreadStorage::ThreadStorage() { tileId = 0; } -void Tile::CreateNewThreadStorage() { - m_tlsShape = new ThreadStorage(); -} +void Tile::CreateNewThreadStorage() { m_tlsShape = new ThreadStorage(); } -void Tile::ReleaseThreadStorage() { - delete m_tlsShape; -} +void Tile::ReleaseThreadStorage() { delete m_tlsShape; } void Tile::staticCtor() { Tile::SOUND_NORMAL = new Tile::SoundType(eMaterialSoundType_STONE, 1, 1); @@ -1918,8 +1914,7 @@ bool Tile::isFaceVisible(Level* level, int x, int y, int z, int f) { } bool Tile::shouldRenderFace(LevelSource* level, int x, int y, int z, int face) { - ThreadStorage* tls = - m_tlsShape; + ThreadStorage* tls = m_tlsShape; // 4J Stu - Added this so that the TLS shape is correct for this tile if (tls->tileId != this->id) updateDefaultShape(); if (face == 0 && tls->yy0 > 0) return true; @@ -2595,7 +2590,8 @@ int Tile::SoundType::getPlaceSound() const { return iPlaceSound; } 4J: These are necessary on the PS3. (and 4 and Vita). */ -#if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined __linux__) +#if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || \ + defined __linux__) const int Tile::stone_Id; const int Tile::grass_Id; const int Tile::dirt_Id; diff --git a/Minecraft.World/Blocks/TopSnowTile.cpp b/Minecraft.World/Blocks/TopSnowTile.cpp index 64401de87..8ba44c61b 100644 --- a/Minecraft.World/Blocks/TopSnowTile.cpp +++ b/Minecraft.World/Blocks/TopSnowTile.cpp @@ -11,8 +11,7 @@ const int TopSnowTile::MAX_HEIGHT = 6; const int TopSnowTile::HEIGHT_MASK = 7; // max 8 steps -TopSnowTile::TopSnowTile(int id) - : Tile(id, Material::topSnow, false) { +TopSnowTile::TopSnowTile(int id) : Tile(id, Material::topSnow, false) { setShape(0, 0, 0, 1, 2 / 16.0f, 1); setTicking(true); updateShape(0); diff --git a/Minecraft.World/Blocks/TripWireTile.cpp b/Minecraft.World/Blocks/TripWireTile.cpp index 217116c81..0118aa0a1 100644 --- a/Minecraft.World/Blocks/TripWireTile.cpp +++ b/Minecraft.World/Blocks/TripWireTile.cpp @@ -5,8 +5,7 @@ #include "../Headers/net.minecraft.world.phys.h" #include "TripWireTile.h" -TripWireTile::TripWireTile(int id) - : Tile(id, Material::decoration, false) { +TripWireTile::TripWireTile(int id) : Tile(id, Material::decoration, false) { setShape(0, 0, 0, 1, 2.5f / 16.0f, 1); this->setTicking(true); } diff --git a/Minecraft.World/Level/Level.cpp b/Minecraft.World/Level/Level.cpp index a87eee1af..bf7c95ad7 100644 --- a/Minecraft.World/Level/Level.cpp +++ b/Minecraft.World/Level/Level.cpp @@ -102,9 +102,7 @@ void Level::enableLightingCache() { 256 * 1024, MAXULONG_PTR, 128 * 1024, PAGE_READWRITE | MEM_LARGE_PAGES); } -void Level::destroyLightingCache() { - delete m_tlsLightCache; -} +void Level::destroyLightingCache() { delete m_tlsLightCache; } inline int GetIndex(int x, int y, int z) { return ((x & 15) << 8) | ((y & 15) << 4) | (z & 15); @@ -491,13 +489,9 @@ void Level::flushCache(lightCache_t* cache, uint64_t cacheUse, // 4J - added following 2 functions to move instaBuild flag from being a class // member, to TLS -bool Level::getInstaTick() { - return m_tlsInstaTick; -} +bool Level::getInstaTick() { return m_tlsInstaTick; } -void Level::setInstaTick(bool enable) { - m_tlsInstaTick = enable; -} +void Level::setInstaTick(bool enable) { m_tlsInstaTick = enable; } // 4J - added bool Level::hasEntitiesToRemove() { return !entitiesToRemove.empty(); } @@ -1569,8 +1563,8 @@ void Level::playStreamingMusic(const std::wstring& name, int x, int y, int z) { } } -void Level::playMusic(double x, double y, double z, - const std::wstring& string, float volume) {} +void Level::playMusic(double x, double y, double z, const std::wstring& string, + float volume) {} // 4J removed - /* diff --git a/Minecraft.World/Level/Level.h b/Minecraft.World/Level/Level.h index 03370e96c..840e3ae1d 100644 --- a/Minecraft.World/Level/Level.h +++ b/Minecraft.World/Level/Level.h @@ -332,8 +332,8 @@ public: float fClipSoundDist = 16.0f); void playStreamingMusic(const std::wstring& name, int x, int y, int z); - void playMusic(double x, double y, double z, - const std::wstring& string, float volume); + void playMusic(double x, double y, double z, const std::wstring& string, + float volume); // 4J removed - void addParticle(const std::wstring& id, double x, double y, // double z, double xd, double yd, double zd); void addParticle(ePARTICLE_TYPE id, double x, double y, double z, double xd, diff --git a/Minecraft.World/Recipes/FireworksRecipe.cpp b/Minecraft.World/Recipes/FireworksRecipe.cpp index e14c08c33..7039e6b25 100644 --- a/Minecraft.World/Recipes/FireworksRecipe.cpp +++ b/Minecraft.World/Recipes/FireworksRecipe.cpp @@ -11,11 +11,11 @@ FireworksRecipe::ThreadStorage::ThreadStorage() { resultItem = nullptr; } void FireworksRecipe::CreateNewThreadStorage() { ThreadStorage* tls = new ThreadStorage(); - + if (m_defaultThreadStorage == nullptr) { m_defaultThreadStorage = tls; } - + m_tlsStorage = tls; } diff --git a/Minecraft.World/Recipes/FireworksRecipe.h b/Minecraft.World/Recipes/FireworksRecipe.h index bb52b6842..ecc61ddcc 100644 --- a/Minecraft.World/Recipes/FireworksRecipe.h +++ b/Minecraft.World/Recipes/FireworksRecipe.h @@ -38,14 +38,8 @@ public: virtual const int getGroup() { return 0; } // 4J-PB - virtual bool - requiresRecipe(int iRecipe) - { - return false; - }; - virtual void - collectRequirements(INGREDIENTS_REQUIRED* pIngReq) - {}; + virtual bool requiresRecipe(int iRecipe) { return false; }; + virtual void collectRequirements(INGREDIENTS_REQUIRED* pIngReq) {}; // 4J Added static void updatePossibleRecipes(