From 534879e2e74af790907190b0b05717bcb16c5111 Mon Sep 17 00:00:00 2001 From: orng Date: Fri, 27 Mar 2026 21:17:55 -0500 Subject: [PATCH] refactor: replace `AABB::newPermanent` with `new AABB` --- .../Common/GameRules/ApplySchematicRuleDefinition.cpp | 2 +- .../Platform/Common/GameRules/NamedAreaRuleDefinition.cpp | 2 +- Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.cpp | 4 ++-- Minecraft.Client/Platform/Common/Tutorial/AreaHint.cpp | 2 +- .../Platform/Common/Tutorial/ChangeStateConstraint.cpp | 2 +- Minecraft.Client/Rendering/Chunk.cpp | 2 +- Minecraft.Client/Rendering/LevelRenderer.cpp | 2 +- Minecraft.World/Entities/Entity.cpp | 2 +- Minecraft.World/Entities/Mobs/EnderDragon.cpp | 2 +- Minecraft.World/Util/AABB.cpp | 5 ----- Minecraft.World/Util/AABB.h | 2 -- 11 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp index dd91c027c..f2c5b4360 100644 --- a/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/ApplySchematicRuleDefinition.cpp @@ -130,7 +130,7 @@ void ApplySchematicRuleDefinition::updateLocationBox() { if (m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); - m_locationBox = AABB::newPermanent(0, 0, 0, 0, 0, 0); + m_locationBox = new AABB(0, 0, 0, 0, 0, 0); m_locationBox->x0 = m_location.x; m_locationBox->y0 = m_location.y; diff --git a/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.cpp b/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.cpp index b09982ae9..aefc12453 100644 --- a/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.cpp +++ b/Minecraft.Client/Platform/Common/GameRules/NamedAreaRuleDefinition.cpp @@ -5,7 +5,7 @@ NamedAreaRuleDefinition::NamedAreaRuleDefinition() { m_name = L""; - m_area = AABB::newPermanent(0, 0, 0, 0, 0, 0); + m_area = new AABB(0, 0, 0, 0, 0, 0); } NamedAreaRuleDefinition::~NamedAreaRuleDefinition() { delete m_area; } diff --git a/Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.cpp b/Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.cpp index 271275948..36c53aa47 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/AreaConstraint.cpp @@ -11,8 +11,8 @@ AreaConstraint::AreaConstraint(int descriptionId, double x0, double y0, bool restrictsMovement /*=true*/) : TutorialConstraint(descriptionId) { messageArea = - AABB::newPermanent(x0 + 2, y0 + 2, z0 + 2, x1 - 2, y1 - 2, z1 - 2); - movementArea = AABB::newPermanent(x0, y0, z0, x1, y1, z1); + new AABB(x0 + 2, y0 + 2, z0 + 2, x1 - 2, y1 - 2, z1 - 2); + movementArea = new AABB(x0, y0, z0, x1, y1, z1); this->contains = contains; m_restrictsMovement = restrictsMovement; diff --git a/Minecraft.Client/Platform/Common/Tutorial/AreaHint.cpp b/Minecraft.Client/Platform/Common/Tutorial/AreaHint.cpp index 1eb6c1017..b6bae48d3 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/AreaHint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/AreaHint.cpp @@ -12,7 +12,7 @@ AreaHint::AreaHint(eTutorial_Hint id, Tutorial* tutorial, double x1, double y1, double z1, bool allowFade /*= false*/, bool contains /*= true*/) : TutorialHint(id, tutorial, descriptionId, e_Hint_Area, allowFade) { - area = AABB::newPermanent(x0, y0, z0, x1, y1, z1); + area = new AABB(x0, y0, z0, x1, y1, z1); this->contains = contains; diff --git a/Minecraft.Client/Platform/Common/Tutorial/ChangeStateConstraint.cpp b/Minecraft.Client/Platform/Common/Tutorial/ChangeStateConstraint.cpp index 9efbd42c9..5934505e8 100644 --- a/Minecraft.Client/Platform/Common/Tutorial/ChangeStateConstraint.cpp +++ b/Minecraft.Client/Platform/Common/Tutorial/ChangeStateConstraint.cpp @@ -16,7 +16,7 @@ ChangeStateConstraint::ChangeStateConstraint( bool contains /*= true*/, bool changeGameMode /*= false*/, GameType* targetGameMode /*= 0*/) : TutorialConstraint(-1) { - movementArea = AABB::newPermanent(x0, y0, z0, x1, y1, z1); + movementArea = new AABB(x0, y0, z0, x1, y1, z1); this->contains = contains; diff --git a/Minecraft.Client/Rendering/Chunk.cpp b/Minecraft.Client/Rendering/Chunk.cpp index 03dc40b8f..95e060ed9 100644 --- a/Minecraft.Client/Rendering/Chunk.cpp +++ b/Minecraft.Client/Rendering/Chunk.cpp @@ -95,7 +95,7 @@ void Chunk::setPos(int x, int y, int z) { // 4J - changed to just set the value rather than make a new one, if we've // already created storage if (bb == NULL) { - bb = AABB::newPermanent(-g, -g, -g, XZSIZE + g, SIZE + g, XZSIZE + g); + bb = new AABB(-g, -g, -g, XZSIZE + g, SIZE + g, XZSIZE + g); } else { // 4J MGH - bounds are relative to the position now, so the AABB will be // setup already, either above, or from the tesselator bounds. diff --git a/Minecraft.Client/Rendering/LevelRenderer.cpp b/Minecraft.Client/Rendering/LevelRenderer.cpp index d412a7ede..84f11665f 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.cpp +++ b/Minecraft.Client/Rendering/LevelRenderer.cpp @@ -3901,7 +3901,7 @@ void LevelRenderer::DestroyedTileManager::destroyingTileAt(Level* level, int x, // Make these temporary AABBs into permanently allocated AABBs for (unsigned int i = 0; i < recentTile->boxes.size(); i++) { - recentTile->boxes[i] = AABB::newPermanent( + recentTile->boxes[i] = new AABB( recentTile->boxes[i]->x0, recentTile->boxes[i]->y0, recentTile->boxes[i]->z0, recentTile->boxes[i]->x1, recentTile->boxes[i]->y1, recentTile->boxes[i]->z1); diff --git a/Minecraft.World/Entities/Entity.cpp b/Minecraft.World/Entities/Entity.cpp index 191789eb8..80a56fd74 100644 --- a/Minecraft.World/Entities/Entity.cpp +++ b/Minecraft.World/Entities/Entity.cpp @@ -268,7 +268,7 @@ void Entity::_init(bool useSmallId, Level* level) { xd = yd = zd = 0.0; yRot = xRot = 0.0f; yRotO = xRotO = 0.0f; - bb = AABB::newPermanent(0, 0, 0, 0, 0, 0); // 4J Was final + bb = new AABB(0, 0, 0, 0, 0, 0); // 4J Was final onGround = false; horizontalCollision = verticalCollision = false; collision = false; diff --git a/Minecraft.World/Entities/Mobs/EnderDragon.cpp b/Minecraft.World/Entities/Mobs/EnderDragon.cpp index 7f9697bc3..2cb92716b 100644 --- a/Minecraft.World/Entities/Mobs/EnderDragon.cpp +++ b/Minecraft.World/Entities/Mobs/EnderDragon.cpp @@ -73,7 +73,7 @@ void EnderDragon::_init() { m_actionTicks = 0; m_sittingDamageReceived = 0; m_headYRot = 0.0; - m_acidArea = AABB::newPermanent(-4, -10, -3, 6, 3, 3); + m_acidArea = new AABB(-4, -10, -3, 6, 3, 3); m_flameAttacks = 0; for (int i = 0; i < positionsLength; i++) { diff --git a/Minecraft.World/Util/AABB.cpp b/Minecraft.World/Util/AABB.cpp index 53b4412f3..2cf5236e5 100644 --- a/Minecraft.World/Util/AABB.cpp +++ b/Minecraft.World/Util/AABB.cpp @@ -40,11 +40,6 @@ void AABB::ReleaseThreadStorage() { } } -AABB* AABB::newPermanent(double x0, double y0, double z0, double x1, double y1, - double z1) { - return new AABB(x0, y0, z0, x1, y1, z1); -} - void AABB::clearPool() {} void AABB::resetPool() {} diff --git a/Minecraft.World/Util/AABB.h b/Minecraft.World/Util/AABB.h index 975f6ebcd..61d8446cd 100644 --- a/Minecraft.World/Util/AABB.h +++ b/Minecraft.World/Util/AABB.h @@ -26,8 +26,6 @@ public: static void UseDefaultThreadStorage(); static void ReleaseThreadStorage(); - static AABB* newPermanent(double x0, double y0, double z0, double x1, - double y1, double z1); static void clearPool(); static void resetPool(); static AABB* newTemp(double x0, double y0, double z0, double x1, double y1,