diff --git a/minecraft/Minecraft.Client/Common/Consoles_App.cpp b/minecraft/Minecraft.Client/Common/Consoles_App.cpp index d25c5918a..b6478bef9 100644 --- a/minecraft/Minecraft.Client/Common/Consoles_App.cpp +++ b/minecraft/Minecraft.Client/Common/Consoles_App.cpp @@ -48,6 +48,8 @@ #include "Minecraft.Client/Common/Source Files/Localisation/StringTable.h" #include "Minecraft.Client/Common/Source Files/UI/All Platforms/ArchiveFile.h" #include "Minecraft.Client/net/minecraft/client/Minecraft.h" +#include "Minecraft.Client/Common/Source Files/Leaderboards/LeaderboardManager.h" +#include "Minecraft.Client/Common/Source Files/Colours/ColourTable.h" #include "4J_Input.h" #include "Minecraft.Client/net/minecraft/client/gui/Gui.h" @@ -63,7 +65,6 @@ #include #include -#include "Minecraft.Client/Common/Source Files/Leaderboards/LeaderboardManager.h" // CMinecraftApp app; unsigned int CMinecraftApp::m_uiLastSignInData = 0; diff --git a/minecraft/Minecraft.Client/Common/Source Files/Audio/SoundEngine.cpp b/minecraft/Minecraft.Client/Common/Source Files/Audio/SoundEngine.cpp index b4e1e5b6d..34e292f66 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/Audio/SoundEngine.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/Audio/SoundEngine.cpp @@ -23,6 +23,7 @@ #include "Minecraft.World/net/minecraft/world/entity/Mob.h" #include "java/Random.h" #include "Minecraft.Client/net/minecraft/client/Minecraft.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" #if defined(__linux__) #define STB_VORBIS_HEADER_ONLY diff --git a/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp b/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp index b59614557..fe0999927 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ApplySchematicRuleDefinition.cpp @@ -82,18 +82,18 @@ void ApplySchematicRuleDefinition::addAttribute( } } else if (attributeName.compare(L"x") == 0) { m_location.x = _fromString(attributeValue); - if (((int)abs(m_location.x)) % 2 != 0) m_location.x -= 1; + if (((int)std::abs(m_location.x)) % 2 != 0) m_location.x -= 1; // app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter // x=%f\n",m_location->x); } else if (attributeName.compare(L"y") == 0) { m_location.y = _fromString(attributeValue); - if (((int)abs(m_location.y)) % 2 != 0) m_location.y -= 1; + if (((int)std::abs(m_location.y)) % 2 != 0) m_location.y -= 1; if (m_location.y < 0) m_location.y = 0; // app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter // y=%f\n",m_location->y); } else if (attributeName.compare(L"z") == 0) { m_location.z = _fromString(attributeValue); - if (((int)abs(m_location.z)) % 2 != 0) m_location.z -= 1; + if (((int)std::abs(m_location.z)) % 2 != 0) m_location.z -= 1; // app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter // z=%f\n",m_location->z); } else if (attributeName.compare(L"rot") == 0) { diff --git a/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/LevelGenerationOptions.h b/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/LevelGenerationOptions.h index 6893ea0ba..d496b7992 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/LevelGenerationOptions.h +++ b/minecraft/Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/LevelGenerationOptions.h @@ -5,9 +5,12 @@ #include -#include "Minecraft.Client/Common/Source Files/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" #include "Minecraft.World/net/minecraft/world/level/levelgen/structure/StructureFeature.h" +#include "Minecraft.Client/Common/Source Files/GameRules/LevelRules/RuleDefinitions/GameRuleDefinition.h" +#include "Minecraft.Client/Common/Source Files/Localisation/StringTable.h" +#include "Minecraft.Client/Common/Source Files/DLC/DLCPack.h" + class ApplySchematicRuleDefinition; class LevelChunk; class ConsoleGenerateStructure; diff --git a/minecraft/Minecraft.Client/Common/Source Files/Tutorial/FullTutorial.cpp b/minecraft/Minecraft.Client/Common/Source Files/Tutorial/FullTutorial.cpp index bb4c73c58..66a7f0249 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/Tutorial/FullTutorial.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/Tutorial/FullTutorial.cpp @@ -10,6 +10,7 @@ #include "Minecraft.Client/Common/Source Files/Tutorial/Hints/AreaHint.h" #include "FullTutorial.h" #include "Minecraft.Client/Common/Source Files/Tutorial/Constraints/TutorialConstraints.h" +#include "Minecraft.Client/Common/Potion_Macros.h" FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) : Tutorial(iPad, true) { diff --git a/minecraft/Minecraft.Client/Common/Source Files/Tutorial/Tutorial.cpp b/minecraft/Minecraft.Client/Common/Source Files/Tutorial/Tutorial.cpp index a7246740b..caf60c606 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/Tutorial/Tutorial.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/Tutorial/Tutorial.cpp @@ -18,6 +18,7 @@ #include "Minecraft.Client/Common/Source Files/Tutorial/Tasks/TutorialTasks.h" #include "Minecraft.Client/Common/Source Files/Tutorial/Constraints/TutorialConstraints.h" #include "Minecraft.Client/Common/Source Files/Tutorial/Hints/TutorialHints.h" +#include "Minecraft.World/ConsoleHelpers/StringHelpers.h" std::vector Tutorial::s_completableTasks; diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIScene_CraftingMenu.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIScene_CraftingMenu.cpp index c319b335b..04a83f9d0 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIScene_CraftingMenu.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIScene_CraftingMenu.cpp @@ -5,6 +5,7 @@ #include "Minecraft.World/net/minecraft/stats/net.minecraft.stats.h" #include "Minecraft.Client/net/minecraft/client/player/LocalPlayer.h" #include "IUIScene_CraftingMenu.h" +#include "Minecraft.Client/Common/Source Files/Console_Debug_enum.h" Recipy::_eGroupType IUIScene_CraftingMenu::m_GroupTypeMapping4GridA [IUIScene_CraftingMenu::m_iMaxGroup2x2] = { diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIScene_CreativeMenu.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIScene_CreativeMenu.cpp index f454a40c4..4a95ec405 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIScene_CreativeMenu.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/All Platforms/IUIScene_CreativeMenu.cpp @@ -10,6 +10,7 @@ #include "Minecraft.World/net/minecraft/world/item/enchantment/net.minecraft.world.item.enchantment.h" #include "Minecraft.World/net/minecraft/world/entity/net.minecraft.world.entity.h" #include "Minecraft.World/net/minecraft/world/entity/animal/net.minecraft.world.entity.animal.h" +#include "Minecraft.Client/Common/Potion_Macros.h" #include "java/JavaMath.h" // 4J JEV - Images for each tab. diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp index 976f16011..d94a1b70c 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/Scenes/Frontend Menu screens/UIScene_MainMenu.cpp @@ -340,7 +340,7 @@ void UIScene_MainMenu::customDrawSplash(IggyCustomDrawCallbackRegion* region) { glTranslatef(xo, yo, 0); glRotatef(-17, 0, 0, 1); - float sss = 1.8f - Mth::abs(sinf(System::currentTimeMillis() % 1000 / + float sss = 1.8f - std::abs(sinf(System::currentTimeMillis() % 1000 / 1000.0f * std::numbers::pi * 2) * 0.1f); sss *= (m_fScreenWidth / m_fRawWidth); diff --git a/minecraft/Minecraft.Client/Common/Source Files/UI/UIController.cpp b/minecraft/Minecraft.Client/Common/Source Files/UI/UIController.cpp index a78839a62..441dc138f 100644 --- a/minecraft/Minecraft.Client/Common/Source Files/UI/UIController.cpp +++ b/minecraft/Minecraft.Client/Common/Source Files/UI/UIController.cpp @@ -12,6 +12,7 @@ #include "Minecraft.Client/net/minecraft/client/renderer/entity/EnderDragonRenderer.h" #include "Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLocalPlayer.h" #include "Minecraft.Client/net/minecraft/client/title/TitleScreen.h" +#include "Minecraft.World/ConsoleHelpers/PerformanceTimer.h" #include "UIFontData.h" #include "4J_Input.h" diff --git a/minecraft/Minecraft.Client/net/minecraft/client/Minecraft.cpp b/minecraft/Minecraft.Client/net/minecraft/client/Minecraft.cpp index 0cfd1e49b..caed9ee81 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/Minecraft.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/Minecraft.cpp @@ -83,6 +83,10 @@ #include "Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerGameMode.h" #include "Minecraft.Client/Common/Source Files/DLC/DLCPack.h" #include "Minecraft.Client/Common/Source Files/ConsoleGameMode.h" +#include "Minecraft.World/ConsoleHelpers/StringHelpers.h" +#include "Minecraft.Client/Common/Potion_Macros.h" +#include "Minecraft.Client/Common/Minecraft_Macros.h" +#include "Minecraft.Client/Common/Source Files/Colours/ColourTable.h" #include "4J_Input.h" // #define DISABLE_SPU_CODE @@ -3557,9 +3561,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { // Level::animateTickDoWork() so we can take into account multiple // players in the one level. if (!pause && levels[i] != nullptr) - levels[i]->animateTick(Mth::floor(player->x), - Mth::floor(player->y), - Mth::floor(player->z)); + levels[i]->animateTick(std::floor(player->x), + std::floor(player->y), + std::floor(player->z)); if (levelsTickedFlags & (1 << i)) continue; // Don't tick further if we've already ticked this diff --git a/minecraft/Minecraft.Client/net/minecraft/client/gui/Gui.cpp b/minecraft/Minecraft.Client/net/minecraft/client/gui/Gui.cpp index 5b7d68f6e..64fdbd3e3 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/gui/Gui.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/gui/Gui.cpp @@ -34,6 +34,7 @@ #include "Minecraft.Client/net/minecraft/client/gui/ScreenSizeCalculator.h" #include "Minecraft.Client/net/minecraft/client/ClientConstants.h" #include "Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerGameMode.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" ResourceLocation Gui::PUMPKIN_BLUR_LOCATION = ResourceLocation(TN__BLUR__MISC_PUMPKINBLUR); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/model/HumanoidModel.cpp b/minecraft/Minecraft.Client/net/minecraft/client/model/HumanoidModel.cpp index 21ceadebb..1e5056a65 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/model/HumanoidModel.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/model/HumanoidModel.cpp @@ -331,7 +331,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, is = is * is * is; is = is * is * is; float iss = 1 - is; - arm0->xRot = -Mth::abs(cosf(eating_t / 4.0f * std::numbers::pi) * 0.1f) * + arm0->xRot = -std::abs(cosf(eating_t / 4.0f * std::numbers::pi) * 0.1f) * (eating_swing > 0.2 ? 1.0f : 0.0f) * 2.0f; // This factor is the chomping bit (conditional // factor is so that he doesn't eat whilst the diff --git a/minecraft/Minecraft.Client/net/minecraft/client/model/ModelHorse.cpp b/minecraft/Minecraft.Client/net/minecraft/client/model/ModelHorse.cpp index fe4f07a96..0aaa29f3a 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/model/ModelHorse.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/model/ModelHorse.cpp @@ -11,6 +11,7 @@ #include "Minecraft.World/net/minecraft/world/entity/LivingEntity.h" #include "Minecraft.World/net/minecraft/world/entity/animal/EntityHorse.h" #include "Minecraft.Client/net/minecraft/client/model/geom/Model.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" ModelHorse::ModelHorse() { texWidth = 128; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/model/WitchModel.cpp b/minecraft/Minecraft.Client/net/minecraft/client/model/WitchModel.cpp index 3fe915dac..1d66f3f08 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/model/WitchModel.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/model/WitchModel.cpp @@ -7,6 +7,7 @@ #include "VillagerModel.h" #include "Minecraft.World/net/minecraft/util/Mth.h" #include "Minecraft.World/net/minecraft/world/entity/Entity.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" WitchModel::WitchModel(float g) : VillagerModel(g, 0, 64, 128) { mole = (new ModelPart(this))->setTexSize(64, 128); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/ClientConnection.cpp b/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/ClientConnection.cpp index e77373c1b..60f801435 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/ClientConnection.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/ClientConnection.cpp @@ -55,6 +55,7 @@ #include "Minecraft.Client/Common/Source Files/Tutorial/TutorialMode.h" #include "Minecraft.Client/Common/Source Files/Tutorial/FullTutorialMode.h" #include "Minecraft.Client/Common/Source Files/DLC/DLCPack.h" +#include "Minecraft.World/ConsoleHelpers/StringHelpers.h" #include "4J_Input.h" ClientConnection::ClientConnection(Minecraft* minecraft, const std::wstring& ip, @@ -2579,9 +2580,9 @@ void ClientConnection::handleContainerOpen( } } break; case ContainerOpenPacket::WORKBENCH: { - if (player->startCrafting(Mth::floor(player->x), - Mth::floor(player->y), - Mth::floor(player->z))) { + if (player->startCrafting(std::floor(player->x), + std::floor(player->y), + std::floor(player->z))) { player->containerMenu->containerId = packet->containerId; } else { failed = true; @@ -2589,8 +2590,8 @@ void ClientConnection::handleContainerOpen( } break; case ContainerOpenPacket::ENCHANTMENT: { if (player->startEnchanting( - Mth::floor(player->x), Mth::floor(player->y), - Mth::floor(player->z), + std::floor(player->x), std::floor(player->y), + std::floor(player->z), packet->customName ? packet->title : L"")) { player->containerMenu->containerId = packet->containerId; } else { @@ -2621,9 +2622,9 @@ void ClientConnection::handleContainerOpen( } } break; case ContainerOpenPacket::REPAIR_TABLE: { - if (player->startRepairing(Mth::floor(player->x), - Mth::floor(player->y), - Mth::floor(player->z))) { + if (player->startRepairing(std::floor(player->x), + std::floor(player->y), + std::floor(player->z))) { player->containerMenu->containerId = packet->containerId; } else { failed = true; @@ -2655,9 +2656,9 @@ void ClientConnection::handleContainerOpen( } } break; case ContainerOpenPacket::FIREWORKS: { - if (player->openFireworks(Mth::floor(player->x), - Mth::floor(player->y), - Mth::floor(player->z))) { + if (player->openFireworks(std::floor(player->x), + std::floor(player->y), + std::floor(player->z))) { player->containerMenu->containerId = packet->containerId; } else { failed = true; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp index af3b24815..e99969a99 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLocalPlayer.cpp @@ -80,7 +80,7 @@ void MultiplayerLocalPlayer::tick() { ); }*/ - if (!level->hasChunkAt(Mth::floor(x), 0, Mth::floor(z))) return; + if (!level->hasChunkAt(std::floor(x), 0, std::floor(z))) return; double tempX = x, tempY = y, tempZ = z; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/particle/BubbleParticle.cpp b/minecraft/Minecraft.Client/net/minecraft/client/particle/BubbleParticle.cpp index 9704fdf6a..a528cb3e4 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/particle/BubbleParticle.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/particle/BubbleParticle.cpp @@ -35,7 +35,7 @@ void BubbleParticle::tick() { yd *= 0.85f; zd *= 0.85f; - if (level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z)) != + if (level->getMaterial(std::floor(x), std::floor(y), std::floor(z)) != Material::water) remove(); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/particle/DripParticle.cpp b/minecraft/Minecraft.Client/net/minecraft/client/particle/DripParticle.cpp index ea5b3945f..5b1954d7a 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/particle/DripParticle.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/particle/DripParticle.cpp @@ -123,11 +123,11 @@ void DripParticle::tick() { } Material* m = - level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z)); + level->getMaterial(std::floor(x), std::floor(y), std::floor(z)); if (m->isLiquid() || m->isSolid()) { - double y0 = Mth::floor(y) + 1 - + double y0 = std::floor(y) + 1 - LiquidTile::getHeight(level->getData( - Mth::floor(x), Mth::floor(y), Mth::floor(z))); + std::floor(x), std::floor(y), std::floor(z))); if (y < y0) { remove(); } diff --git a/minecraft/Minecraft.Client/net/minecraft/client/particle/FootstepParticle.cpp b/minecraft/Minecraft.Client/net/minecraft/client/particle/FootstepParticle.cpp index b1ee3c205..e4ba675ce 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/particle/FootstepParticle.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/particle/FootstepParticle.cpp @@ -42,7 +42,7 @@ void FootstepParticle::render(Tesselator* t, float a, float xa, float ya, float zz = (float)(z - zOff); float br = - level->getBrightness(Mth::floor(x), Mth::floor(y), Mth::floor(z)); + level->getBrightness(std::floor(x), std::floor(y), std::floor(z)); textures->bindTexture(&FOOTPRINT_LOCATION); glEnable(GL_BLEND); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/particle/Particle.cpp b/minecraft/Minecraft.Client/net/minecraft/client/particle/Particle.cpp index 9dfb1aadf..2eac6581c 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/particle/Particle.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/particle/Particle.cpp @@ -64,7 +64,7 @@ Particle::Particle(Level* level, double x, double y, double z, double xa, zd = za + (float)(Math::random() * 2 - 1) * 0.4f; float speed = (float)(Math::random() + Math::random() + 1) * 0.15f; - float dd = (float)(Mth::sqrt(xd * xd + yd * yd + zd * zd)); + float dd = (float)(std::sqrt(xd * xd + yd * yd + zd * zd)); xd = xd / dd * speed * 0.4f; yd = yd / dd * speed * 0.4f + 0.1f; zd = zd / dd * speed * 0.4f; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/particle/SuspendedParticle.cpp b/minecraft/Minecraft.Client/net/minecraft/client/particle/SuspendedParticle.cpp index 435aafef7..a8ffc31b6 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/particle/SuspendedParticle.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/particle/SuspendedParticle.cpp @@ -41,7 +41,7 @@ void SuspendedParticle::tick() { move(xd, yd, zd); - if (level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z)) != + if (level->getMaterial(std::floor(x), std::floor(y), std::floor(z)) != Material::water) remove(); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/particle/TakeAnimationParticle.cpp b/minecraft/Minecraft.Client/net/minecraft/client/particle/TakeAnimationParticle.cpp index 069497dc8..570e81738 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/particle/TakeAnimationParticle.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/particle/TakeAnimationParticle.cpp @@ -45,9 +45,9 @@ void TakeAnimationParticle::render(Tesselator* t, float a, float xa, float ya, double yy = yo + (yt - yo) * time; double zz = zo + (zt - zo) * time; - int xTile = Mth::floor(xx); - int yTile = Mth::floor(yy + heightOffset / 2.0f); - int zTile = Mth::floor(zz); + int xTile = std::floor(xx); + int yTile = std::floor(yy + heightOffset / 2.0f); + int zTile = std::floor(zz); // 4J - change brought forward from 1.8.2 if (SharedConstants::TEXTURE_LIGHTING) { diff --git a/minecraft/Minecraft.Client/net/minecraft/client/particle/WaterDropParticle.cpp b/minecraft/Minecraft.Client/net/minecraft/client/particle/WaterDropParticle.cpp index d8f4a976b..d6c61c335 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/particle/WaterDropParticle.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/particle/WaterDropParticle.cpp @@ -45,11 +45,11 @@ void WaterDropParticle::tick() { } Material* m = - level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z)); + level->getMaterial(std::floor(x), std::floor(y), std::floor(z)); if (m->isLiquid() || m->isSolid()) { - double y0 = Mth::floor(y) + 1 - + double y0 = std::floor(y) + 1 - LiquidTile::getHeight(level->getData( - Mth::floor(x), Mth::floor(y), Mth::floor(z))); + std::floor(x), std::floor(y), std::floor(z))); if (y < y0) { remove(); } diff --git a/minecraft/Minecraft.Client/net/minecraft/client/player/LocalPlayer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/player/LocalPlayer.cpp index f4280210c..76cfc260e 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/player/LocalPlayer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/player/LocalPlayer.cpp @@ -1097,9 +1097,9 @@ bool LocalPlayer::isSolidBlock(int x, int y, int z) { } bool LocalPlayer::checkInTile(double x, double y, double z) { - int xTile = Mth::floor(x); - int yTile = Mth::floor(y); - int zTile = Mth::floor(z); + int xTile = std::floor(x); + int yTile = std::floor(y); + int zTile = std::floor(z); double xd = x - xTile; double zd = z - zTile; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/player/RemotePlayer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/player/RemotePlayer.cpp index f8351b68e..ed8fb55ac 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/player/RemotePlayer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/player/RemotePlayer.cpp @@ -54,7 +54,7 @@ void RemotePlayer::tick() { walkAnimSpeedO = walkAnimSpeed; double xxd = x - xo; double zzd = z - zo; - float wst = Mth::sqrt(xxd * xxd + zzd * zzd) * 4; + float wst = std::sqrt(xxd * xxd + zzd * zzd) * 4; if (wst > 1) wst = 1; walkAnimSpeed += (wst - walkAnimSpeed) * 0.4f; walkAnimPos += walkAnimSpeed; @@ -106,7 +106,7 @@ void RemotePlayer::aiStep() { } oBob = bob; - float tBob = (float)Mth::sqrt(xd * xd + zd * zd); + float tBob = (float)std::sqrt(xd * xd + zd * zd); float tTilt = (float)atan(-yd * 0.2f) * 15.0f; if (tBob > 0.1f) tBob = 0.1f; if (!onGround || getHealth() <= 0) tBob = 0; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/GameRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/GameRenderer.cpp index 7931ed35a..424235c64 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/GameRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/GameRenderer.cpp @@ -243,9 +243,9 @@ void GameRenderer::tick(bool first) // 4J - add bFirst mc->cameraTargetPlayer = std::dynamic_pointer_cast(mc->player); } - float brr = mc->level->getBrightness(Mth::floor(mc->cameraTargetPlayer->x), - Mth::floor(mc->cameraTargetPlayer->y), - Mth::floor(mc->cameraTargetPlayer->z)); + float brr = mc->level->getBrightness(std::floor(mc->cameraTargetPlayer->x), + std::floor(mc->cameraTargetPlayer->y), + std::floor(mc->cameraTargetPlayer->z)); float whiteness = (3 - mc->options->viewDistance) / 3.0f; float fogBrT = brr * (1 - whiteness) + whiteness; fogBr += (fogBrT - fogBr) * 0.1f; @@ -479,12 +479,12 @@ void GameRenderer::moveCameraToPlayer(float a) { glTranslatef(0.0f, 0.3f, 0); if (!mc->options->fixedCamera) { int t = - mc->level->getTile(Mth::floor(player->x), Mth::floor(player->y), - Mth::floor(player->z)); + mc->level->getTile(std::floor(player->x), std::floor(player->y), + std::floor(player->z)); if (t == Tile::bed_Id) { - int data = mc->level->getData(Mth::floor(player->x), - Mth::floor(player->y), - Mth::floor(player->z)); + int data = mc->level->getData(std::floor(player->x), + std::floor(player->y), + std::floor(player->z)); int direction = data & 3; glRotatef((float)direction * 90, 0.0f, 1.0f, 0.0f); @@ -1545,9 +1545,9 @@ void GameRenderer::tickRain() { std::shared_ptr player = mc->cameraTargetPlayer; Level* level = mc->level; - int x0 = Mth::floor(player->x); - int y0 = Mth::floor(player->y); - int z0 = Mth::floor(player->z); + int x0 = std::floor(player->x); + int y0 = std::floor(player->y); + int z0 = std::floor(player->z); int r = 10; @@ -1597,9 +1597,9 @@ void GameRenderer::tickRain() { if (rainPosSamples > 0 && random->nextInt(3) < rainSoundTime++) { rainSoundTime = 0; if (rainPosY > player->y + 1 && - level->getTopRainBlock(Mth::floor(player->x), - Mth::floor(player->z)) > - Mth::floor(player->y)) { + level->getTopRainBlock(std::floor(player->x), + std::floor(player->z)) > + std::floor(player->y)) { mc->level->playLocalSound(rainPosX, rainPosY, rainPosZ, eSoundType_AMBIENT_WEATHER_RAIN, 0.1f, 0.5f); @@ -1629,7 +1629,7 @@ void GameRenderer::renderSnowAndRain(float a) { for (int x = 0; x < 32; x++) { float xa = x - 16; float za = z - 16; - float d = Mth::sqrt(xa * xa + za * za); + float d = std::sqrt(xa * xa + za * za); rainXa[z << 5 | x] = -za / d; rainZa[z << 5 | x] = xa / d; } @@ -1639,9 +1639,9 @@ void GameRenderer::renderSnowAndRain(float a) { std::shared_ptr player = mc->cameraTargetPlayer; Level* level = mc->level; - int x0 = Mth::floor(player->x); - int y0 = Mth::floor(player->y); - int z0 = Mth::floor(player->z); + int x0 = std::floor(player->x); + int y0 = std::floor(player->y); + int z0 = std::floor(player->z); Tesselator* t = Tesselator::getInstance(); glDisable(GL_CULL_FACE); @@ -1657,7 +1657,7 @@ void GameRenderer::renderSnowAndRain(float a) { double yo = player->yOld + (player->y - player->yOld) * a; double zo = player->zOld + (player->z - player->zOld) * a; - int yMin = Mth::floor(yo); + int yMin = std::floor(yo); int r = 5; // 4J - was if(mc.options.fancyGraphics) r = 10; @@ -1722,7 +1722,7 @@ void GameRenderer::renderSnowAndRain(float a) { double xd = (x + 0.5f) - player->x; double zd = (z + 0.5f) - player->z; - float dd = (float)Mth::sqrt(xd * xd + zd * zd) / r; + float dd = (float)std::sqrt(xd * xd + zd * zd) / r; float br = 1.0f; float s = 1.0f; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/ItemInHandRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/ItemInHandRenderer.cpp index 1299b2d3b..f366e9eec 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/ItemInHandRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/ItemInHandRenderer.cpp @@ -452,13 +452,13 @@ void ItemInHandRenderer::render(float a) { std::shared_ptr item = selectedItem; float br = minecraft->level->getBrightness( - Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); + std::floor(player->x), std::floor(player->y), std::floor(player->z)); // 4J - change brought forward from 1.8.2 if (SharedConstants::TEXTURE_LIGHTING) { br = 1; - int col = minecraft->level->getLightColor(Mth::floor(player->x), - Mth::floor(player->y), - Mth::floor(player->z), 0); + int col = minecraft->level->getLightColor(std::floor(player->x), + std::floor(player->y), + std::floor(player->z), 0); int u = col % 65536; int v = col / 65536; #if defined(__linux__) @@ -621,7 +621,7 @@ void ItemInHandRenderer::render(float a) { is = is * is * is; float iss = 1 - is; glTranslatef(0, - Mth::abs(cosf(t / 4 * std::numbers::pi) * 0.1f) * + std::abs(cosf(t / 4 * std::numbers::pi) * 0.1f) * (swing > 0.2 ? 1 : 0), 0); glTranslatef(iss * 0.6f, -iss * 0.5f, 0); @@ -783,9 +783,9 @@ void ItemInHandRenderer::renderScreenEffect(float a) { if (minecraft->player->isInWall()) // Inside a tile { - int x = Mth::floor(minecraft->player->x); - int y = Mth::floor(minecraft->player->y); - int z = Mth::floor(minecraft->player->z); + int x = std::floor(minecraft->player->x); + int y = std::floor(minecraft->player->y); + int z = std::floor(minecraft->player->z); int tile = minecraft->level->getTile(x, y, z); if (minecraft->level->isSolidBlockingTile(x, y, z)) { @@ -798,9 +798,9 @@ void ItemInHandRenderer::renderScreenEffect(float a) { ((i >> 1) % 2 - 0.5f) * minecraft->player->bbHeight * 0.2f; float zo = ((i >> 2) % 2 - 0.5f) * minecraft->player->bbWidth * 0.9f; - int xt = Mth::floor(x + xo); - int yt = Mth::floor(y + yo); - int zt = Mth::floor(z + zo); + int xt = std::floor(x + xo); + int yt = std::floor(y + yo); + int zt = std::floor(z + zo); if (minecraft->level->isSolidBlockingTile(xt, yt, zt)) { tile = minecraft->level->getTile(xt, yt, zt); } diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/LevelRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/LevelRenderer.cpp index 8f3703707..af22fe7f4 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/LevelRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/LevelRenderer.cpp @@ -104,6 +104,7 @@ #include "Minecraft.Client/net/minecraft/client/resources/ResourceLocation.h" #include "Minecraft.Client/Header Files/stubs.h" #include "4J_Input.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" class Icon; class ItemInstance; @@ -540,8 +541,8 @@ void LevelRenderer::allChanged(int playerIndex) { if (level[playerIndex] != nullptr) { std::shared_ptr player = mc->cameraTargetPlayer; if (player != nullptr) { - this->resortChunks(Mth::floor(player->x), Mth::floor(player->y), - Mth::floor(player->z)); + this->resortChunks(std::floor(player->x), std::floor(player->y), + std::floor(player->z)); // sort(sortedChunks[playerIndex]->begin(),sortedChunks[playerIndex]->end(), // DistanceChunkSorter(player)); // 4J - removed - not sorting // our chunks anymore @@ -638,8 +639,8 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) { !mc->cameraTargetPlayer->isSleeping()) continue; - if (!level[playerIndex]->hasChunkAt(Mth::floor(entity->x), 0, - Mth::floor(entity->z))) { + if (!level[playerIndex]->hasChunkAt(std::floor(entity->x), 0, + std::floor(entity->z))) { continue; } renderedEntities++; @@ -772,8 +773,8 @@ int LevelRenderer::render(std::shared_ptr player, int layer, yOld[playerIndex] = player->y; zOld[playerIndex] = player->z; - resortChunks(Mth::floor(player->x), Mth::floor(player->y), - Mth::floor(player->z)); + resortChunks(std::floor(player->x), std::floor(player->y), + std::floor(player->z)); // sort(sortedChunks[playerIndex]->begin(),sortedChunks[playerIndex]->end(), // DistanceChunkSorter(player)); // 4J - removed - not sorting // our chunks anymore @@ -1215,8 +1216,8 @@ void LevelRenderer::renderClouds(float alpha) { double zo = mc->cameraTargetPlayer->zo + (mc->cameraTargetPlayer->z - mc->cameraTargetPlayer->zo) * alpha; - int xOffs = Mth::floor(xo / 2048); - int zOffs = Mth::floor(zo / 2048); + int xOffs = std::floor(xo / 2048); + int zOffs = std::floor(zo / 2048); xo -= xOffs * 2048; zo -= zOffs * 2048; @@ -1458,8 +1459,8 @@ void LevelRenderer::renderAdvancedClouds(float alpha) { 0.33f; float yy = (float)(level[playerIndex]->dimension->getCloudHeight() - yOffs + 0.33f); - int xOffs = Mth::floor(xo / 2048); - int zOffs = Mth::floor(zo / 2048); + int xOffs = std::floor(xo / 2048); + int zOffs = std::floor(zo / 2048); xo -= xOffs * 2048; zo -= zOffs * 2048; @@ -1505,16 +1506,16 @@ void LevelRenderer::renderAdvancedClouds(float alpha) { float scale = 1 / 256.0f; - uo = (float)(Mth::floor(xo)) * scale; - vo = (float)(Mth::floor(zo)) * scale; + uo = (float)(std::floor(xo)) * scale; + vo = (float)(std::floor(zo)) * scale; // 4J - keep our UVs +ve - there's a small bug in the xbox GPU that // incorrectly rounds small -ve UVs (between -1/(64*size) and 0) up to 0, // which leaves gaps in our clouds... while (uo < 1.0f) uo += 1.0f; while (vo < 1.0f) vo += 1.0f; - float xoffs = (float)(xo - Mth::floor(xo)); - float zoffs = (float)(zo - Mth::floor(zo)); + float xoffs = (float)(xo - std::floor(xo)); + float zoffs = (float)(zo - std::floor(zo)); int D = 8; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp index 971b25328..f75916e80 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/EntityRenderDispatcher.cpp @@ -224,12 +224,12 @@ void EntityRenderDispatcher::prepare( this->crosshairPickMob = crosshairPickMob; if (player->isSleeping()) { - int t = level->getTile(Mth::floor(player->x), Mth::floor(player->y), - Mth::floor(player->z)); + int t = level->getTile(std::floor(player->x), std::floor(player->y), + std::floor(player->z)); if (t == Tile::bed_Id) { int data = - level->getData(Mth::floor(player->x), Mth::floor(player->y), - Mth::floor(player->z)); + level->getData(std::floor(player->x), std::floor(player->y), + std::floor(player->z)); int direction = data & 3; playerRotY = (float)(direction * 90 + 180); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/EntityRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/EntityRenderer.cpp index a66c0f78b..369ab4a07 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/EntityRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/EntityRenderer.cpp @@ -178,12 +178,12 @@ void EntityRenderer::renderShadow(std::shared_ptr e, double x, double y, } double ez = e->zOld + (e->z - e->zOld) * a; - int x0 = Mth::floor(ex - r); - int x1 = Mth::floor(ex + r); - int y0 = Mth::floor(ey - r); - int y1 = Mth::floor(ey); - int z0 = Mth::floor(ez - r); - int z1 = Mth::floor(ez + r); + int x0 = std::floor(ex - r); + int x1 = std::floor(ex + r); + int y0 = std::floor(ey - r); + int y1 = std::floor(ey); + int z0 = std::floor(ez - r); + int z1 = std::floor(ez + r); double xo = x - ex; double yo = y - ey; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/FallingTileRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/FallingTileRenderer.cpp index a5c426832..36c278b67 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/FallingTileRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/FallingTileRenderer.cpp @@ -47,28 +47,28 @@ void FallingTileRenderer::render(std::shared_ptr _tile, double x, tileRenderer->level = level; Tesselator* t = Tesselator::getInstance(); t->begin(); - t->offset(-Mth::floor(tile->x) - 0.5f, -Mth::floor(tile->y) - 0.5f, - -Mth::floor(tile->z) - 0.5f); + t->offset(-std::floor(tile->x) - 0.5f, -std::floor(tile->y) - 0.5f, + -std::floor(tile->z) - 0.5f); tileRenderer->tesselateAnvilInWorld( - (AnvilTile*)tt, Mth::floor(tile->x), Mth::floor(tile->y), - Mth::floor(tile->z), tile->data); + (AnvilTile*)tt, std::floor(tile->x), std::floor(tile->y), + std::floor(tile->z), tile->data); t->offset(0, 0, 0); t->end(); } else if (tt == Tile::dragonEgg) { tileRenderer->level = level; Tesselator* t = Tesselator::getInstance(); t->begin(); - t->offset(-Mth::floor(tile->x) - 0.5f, -Mth::floor(tile->y) - 0.5f, - -Mth::floor(tile->z) - 0.5f); - tileRenderer->tesselateInWorld(tt, Mth::floor(tile->x), - Mth::floor(tile->y), - Mth::floor(tile->z)); + t->offset(-std::floor(tile->x) - 0.5f, -std::floor(tile->y) - 0.5f, + -std::floor(tile->z) - 0.5f); + tileRenderer->tesselateInWorld(tt, std::floor(tile->x), + std::floor(tile->y), + std::floor(tile->z)); t->offset(0, 0, 0); t->end(); } else if (tt != nullptr) { tileRenderer->setShape(tt); - tileRenderer->renderBlock(tt, level, Mth::floor(tile->x), - Mth::floor(tile->y), Mth::floor(tile->z), + tileRenderer->renderBlock(tt, level, std::floor(tile->x), + std::floor(tile->y), std::floor(tile->z), tile->data); } glEnable(GL_LIGHTING); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/ItemFrameRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/ItemFrameRenderer.cpp index eeccc9f3b..d471a363d 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/ItemFrameRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/ItemFrameRenderer.cpp @@ -26,6 +26,7 @@ #include "Minecraft.Client/net/minecraft/client/renderer/Tesselator.h" #include "Minecraft.Client/net/minecraft/client/renderer/Textures.h" #include "Minecraft.Client/net/minecraft/client/resources/ResourceLocation.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" class MapItemSavedData; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/ItemRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/ItemRenderer.cpp index c606835f6..d0092b98d 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/ItemRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/ItemRenderer.cpp @@ -29,6 +29,7 @@ #include "Minecraft.Client/net/minecraft/client/renderer/Tesselator.h" #include "Minecraft.Client/net/minecraft/client/renderer/Textures.h" #include "Minecraft.Client/net/minecraft/client/renderer/entity/EntityRenderer.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" class ResourceLocation; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/LivingEntityRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/LivingEntityRenderer.cpp index aa983f9d5..0c2fbbc57 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/LivingEntityRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/LivingEntityRenderer.cpp @@ -25,6 +25,7 @@ #include "Minecraft.Client/net/minecraft/client/renderer/Tesselator.h" #include "Minecraft.Client/net/minecraft/client/renderer/Textures.h" #include "Minecraft.Client/net/minecraft/client/resources/ResourceLocation.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" ResourceLocation LivingEntityRenderer::ENCHANT_GLINT_LOCATION = ResourceLocation(TN__BLUR__MISC_GLINT); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/MobRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/MobRenderer.cpp index 07e640d1e..d801265db 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/MobRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/MobRenderer.cpp @@ -15,6 +15,7 @@ #include "java/Class.h" #include "Minecraft.Client/net/minecraft/client/Minecraft.h" #include "Minecraft.Client/net/minecraft/client/renderer/Tesselator.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" class Model; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/PaintingRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/PaintingRenderer.cpp index ef5420532..fdbaab860 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/PaintingRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/entity/PaintingRenderer.cpp @@ -124,13 +124,13 @@ void PaintingRenderer::renderPainting(std::shared_ptr painting, int w, void PaintingRenderer::setBrightness(std::shared_ptr painting, float ss, float ya) { - int x = Mth::floor(painting->x); - int y = Mth::floor(painting->y + ya / 16.0f); - int z = Mth::floor(painting->z); - if (painting->dir == 0) x = Mth::floor(painting->x + ss / 16.0f); - if (painting->dir == 1) z = Mth::floor(painting->z - ss / 16.0f); - if (painting->dir == 2) x = Mth::floor(painting->x - ss / 16.0f); - if (painting->dir == 3) z = Mth::floor(painting->z + ss / 16.0f); + int x = std::floor(painting->x); + int y = std::floor(painting->y + ya / 16.0f); + int z = std::floor(painting->z); + if (painting->dir == 0) x = std::floor(painting->x + ss / 16.0f); + if (painting->dir == 1) z = std::floor(painting->z - ss / 16.0f); + if (painting->dir == 2) x = std::floor(painting->x - ss / 16.0f); + if (painting->dir == 3) z = std::floor(painting->z + ss / 16.0f); int col = this->entityRenderDispatcher->level->getLightColor(x, y, z, 0); int u = col % 65536; diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp index 7e423eeed..7c2352b3f 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/tileentity/EnchantTableRenderer.cpp @@ -11,6 +11,7 @@ #include "Minecraft.World/net/minecraft/world/level/tile/entity/TileEntity.h" #include "Minecraft.Client/net/minecraft/client/renderer/Textures.h" #include "Minecraft.Client/net/minecraft/client/resources/ResourceLocation.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" ResourceLocation EnchantTableRenderer::BOOK_LOCATION = ResourceLocation(TN_ITEM_BOOK); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/renderer/tileentity/SignRenderer.cpp b/minecraft/Minecraft.Client/net/minecraft/client/renderer/tileentity/SignRenderer.cpp index 4ff93404f..c02661309 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/renderer/tileentity/SignRenderer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/renderer/tileentity/SignRenderer.cpp @@ -11,7 +11,7 @@ #include "Minecraft.World/net/minecraft/world/level/tile/net.minecraft.world.level.tile.h" #include "Minecraft.World/net/minecraft/world/entity/Entity.h" #include "Minecraft.World/net/minecraft/world/level/Level.h" - +#include "Minecraft.Client/Common/Source Files/Colours/ColourTable.h" ResourceLocation SignRenderer::SIGN_LOCATION = ResourceLocation(TN_ITEM_SIGN); diff --git a/minecraft/Minecraft.Client/net/minecraft/client/title/TitleScreen.cpp b/minecraft/Minecraft.Client/net/minecraft/client/title/TitleScreen.cpp index 166ee4536..dcfd825f0 100644 --- a/minecraft/Minecraft.Client/net/minecraft/client/title/TitleScreen.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/client/title/TitleScreen.cpp @@ -396,7 +396,7 @@ void TitleScreen::render(int xm, int ym, float a) { glTranslatef((float)width / 2 + 90, 70, 0); glRotatef(-20, 0, 0, 1); - float sss = 1.8f - Mth::abs(sinf(System::currentTimeMillis() % 1000 / + float sss = 1.8f - std::abs(sinf(System::currentTimeMillis() % 1000 / 1000.0f * std::numbers::pi * 2) * 0.1f); diff --git a/minecraft/Minecraft.Client/net/minecraft/server/MinecraftServer.cpp b/minecraft/Minecraft.Client/net/minecraft/server/MinecraftServer.cpp index 45d0aa7bc..5872feac7 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/MinecraftServer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/server/MinecraftServer.cpp @@ -44,12 +44,14 @@ #include "Minecraft.World/net/minecraft/world/level/chunk/SparseLightStorage.h" #include "Minecraft.World/net/minecraft/world/level/chunk/SparseDataStorage.h" #include "Minecraft.World/Header Files/compression.h" +#include "Minecraft.World/net/minecraft/world/level/biome/BiomeSource.h" #include "Minecraft.Client/Common/ShutdownManager.h" #include "Minecraft.Client/Common/Source Files/UI/All Platforms/UIStructs.h" #include "Minecraft.Client/net/minecraft/server/commands/ServerCommandDispatcher.h" -#include "Minecraft.World/net/minecraft/world/level/biome/BiomeSource.h" #include "Minecraft.Client/net/minecraft/server/level/PlayerChunkMap.h" +#include "Minecraft.Client/Common/Source Files/GameRules/LevelGeneration/ConsoleSchematicFile.h" #include "4J_Input.h" +#include "Minecraft.World/net/minecraft/world/level/Level.h" #define DEBUG_SERVER_DONT_SPAWN_MOBS 0 @@ -208,7 +210,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData, settings->getInt(L"max-build-height", Level::maxBuildHeight)); setMaxBuildHeight(((getMaxBuildHeight() + 8) / 16) * 16); setMaxBuildHeight( - Mth::clamp(getMaxBuildHeight(), 64, Level::maxBuildHeight)); + std::clamp(getMaxBuildHeight(), 64, Level::maxBuildHeight)); // settings->setProperty(L"max-build-height", maxBuildHeight); // logger.info("Preparing level \"" + levelName + "\""); @@ -1012,8 +1014,8 @@ bool MinecraftServer::isUnderSpawnProtection(Level* level, int x, int y, int z, if (getSpawnProtectionRadius() <= 0) return false; Pos* spawnPos = level->getSharedSpawnPos(); - int xd = Mth::abs(x - spawnPos->x); - int zd = Mth::abs(z - spawnPos->z); + int xd = std::abs(x - spawnPos->x); + int zd = std::abs(z - spawnPos->z); int dist = std::max(xd, zd); return dist <= getSpawnProtectionRadius(); diff --git a/minecraft/Minecraft.Client/net/minecraft/server/PlayerList.cpp b/minecraft/Minecraft.Client/net/minecraft/server/PlayerList.cpp index 41397f192..f6e6e1f88 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/PlayerList.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/server/PlayerList.cpp @@ -27,6 +27,7 @@ #include "java/JavaMath.h" #include "Minecraft.World/net/minecraft/world/entity/EntityIO.h" #include "Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerGameMode.h" +#include "Minecraft.Client/Common/Source Files/GameRules/LevelRules/RuleDefinitions/LevelRuleset.h" #include "Minecraft.Client/Common/Source Files/Tutorial/Tutorial.h" // 4J - this class is fairly substantially altered as there didn't seem any @@ -374,17 +375,17 @@ void PlayerList::validatePlayerSpawnPosition( double targetX = 0; if (player->x < 0) - targetX = Mth::ceil(player->x) - 0.5; + targetX = std::ceil(player->x) - 0.5; else - targetX = Mth::floor(player->x) + 0.5; + targetX = std::floor(player->x) + 0.5; double targetY = floor(player->y); double targetZ = 0; if (player->z < 0) - targetZ = Mth::ceil(player->z) - 0.5; + targetZ = std::ceil(player->z) - 0.5; else - targetZ = Mth::floor(player->z) + 0.5; + targetZ = std::floor(player->z) + 0.5; player->setPos(targetX, targetY, targetZ); @@ -957,9 +958,9 @@ void PlayerList::repositionAcrossDimension(std::shared_ptr entity, } if (lastDimension != 1) { - xt = (double)Mth::clamp((int)xt, -Level::MAX_LEVEL_SIZE + 128, + xt = (double)std::clamp((int)xt, -Level::MAX_LEVEL_SIZE + 128, Level::MAX_LEVEL_SIZE - 128); - zt = (double)Mth::clamp((int)zt, -Level::MAX_LEVEL_SIZE + 128, + zt = (double)std::clamp((int)zt, -Level::MAX_LEVEL_SIZE + 128, Level::MAX_LEVEL_SIZE - 128); if (entity->isAlive()) { newLevel->addEntity(entity); diff --git a/minecraft/Minecraft.Client/net/minecraft/server/PlayerList.h b/minecraft/Minecraft.Client/net/minecraft/server/PlayerList.h index fd67ffe34..325b28b02 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/PlayerList.h +++ b/minecraft/Minecraft.Client/net/minecraft/server/PlayerList.h @@ -15,6 +15,7 @@ class TileEntity; class ProgressListener; class GameType; class LoginPacket; +class Connection; class ServerScoreboard; class PlayerList { diff --git a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerLevel.cpp b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerLevel.cpp index 2dd5a0692..9f79b9c26 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerLevel.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerLevel.cpp @@ -43,6 +43,7 @@ #include "Minecraft.Client/net/minecraft/client/Minecraft.h" #include "PlayerChunkMap.h" #include "Minecraft.Client/Common/Source Files/DLC/DLCPack.h" +#include "Minecraft.Client/Common/Source Files/Console_Debug_enum.h" #include "4J_Input.h" std::vector ServerLevel::RANDOM_BONUS_ITEMS; diff --git a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerLevel.h b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerLevel.h index f20f19a97..d207cb666 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerLevel.h +++ b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerLevel.h @@ -1,14 +1,17 @@ #pragma once +#include #include #include #include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h" #include "java/JavaIntHash.h" + class ServerChunkCache; class MinecraftServer; class Node; class EntityTracker; class PlayerChunkMap; +class WeighedTreasure; class ServerLevel : public Level { private: diff --git a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerPlayer.cpp b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerPlayer.cpp index f55688e24..f47b82723 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/level/ServerPlayer.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/server/level/ServerPlayer.cpp @@ -8,6 +8,7 @@ #include "Minecraft.Client/net/minecraft/server/Settings.h" #include "Minecraft.Client/net/minecraft/server/PlayerList.h" #include "Minecraft.Client/net/minecraft/client/multiplayer/MultiPlayerLevel.h" +#include "Minecraft.Client/Common/Source Files/Console_Debug_enum.h" #include "Minecraft.World/net/minecraft/network/packet/net.minecraft.network.packet.h" #include "Minecraft.World/net/minecraft/world/damageSource/net.minecraft.world.damagesource.h" @@ -1663,7 +1664,7 @@ int ServerPlayer::getViewDistance() { return viewDistance; } // } Pos* ServerPlayer::getCommandSenderWorldPosition() { - return new Pos(Mth::floor(x), Mth::floor(y + .5), Mth::floor(z)); + return new Pos(std::floor(x), std::floor(y + .5), std::floor(z)); } void ServerPlayer::resetLastActionTime() { diff --git a/minecraft/Minecraft.Client/net/minecraft/server/level/TrackedEntity.cpp b/minecraft/Minecraft.Client/net/minecraft/server/level/TrackedEntity.cpp index 6b40e460b..9ddd8e532 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/level/TrackedEntity.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/server/level/TrackedEntity.cpp @@ -78,13 +78,13 @@ TrackedEntity::TrackedEntity(std::shared_ptr e, int range, this->updateInterval = updateInterval; this->trackDelta = trackDelta; - xp = Mth::floor(e->x * 32); - yp = Mth::floor(e->y * 32); - zp = Mth::floor(e->z * 32); + xp = std::floor(e->x * 32); + yp = std::floor(e->y * 32); + zp = std::floor(e->z * 32); - yRotp = Mth::floor(e->yRot * 256 / 360); - xRotp = Mth::floor(e->xRot * 256 / 360); - yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360); + yRotp = std::floor(e->yRot * 256 / 360); + xRotp = std::floor(e->xRot * 256 / 360); + yHeadRotp = std::floor(e->getYHeadRot() * 256 / 360); } int c0a = 0, c0b = 0, c1a = 0, c1b = 0, c1c = 0, c2a = 0, c2b = 0; @@ -141,8 +141,8 @@ void TrackedEntity::tick(EntityTracker* tracker, } else if (tickCount % updateInterval == 0 || e->hasImpulse || e->getEntityData()->isDirty()) { // 4J: Moved this as it's shared - int yRotn = Mth::floor(e->yRot * 256 / 360); - int xRotn = Mth::floor(e->xRot * 256 / 360); + int yRotn = std::floor(e->yRot * 256 / 360); + int xRotn = std::floor(e->xRot * 256 / 360); // 4J: Changed rotation to be generally sent as a delta as well as // position @@ -152,9 +152,9 @@ void TrackedEntity::tick(EntityTracker* tracker, if (e->riding == nullptr) { teleportDelay++; - int xn = Mth::floor(e->x * 32.0); - int yn = Mth::floor(e->y * 32.0); - int zn = Mth::floor(e->z * 32.0); + int xn = std::floor(e->x * 32.0); + int yn = std::floor(e->y * 32.0); + int zn = std::floor(e->z * 32.0); int xa = xn - xp; int ya = yn - yp; @@ -349,16 +349,16 @@ void TrackedEntity::tick(EntityTracker* tracker, xRotp = xRotn; } - xp = Mth::floor(e->x * 32.0); - yp = Mth::floor(e->y * 32.0); - zp = Mth::floor(e->z * 32.0); + xp = std::floor(e->x * 32.0); + yp = std::floor(e->y * 32.0); + zp = std::floor(e->z * 32.0); sendDirtyEntityData(); wasRiding = true; } - int yHeadRot = Mth::floor(e->getYHeadRot() * 256 / 360); + int yHeadRot = std::floor(e->getYHeadRot() * 256 / 360); if (abs(yHeadRot - yHeadRotp) >= TOLERANCE_LEVEL) { broadcast(std::shared_ptr( new RotateHeadPacket(e->entityId, (uint8_t)yHeadRot))); @@ -664,8 +664,8 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker, std::shared_ptr( new EntityActionAtPositionPacket( e, EntityActionAtPositionPacket::START_SLEEP, - Mth::floor(e->x), Mth::floor(e->y), - Mth::floor(e->z)))); + std::floor(e->x), std::floor(e->y), + std::floor(e->z)))); } } @@ -720,7 +720,7 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { // 4J-PB - replacing with a switch, rather than tons of ifs if (std::dynamic_pointer_cast(e) != nullptr) { - yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360); + yHeadRotp = std::floor(e->getYHeadRot() * 256 / 360); return std::shared_ptr( new AddMobPacket(std::dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp)); @@ -756,7 +756,7 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { return std::make_shared( e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp); } else if (e->instanceof(eTYPE_ENDERDRAGON)) { - yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360); + yHeadRotp = std::floor(e->getYHeadRot() * 256 / 360); return std::shared_ptr( new AddMobPacket(std::dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp)); @@ -851,9 +851,9 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { std::shared_ptr( new AddEntityPacket(e, AddEntityPacket::ITEM_FRAME, frame->dir, yRotp, xRotp, xp, yp, zp)); - packet->x = Mth::floor(frame->xTile * 32.0f); - packet->y = Mth::floor(frame->yTile * 32.0f); - packet->z = Mth::floor(frame->zTile * 32.0f); + packet->x = std::floor(frame->xTile * 32.0f); + packet->y = std::floor(frame->yTile * 32.0f); + packet->z = std::floor(frame->zTile * 32.0f); return packet; } else if (e->instanceof(eTYPE_LEASHFENCEKNOT)) { std::shared_ptr knot = @@ -861,9 +861,9 @@ std::shared_ptr TrackedEntity::getAddEntityPacket() { std::shared_ptr packet = std::make_shared( e, AddEntityPacket::LEASH_KNOT, yRotp, xRotp, xp, yp, zp); - packet->x = Mth::floor((float)knot->xTile * 32); - packet->y = Mth::floor((float)knot->yTile * 32); - packet->z = Mth::floor((float)knot->zTile * 32); + packet->x = std::floor((float)knot->xTile * 32); + packet->y = std::floor((float)knot->yTile * 32); + packet->z = std::floor((float)knot->zTile * 32); return packet; } else if (e->instanceof(eTYPE_EXPERIENCEORB)) { return std::shared_ptr( diff --git a/minecraft/Minecraft.Client/net/minecraft/server/network/PendingConnection.cpp b/minecraft/Minecraft.Client/net/minecraft/server/network/PendingConnection.cpp index caf8cee98..b1b513e37 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/network/PendingConnection.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/server/network/PendingConnection.cpp @@ -19,6 +19,7 @@ #include "Minecraft.World/net/minecraft/network/packet/LoginPacket.h" #include "Minecraft.World/net/minecraft/network/packet/PreLoginPacket.h" #include "Minecraft.World/x64headers/extraX64.h" +#include "Minecraft.Client/Common/Source Files/BuildVer/BuildVer.h" #include "java/Random.h" class Packet; diff --git a/minecraft/Minecraft.Client/net/minecraft/server/network/PlayerConnection.cpp b/minecraft/Minecraft.Client/net/minecraft/server/network/PlayerConnection.cpp index 093bdfcb3..89c861477 100644 --- a/minecraft/Minecraft.Client/net/minecraft/server/network/PlayerConnection.cpp +++ b/minecraft/Minecraft.Client/net/minecraft/server/network/PlayerConnection.cpp @@ -292,7 +292,7 @@ void PlayerConnection::handleMovePlayer( // stance: " + yd); return; } - if (abs(packet->x) > 32000000 || abs(packet->z) > 32000000) { + if (std::abs(packet->x) > 32000000 || std::abs(packet->z) > 32000000) { disconnect(DisconnectPacket::eDisconnect_IllegalPosition); return; } diff --git a/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp b/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp index 0041049cd..ddc2eb2cf 100644 --- a/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp +++ b/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileOriginal.cpp @@ -31,6 +31,7 @@ #include "java/System.h" #include "Minecraft.World/net/minecraft/world/level/chunk/storage/RegionFile.h" #include "Minecraft.World/x64headers/extraX64.h" +#include "platform/PlatformServices.h" #define RESERVE_ALLOCATION MEM_RESERVE #define COMMIT_ALLOCATION MEM_COMMIT diff --git a/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp b/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp index 816b71b15..a8afef389 100644 --- a/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp +++ b/minecraft/Minecraft.World/ConsoleHelpers/ConsoleSaveFileIO/ConsoleSaveFileSplit.cpp @@ -35,6 +35,7 @@ #include "java/System.h" #include "Minecraft.World/net/minecraft/world/level/chunk/storage/RegionFile.h" #include "Minecraft.World/x64headers/extraX64.h" +#include "platform/PlatformServices.h" class ProgressListener; diff --git a/minecraft/Minecraft.World/Header Files/compression.h b/minecraft/Minecraft.World/Header Files/compression.h index 8b3a56576..cbd5b9470 100644 --- a/minecraft/Minecraft.World/Header Files/compression.h +++ b/minecraft/Minecraft.World/Header Files/compression.h @@ -66,8 +66,8 @@ private: int32_t DecompressWithType(void* pDestination, unsigned int* pDestSize, void* pSource, unsigned int SrcSize); - XMEMCOMPRESSION_CONTEXT compressionContext; - XMEMDECOMPRESSION_CONTEXT decompressionContext; + void* compressionContext; + void* decompressionContext; std::mutex rleCompressLock; std::mutex rleDecompressLock; diff --git a/minecraft/Minecraft.World/Header Files/stdafx.h b/minecraft/Minecraft.World/Header Files/stdafx.h index 9ba4fb483..637b23bb7 100644 --- a/minecraft/Minecraft.World/Header Files/stdafx.h +++ b/minecraft/Minecraft.World/Header Files/stdafx.h @@ -4,97 +4,10 @@ // #pragma once -#ifdef _WINDOWS64 -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#include -#include -#include -#include -#endif - -#ifdef __linux__ -#include -#include -#include -#include "Minecraft.Client/Linux/Stubs/LinuxStubs.h" -#else -#include -#include -#include -#include -#endif - -#include - -#include "Minecraft.World/x64headers/extraX64.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "Minecraft.World/ConsoleHelpers/Definitions.h" -#include "java/Class.h" -#include "java/Exceptions.h" -#include "Minecraft.World/net/minecraft/util/Mth.h" -#include "Minecraft.World/ConsoleHelpers/StringHelpers.h" -#include "Minecraft.World/ConsoleHelpers/ArrayWithLength.h" -#include "java/Random.h" -#include "Minecraft.World/net/minecraft/world/level/TilePos.h" -#include "Minecraft.World/net/minecraft/world/level/ChunkPos.h" -#include "Minecraft.World/Header Files/compression.h" -#include "Minecraft.World/ConsoleHelpers/PerformanceTimer.h" - -#ifdef _FINAL_BUILD -#define printf BREAKTHECOMPILE -#define wprintf BREAKTHECOMPILE -#undef OutputDebugString -#define OutputDebugString BREAKTHECOMPILE -#define OutputDebugStringA BREAKTHECOMPILE -#define OutputDebugStringW BREAKTHECOMPILE -#endif - - -#include "platform/PlatformServices.h" - -#include "Minecraft.Client/Common/Source Files/Network/GameNetworkManager.h" - -#include "Minecraft.Client/Common/Source Files/UI/All Platforms/UIEnums.h" -#include "Minecraft.Client/Common/App_Defines.h" -#include "Minecraft.Client/Common/App_enums.h" -#include "Minecraft.Client/Common/Source Files/Tutorial/TutorialEnum.h" -#include "Minecraft.Client/Common/App_structs.h" - -#include "Minecraft.Client/Common/Consoles_App.h" -#include "Minecraft.Client/Common/Minecraft_Macros.h" -#include "Minecraft.Client/Common/Source Files/Colours/ColourTable.h" - -#include "Minecraft.Client/Common/Source Files/BuildVer/BuildVer.h" - -// This is generated at build time via scripts/pack_loc.py -#include "strings.h" - #ifdef _WINDOWS64 #include "Minecraft.Client/Windows64/Windows64_App.h" #else // Use the Linux runtime path with supported metadata/config headers only. #include "Minecraft.Client/Linux/Linux_App.h" +// #include "Minecraft.Client/Linux/Stubs/LinuxStubs.h" #endif - -#include "Minecraft.Client/Common/Source Files/DLC/DLCSkinFile.h" -#include "Minecraft.Client/Common/Source Files/Console_Awards_enum.h" -#include "Minecraft.Client/Common/Potion_Macros.h" -#include "Minecraft.Client/Common/Source Files/Console_Debug_enum.h" -#include "Minecraft.Client/Common/Source Files/GameRules/ConsoleGameRulesConstants.h" -#include "Minecraft.Client/Common/Source Files/GameRules/ConsoleGameRules.h" \ No newline at end of file diff --git a/minecraft/Minecraft.World/meson.build b/minecraft/Minecraft.World/meson.build index a6d9553b2..f8d2bae25 100644 --- a/minecraft/Minecraft.World/meson.build +++ b/minecraft/Minecraft.World/meson.build @@ -40,9 +40,7 @@ lib_world = static_library('Minecraft.World', simdutf_dep, ], include_directories : include_directories('Header Files', '..'), - cpp_args : global_cpp_args + global_cpp_defs + [ - '-include', 'Header Files/stdafx.h', - ], + cpp_args : global_cpp_args + global_cpp_defs, ) zlib_dep = dependency('zlib') diff --git a/minecraft/Minecraft.World/net/minecraft/SharedConstants.h b/minecraft/Minecraft.World/net/minecraft/SharedConstants.h index beead5496..a4ca7e4f0 100644 --- a/minecraft/Minecraft.World/net/minecraft/SharedConstants.h +++ b/minecraft/Minecraft.World/net/minecraft/SharedConstants.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "java/Class.h" class SharedConstants { diff --git a/minecraft/Minecraft.World/net/minecraft/network/packet/PreLoginPacket.cpp b/minecraft/Minecraft.World/net/minecraft/network/packet/PreLoginPacket.cpp index 977d3cee2..1e6e1c20c 100644 --- a/minecraft/Minecraft.World/net/minecraft/network/packet/PreLoginPacket.cpp +++ b/minecraft/Minecraft.World/net/minecraft/network/packet/PreLoginPacket.cpp @@ -8,6 +8,7 @@ #include "Minecraft.Client/Linux/Stubs/winapi_stubs.h" #include "java/InputOutputStream/DataInputStream.h" #include "java/InputOutputStream/DataOutputStream.h" +#include "Minecraft.Client/Common/Source Files/BuildVer/BuildVer.h" PreLoginPacket::PreLoginPacket() { loginKey = L""; diff --git a/minecraft/Minecraft.World/net/minecraft/stats/Achievements.h b/minecraft/Minecraft.World/net/minecraft/stats/Achievements.h index 687a12ae7..2c4fd1c95 100644 --- a/minecraft/Minecraft.World/net/minecraft/stats/Achievements.h +++ b/minecraft/Minecraft.World/net/minecraft/stats/Achievements.h @@ -1,6 +1,7 @@ #pragma once #include +#include class Achievement; diff --git a/minecraft/Minecraft.World/net/minecraft/util/Mth.h b/minecraft/Minecraft.World/net/minecraft/util/Mth.h index 8cd6f78c7..a6d2e6a81 100644 --- a/minecraft/Minecraft.World/net/minecraft/util/Mth.h +++ b/minecraft/Minecraft.World/net/minecraft/util/Mth.h @@ -1,6 +1,8 @@ #pragma once #include +#include +#include class Random; diff --git a/minecraft/Minecraft.World/net/minecraft/util/WeighedRandom.h b/minecraft/Minecraft.World/net/minecraft/util/WeighedRandom.h index 7a152005d..09b0fa350 100644 --- a/minecraft/Minecraft.World/net/minecraft/util/WeighedRandom.h +++ b/minecraft/Minecraft.World/net/minecraft/util/WeighedRandom.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "java/Random.h" // 4J - this WeighedRandomItem class was a nested static class within diff --git a/minecraft/Minecraft.World/net/minecraft/world/Container.h b/minecraft/Minecraft.World/net/minecraft/world/Container.h index 33503eec9..307853445 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/Container.h +++ b/minecraft/Minecraft.World/net/minecraft/world/Container.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + class ItemInstance; class Player; diff --git a/minecraft/Minecraft.World/net/minecraft/world/effect/MobEffect.cpp b/minecraft/Minecraft.World/net/minecraft/world/effect/MobEffect.cpp index b9799fa2a..d3b58cf63 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/effect/MobEffect.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/effect/MobEffect.cpp @@ -366,7 +366,7 @@ std::wstring MobEffect::formatDuration(MobEffectInstance* instance) { seconds %= 60; wchar_t temp[8]; - ZeroMemory(&temp, 8 * (sizeof(wchar_t))); + memset(&temp, 0, 8 * (sizeof(wchar_t))); if (seconds < 10) { swprintf(temp, 8, L"%d:0%d", minutes, seconds); diff --git a/minecraft/Minecraft.World/net/minecraft/world/effect/MobEffect.h b/minecraft/Minecraft.World/net/minecraft/world/effect/MobEffect.h index 2f5102bbf..7e0ab7f2f 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/effect/MobEffect.h +++ b/minecraft/Minecraft.World/net/minecraft/world/effect/MobEffect.h @@ -3,9 +3,13 @@ #include "Minecraft.World/net/minecraft/world/entity/ai/attributes/AttributeModifier.h" #include "Minecraft.Client/Common/App_enums.h" +#include + class Mob; class MobEffectInstance; class Attribute; +class LivingEntity; +class BaseAttributeMap; class MobEffect { public: diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/ai/attributes/Attribute.h b/minecraft/Minecraft.World/net/minecraft/world/entity/ai/attributes/Attribute.h index f9d6a9e7e..f0d336c9b 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/ai/attributes/Attribute.h +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/ai/attributes/Attribute.h @@ -1,6 +1,8 @@ #pragma once class AttributeModifier; +#include + // 4J: This ID is serialised into save data so new attributes must always be // added after existing ones enum eATTRIBUTE_ID { diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/ai/attributes/AttributeInstance.h b/minecraft/Minecraft.World/net/minecraft/world/entity/ai/attributes/AttributeInstance.h index d99a43a86..2492877df 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/ai/attributes/AttributeInstance.h +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/ai/attributes/AttributeInstance.h @@ -1,6 +1,8 @@ #pragma once #include "AttributeModifier.h" +#include + class AttributeInstance { public: virtual ~AttributeInstance() {} diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/ai/control/BodyControl.cpp b/minecraft/Minecraft.World/net/minecraft/world/entity/ai/control/BodyControl.cpp index e1865a174..9c572536a 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/ai/control/BodyControl.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/ai/control/BodyControl.cpp @@ -30,7 +30,7 @@ void BodyControl::clientTick() { // Body will align to head after looking long enough in a direction float clampAngle = maxClampAngle; - if (abs(mob->yHeadRot - lastHeadY) > 15) { + if (std::abs(mob->yHeadRot - lastHeadY) > 15) { timeStill = 0; lastHeadY = mob->yHeadRot; } else { diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/ai/goal/TemptGoal.cpp b/minecraft/Minecraft.World/net/minecraft/world/entity/ai/goal/TemptGoal.cpp index 7c16efd0e..25ea75ae0 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/ai/goal/TemptGoal.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/ai/goal/TemptGoal.cpp @@ -48,8 +48,8 @@ bool TemptGoal::canContinueToUse() { if (mob->distanceToSqr(player.lock()) < 6 * 6) { if (player.lock()->distanceToSqr(px, py, pz) > 0.1 * 0.1) return false; - if (abs(player.lock()->xRot - pRotX) > 5 || - abs(player.lock()->yRot - pRotY) > 5) + if (std::abs(player.lock()->xRot - pRotX) > 5 || + std::abs(player.lock()->yRot - pRotY) > 5) return false; } else { px = player.lock()->x; diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/animal/Ocelot.cpp b/minecraft/Minecraft.World/net/minecraft/world/entity/animal/Ocelot.cpp index a166d4bf3..2c831dac3 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/animal/Ocelot.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/animal/Ocelot.cpp @@ -46,6 +46,7 @@ #include "Minecraft.World/net/minecraft/world/level/Level.h" #include "Minecraft.World/net/minecraft/world/level/tile/Tile.h" #include "Minecraft.World/net/minecraft/world/phys/AABB.h" +#include "platform/PlatformServices.h" const double Ocelot::SNEAK_SPEED_MOD = 0.6; const double Ocelot::WALK_SPEED_MOD = 0.8; diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/boss/MultiEntityMob.h b/minecraft/Minecraft.World/net/minecraft/world/entity/boss/MultiEntityMob.h index 60ebda88f..37d2e30a2 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/boss/MultiEntityMob.h +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/boss/MultiEntityMob.h @@ -1,6 +1,10 @@ #pragma once +#include + +class Level; class MultiEntityMobPart; +class DamageSource; class MultiEntityMob { public: diff --git a/minecraft/Minecraft.World/net/minecraft/world/entity/npc/Villager.cpp b/minecraft/Minecraft.World/net/minecraft/world/entity/npc/Villager.cpp index 4f7d1c14f..71ec9e865 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/entity/npc/Villager.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/entity/npc/Villager.cpp @@ -14,6 +14,7 @@ #include "Minecraft.World/net/minecraft/world/item/trading/net.minecraft.world.item.trading.h" #include "Minecraft.World/net/minecraft/world/level/tile/net.minecraft.world.level.tile.h" #include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" #include "Minecraft.Client/net/minecraft/client/renderer/Textures.h" #include "Villager.h" diff --git a/minecraft/Minecraft.World/net/minecraft/world/inventory/AnvilMenu.cpp b/minecraft/Minecraft.World/net/minecraft/world/inventory/AnvilMenu.cpp index e224b53b1..246580e00 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/inventory/AnvilMenu.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/inventory/AnvilMenu.cpp @@ -4,6 +4,7 @@ #include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h" #include "Minecraft.World/net/minecraft/world/item/net.minecraft.world.item.h" #include "Minecraft.World/net/minecraft/world/item/enchantment/net.minecraft.world.item.enchantment.h" +#include "Minecraft.World/ConsoleHelpers/StringHelpers.h" #include "AnvilMenu.h" AnvilMenu::AnvilMenu(std::shared_ptr inventory, Level* level, int xt, diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/BoatItem.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/BoatItem.cpp index 7c99a55d8..06aa9d74f 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/BoatItem.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/BoatItem.cpp @@ -4,6 +4,7 @@ #include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h" #include "Minecraft.World/net/minecraft/world/level/tile/net.minecraft.world.level.tile.h" #include "Minecraft.World/net/minecraft/world/phys/net.minecraft.world.phys.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" #include "ItemInstance.h" #include "Minecraft.World/net/minecraft/world/phys/Vec3.h" #include "BoatItem.h" diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/DyePowderItem.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/DyePowderItem.cpp index c2e7775e6..f0c0a175c 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/DyePowderItem.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/DyePowderItem.cpp @@ -12,6 +12,7 @@ #include "Minecraft.World/net/minecraft/world/net.minecraft.world.h" #include "Minecraft.World/net/minecraft/world/level/material/Material.h" #include "DyePowderItem.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" DyePowderItem::DyePowderItem(int id) : Item(id) { setStackedByData(true); diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/FireworksItem.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/FireworksItem.cpp index 3ead6fae3..d8829b835 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/FireworksItem.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/FireworksItem.cpp @@ -4,6 +4,7 @@ #include "net.minecraft.world.item.h" #include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h" #include "FireworksItem.h" +#include "Minecraft.World/ConsoleHelpers/StringHelpers.h" const std::wstring FireworksItem::TAG_FIREWORKS = L"Fireworks"; const std::wstring FireworksItem::TAG_EXPLOSION = L"Explosion"; diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/HangingEntityItem.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/HangingEntityItem.cpp index e1e58fde2..d070ff07e 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/HangingEntityItem.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/HangingEntityItem.cpp @@ -101,7 +101,7 @@ void HangingEntityItem::appendHoverText( int motive = itemInstance->getAuxValue() - 1; wchar_t formatted[256]; - ZeroMemory(formatted, 256 * sizeof(wchar_t)); + memset(formatted, 0, 256 * sizeof(wchar_t)); swprintf(formatted, 256, L"** %ls %dx%d", Painting::Motive::values[motive]->name.c_str(), Painting::Motive::values[motive]->w / 16, diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/Item.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/Item.cpp index bd87b82a2..fd15d56ad 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/Item.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/Item.cpp @@ -16,6 +16,7 @@ #include "HangingEntityItem.h" #include "Minecraft.World/net/minecraft/util/HtmlString.h" #include "Minecraft.World/net/minecraft/world/phys/Vec3.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" typedef Item::Tier _Tier; diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/Item.h b/minecraft/Minecraft.World/net/minecraft/world/item/Item.h index 839fa1033..978ccf842 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/Item.h +++ b/minecraft/Minecraft.World/net/minecraft/world/item/Item.h @@ -22,6 +22,8 @@ class EnchantedBookItem; class EmptyMapItem; class LivingEntity; class HtmlString; +class Tile; +class Entity; #define ITEM_ICON_COLUMNS 16 diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/PotionItem.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/PotionItem.cpp index 93946d386..ef16af29b 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/PotionItem.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/PotionItem.cpp @@ -12,6 +12,7 @@ #include "Minecraft.World/net/minecraft/SharedConstants.h" #include "PotionItem.h" #include "Minecraft.World/Header Files/SoundTypes.h" +#include "Minecraft.Client/Common/Potion_Macros.h" const std::wstring PotionItem::DEFAULT_ICON = L"potion"; const std::wstring PotionItem::THROWABLE_ICON = L"potion_splash"; diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/SkullItem.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/SkullItem.cpp index 67264a126..746c52f9c 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/SkullItem.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/SkullItem.cpp @@ -6,6 +6,7 @@ #include "Minecraft.World/net/minecraft/net.minecraft.h" #include "Minecraft.World/net/minecraft/world/net.minecraft.world.h" #include "SkullItem.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" const unsigned int SkullItem::NAMES[SKULL_COUNT] = { IDS_ITEM_SKULL_SKELETON, IDS_ITEM_SKULL_WITHER, IDS_ITEM_SKULL_ZOMBIE, diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/SpawnEggItem.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/SpawnEggItem.cpp index bb13c0539..a1c5c6065 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/SpawnEggItem.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/SpawnEggItem.cpp @@ -10,6 +10,8 @@ #include "Minecraft.World/net/minecraft/world/phys/HitResult.h" #include "SpawnEggItem.h" #include "Minecraft.World/net/minecraft/world/Difficulty.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" +#include "Minecraft.Client/Common/Source Files/Colours/ColourTable.h" SpawnEggItem::SpawnEggItem(int id) : Item(id) { setMaxStackSize(16); // 4J-PB brought forward. It is 64 on PC, but we'll diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/alchemy/PotionBrewing.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/alchemy/PotionBrewing.cpp index 99df735a4..24e8f903c 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/alchemy/PotionBrewing.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/alchemy/PotionBrewing.cpp @@ -4,6 +4,7 @@ #include "java/JavaMath.h" #include "Minecraft.World/net/minecraft/SharedConstants.h" #include "PotionBrewing.h" +#include "Minecraft.Client/Common/Source Files/Colours/ColourTable.h" const int PotionBrewing::DEFAULT_APPEARANCES[] = { IDS_POTION_PREFIX_MUNDANE, IDS_POTION_PREFIX_UNINTERESTING, diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/crafting/Recipy.h b/minecraft/Minecraft.World/net/minecraft/world/item/crafting/Recipy.h index 760bc2a15..ff952b792 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/crafting/Recipy.h +++ b/minecraft/Minecraft.World/net/minecraft/world/item/crafting/Recipy.h @@ -6,6 +6,7 @@ #pragma once #include "Minecraft.World/net/minecraft/world/inventory/CraftingContainer.h" +#include "4J.Common/4J_Compat.h" #define RECIPE_TYPE_2x2 0 #define RECIPE_TYPE_3x3 1 diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/enchantment/Enchantment.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/enchantment/Enchantment.cpp index c23bc16c3..e6cd50fe7 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/enchantment/Enchantment.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/enchantment/Enchantment.cpp @@ -88,7 +88,7 @@ void Enchantment::_init(int id) { if (enchantments[id] != nullptr) { app.DebugPrintf("Duplicate enchantment id!"); #ifndef _CONTENT_PACKAGE - __debugbreak(); + assert(0); #endif // throw new IllegalArgumentException("Duplicate enchantment id!"); } diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/enchantment/Enchantment.h b/minecraft/Minecraft.World/net/minecraft/world/item/enchantment/Enchantment.h index 37452c8aa..e130f3dd6 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/enchantment/Enchantment.h +++ b/minecraft/Minecraft.World/net/minecraft/world/item/enchantment/Enchantment.h @@ -1,8 +1,14 @@ #pragma once +#include +#include + #include "EnchantmentCategory.h" +#include "Minecraft.World/net/minecraft/util/HtmlString.h" class DamageSource; +class LivingEntity; +class ItemInstance; class Mob; class Enchantment // implements Descriptive { diff --git a/minecraft/Minecraft.World/net/minecraft/world/item/enchantment/ProtectionEnchantment.cpp b/minecraft/Minecraft.World/net/minecraft/world/item/enchantment/ProtectionEnchantment.cpp index dc4a45851..62ef03605 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/item/enchantment/ProtectionEnchantment.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/item/enchantment/ProtectionEnchantment.cpp @@ -2,6 +2,7 @@ #include "Minecraft.World/net/minecraft/world/damageSource/net.minecraft.world.damagesource.h" #include "net.minecraft.world.item.enchantment.h" #include "Minecraft.World/net/minecraft/world/entity/net.minecraft.world.entity.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" #include "ProtectionEnchantment.h" const int ProtectionEnchantment::names[] = { diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/Level.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/Level.cpp index 3c4c75c64..b2d501216 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/Level.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/Level.cpp @@ -65,6 +65,7 @@ #include "net/minecraft/world/phys/Vec3.h" #include "net/minecraft/world/scores/Scoreboard.h" #include "Minecraft.World/x64headers/extraX64.h" +#include "platform/PlatformServices.h" class CompoundTag; class ItemInstance; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/Level.h b/minecraft/Minecraft.World/net/minecraft/world/level/Level.h index 901b50deb..916a2f0e2 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/Level.h +++ b/minecraft/Minecraft.World/net/minecraft/world/level/Level.h @@ -74,33 +74,33 @@ public: using lightCache_t = unsigned int; #endif - static const int MAX_TICK_TILES_PER_TICK = 1000; + static constexpr int MAX_TICK_TILES_PER_TICK = 1000; // 4J Added - static const int MAX_GRASS_TICKS = 100; - static const int MAX_LAVA_TICKS = 100; + static constexpr int MAX_GRASS_TICKS = 100; + static constexpr int MAX_LAVA_TICKS = 100; public: - static const int MAX_XBOX_BOATS = 40; // Max number of boats - static const int MAX_CONSOLE_MINECARTS = 40; - static const int MAX_DISPENSABLE_FIREBALLS = 200; - static const int MAX_DISPENSABLE_PROJECTILES = 300; + static constexpr int MAX_XBOX_BOATS = 40; // Max number of boats + static constexpr int MAX_CONSOLE_MINECARTS = 40; + static constexpr int MAX_DISPENSABLE_FIREBALLS = 200; + static constexpr int MAX_DISPENSABLE_PROJECTILES = 300; - static const int MAX_LEVEL_SIZE = 30000000; - static const int maxMovementHeight = 512; // 4J added + static constexpr int MAX_LEVEL_SIZE = 30000000; + static constexpr int maxMovementHeight = 512; // 4J added - static const int minBuildHeight = 0; // 4J - brought forward from 1.2.3 - static const int maxBuildHeight = 256; // 4J - brought forward from 1.2.3 - static const int genDepthBits = 7; - static const int genDepthBitsPlusFour = genDepthBits + 4; - static const int genDepth = 1 << genDepthBits; - static const int genDepthMinusOne = genDepth - 1; - static const int constSeaLevel = genDepth / 2 - 1; + static constexpr int minBuildHeight = 0; // 4J - brought forward from 1.2.3 + static constexpr int maxBuildHeight = 256; // 4J - brought forward from 1.2.3 + static constexpr int genDepthBits = 7; + static constexpr int genDepthBitsPlusFour = genDepthBits + 4; + static constexpr int genDepth = 1 << genDepthBits; + static constexpr int genDepthMinusOne = genDepth - 1; + static constexpr int constSeaLevel = genDepth / 2 - 1; - static const int CHUNK_TILE_COUNT = maxBuildHeight * 16 * 16; - static const int HALF_CHUNK_TILE_COUNT = CHUNK_TILE_COUNT / 2; - static const int COMPRESSED_CHUNK_SECTION_HEIGHT = 128; - static const int COMPRESSED_CHUNK_SECTION_TILES = + static constexpr int CHUNK_TILE_COUNT = maxBuildHeight * 16 * 16; + static constexpr int HALF_CHUNK_TILE_COUNT = CHUNK_TILE_COUNT / 2; + static constexpr int COMPRESSED_CHUNK_SECTION_HEIGHT = 128; + static constexpr int COMPRESSED_CHUNK_SECTION_TILES = COMPRESSED_CHUNK_SECTION_HEIGHT * 16 * 16; // 4J Stu - Fixed size int seaLevel; @@ -116,8 +116,8 @@ public: static void setInstaTick(bool enable); // bool instaTick; // 4J - removed - static const int MAX_BRIGHTNESS = 15; - static const int TICKS_PER_DAY = 20 * 60 * 20; // ORG:20*60*20 + static constexpr int MAX_BRIGHTNESS = 15; + static constexpr int TICKS_PER_DAY = 20 * 60 * 20; // ORG:20*60*20 public: std::recursive_mutex m_entitiesCS; // 4J added @@ -307,21 +307,21 @@ public: LightLayer::variety layer); bool cachewritten; - static const int LIGHTING_SHIFT = 24; - static const int BLOCKING_SHIFT = 20; - static const int EMISSION_SHIFT = 16; + static constexpr int LIGHTING_SHIFT = 24; + static constexpr int BLOCKING_SHIFT = 20; + static constexpr int EMISSION_SHIFT = 16; #if defined(_LARGE_WORLDS) - static const int64_t LIGHTING_WRITEBACK = 0x80000000LL; - static const int64_t EMISSION_VALID = 0x40000000LL; - static const int64_t BLOCKING_VALID = 0x20000000LL; - static const int64_t LIGHTING_VALID = 0x10000000LL; - static const lightCache_t POSITION_MASK = 0xffffffff0000ffffLL; + static constexpr int64_t LIGHTING_WRITEBACK = 0x80000000LL; + static constexpr int64_t EMISSION_VALID = 0x40000000LL; + static constexpr int64_t BLOCKING_VALID = 0x20000000LL; + static constexpr int64_t LIGHTING_VALID = 0x10000000LL; + static constexpr lightCache_t POSITION_MASK = 0xffffffff0000ffffLL; #else - static const int LIGHTING_WRITEBACK = 0x80000000; - static const int EMISSION_VALID = 0x40000000; - static const int BLOCKING_VALID = 0x20000000; - static const int LIGHTING_VALID = 0x10000000; - static const lightCache_t POSITION_MASK = 0x0000ffff; + static constexpr int LIGHTING_WRITEBACK = 0x80000000; + static constexpr int EMISSION_VALID = 0x40000000; + static constexpr int BLOCKING_VALID = 0x20000000; + static constexpr int LIGHTING_VALID = 0x10000000; + static constexpr lightCache_t POSITION_MASK = 0x0000ffff; #endif int cacheminx, cachemaxx, cacheminy, cachemaxy, cacheminz, cachemaxz; @@ -472,9 +472,9 @@ protected: private: int delayUntilNextMoodSound; - static const int CHUNK_POLL_RANGE = 9; - static const int CHUNK_TILE_TICK_COUNT = 80; - static const int CHUNK_SECTION_TILE_TICK_COUNT = + static constexpr int CHUNK_POLL_RANGE = 9; + static constexpr int CHUNK_TILE_TICK_COUNT = 80; + static constexpr int CHUNK_SECTION_TILE_TICK_COUNT = (CHUNK_TILE_TICK_COUNT / 8) + 1; protected: diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/LevelSource.h b/minecraft/Minecraft.World/net/minecraft/world/level/LevelSource.h index ac8b144b3..72f69fa28 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/LevelSource.h +++ b/minecraft/Minecraft.World/net/minecraft/world/level/LevelSource.h @@ -1,8 +1,11 @@ #pragma once +#include + class BiomeSource; class Material; class TileEntity; +class Biome; #include "LightLayer.h" diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/biome/BiomeSource.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/biome/BiomeSource.cpp index 2a6b36b64..8eebdb21a 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/biome/BiomeSource.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/biome/BiomeSource.cpp @@ -7,6 +7,8 @@ #include "BiomeSource.h" #include "Minecraft.Client/net/minecraft/client/Minecraft.h" #include "Minecraft.Client/net/minecraft/client/ProgressRenderer.h" +#include "Minecraft.Client/Common/Source Files/Console_Debug_enum.h" +#include "platform/PlatformServices.h" // 4J - removal of separate temperature & downfall layers brought forward // from 1.2.3 @@ -151,7 +153,7 @@ void BiomeSource::getRawBiomeBlock(std::vector& biomes, int x, int z, in #if !defined(_CONTENT_PACKAGE) if (biomes[i] == nullptr) { app.DebugPrintf("Tried to assign null biome %d\n", result[i]); - __debugbreak(); + assert(0); } #endif } diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp index 432271684..73e41eafe 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/McRegionChunkStorage.cpp @@ -29,6 +29,7 @@ #include "Minecraft.World/net/minecraft/world/level/chunk/storage/OldChunkStorage.h" #include "Minecraft.World/net/minecraft/world/level/chunk/storage/RegionFileCache.h" #include "Minecraft.World/x64headers/extraX64.h" +#include "platform/PlatformServices.h" class DataInput; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/OldChunkStorage.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/OldChunkStorage.cpp index 37cf2148e..66a1275ba 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/OldChunkStorage.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/chunk/storage/OldChunkStorage.cpp @@ -29,6 +29,7 @@ #include "Minecraft.World/net/minecraft/world/level/storage/LevelData.h" #include "Minecraft.World/net/minecraft/world/level/tile/entity/TileEntity.h" #include "Minecraft.World/x64headers/extraX64.h" +#include "platform/PlatformServices.h" thread_local OldChunkStorage::ThreadStorage* OldChunkStorage::m_tlsStorage = nullptr; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/dimension/Dimension.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/dimension/Dimension.cpp index 112ae923e..74f193c0a 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/dimension/Dimension.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/dimension/Dimension.cpp @@ -22,6 +22,7 @@ #include "Minecraft.World/net/minecraft/world/level/levelgen/flat/FlatGeneratorInfo.h" #include "Minecraft.World/net/minecraft/world/level/storage/LevelData.h" #include "Minecraft.World/net/minecraft/world/level/tile/Tile.h" +#include "platform/PlatformServices.h" class Pos; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/dimension/HellDimension.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/dimension/HellDimension.cpp index fc767e2b8..8675b839b 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/dimension/HellDimension.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/dimension/HellDimension.cpp @@ -14,6 +14,7 @@ #include "Minecraft.World/net/minecraft/world/level/levelgen/HellRandomLevelSource.h" #include "Minecraft.World/net/minecraft/world/level/storage/LevelData.h" #include "Minecraft.World/net/minecraft/world/phys/Vec3.h" +#include "platform/PlatformServices.h" void HellDimension::init() { biomeSource = new FixedBiomeSource(Biome::hell, 1, 0); diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/BoundingBox.h b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/BoundingBox.h index b88ab7593..8d3acc4ad 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/BoundingBox.h +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/BoundingBox.h @@ -1,6 +1,7 @@ #pragma once #include "Minecraft.World/ConsoleHelpers/ArrayWithLength.h" +#include "nbt/IntArrayTag.h" class BoundingBox { public: diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/MineShaftPieces.h b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/MineShaftPieces.h index f3be51c3f..a607d1f35 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/MineShaftPieces.h +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/MineShaftPieces.h @@ -6,6 +6,7 @@ #include "StructurePiece.h" #include "Minecraft.World/net/minecraft/world/level/levelgen/structure/StructureFeatureIO.h" #include "Minecraft.World/net/minecraft/world/level/levelgen/structure/StructurePiece.h" +#include "nbt/CompoundTag.h" class BoundingBox; class Random; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/StructureFeatureIO.h b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/StructureFeatureIO.h index f4aba2c98..30726fca4 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/StructureFeatureIO.h +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/StructureFeatureIO.h @@ -1,5 +1,9 @@ #pragma once +#include + +#include "nbt/CompoundTag.h" + class StructurePiece; class StructureStart; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/StructurePiece.h b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/StructurePiece.h index f5264afe3..c0e7f5dd4 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/StructurePiece.h +++ b/minecraft/Minecraft.World/net/minecraft/world/level/levelgen/structure/StructurePiece.h @@ -5,6 +5,7 @@ #include "Minecraft.World/net/minecraft/util/WeighedRandom.h" #include "BoundingBox.h" #include "StructureFeatureIO.h" +#include "nbt/CompoundTag.h" class Level; class Random; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/newbiome/layer/Layer.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/newbiome/layer/Layer.cpp index b1e82b6c9..3e25534f3 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/newbiome/layer/Layer.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/newbiome/layer/Layer.cpp @@ -23,6 +23,7 @@ #include "Minecraft.World/net/minecraft/world/level/newbiome/layer/SwampRiversLayer.h" #include "Minecraft.World/net/minecraft/world/level/newbiome/layer/VoronoiZoom.h" #include "Minecraft.World/net/minecraft/world/level/newbiome/layer/ZoomLayer.h" +#include "platform/PlatformServices.h" std::vector> Layer::getDefaultLayers(int64_t seed, LevelType* levelType) { // 4J - Some changes moved here from 1.2.3. Temperature & downfall layers diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/storage/DirectoryLevelStorage.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/storage/DirectoryLevelStorage.cpp index 192915b45..8a8de42eb 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/storage/DirectoryLevelStorage.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/storage/DirectoryLevelStorage.cpp @@ -38,6 +38,7 @@ #include "Minecraft.World/net/minecraft/world/level/storage/LevelStorage.h" #include "Minecraft.World/net/minecraft/world/level/storage/PlayerIO.h" #include "Minecraft.World/x64headers/extraX64.h" +#include "platform/PlatformServices.h" const std::wstring DirectoryLevelStorage::sc_szPlayerDir(L"players/"); diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/tile/AnvilTile.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/tile/AnvilTile.cpp index 7672b4e7c..dc096de2d 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/tile/AnvilTile.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/tile/AnvilTile.cpp @@ -6,6 +6,7 @@ #include "Minecraft.World/net/minecraft/world/net.minecraft.world.h" #include "Minecraft.World/net/minecraft/net.minecraft.h" #include "AnvilTile.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" const unsigned int AnvilTile::ANVIL_NAMES[ANVIL_NAMES_LENGTH] = { IDS_TILE_ANVIL_INTACT, diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/tile/ChestTile.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/tile/ChestTile.cpp index 88705fe4e..e8187f0fb 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/tile/ChestTile.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/tile/ChestTile.cpp @@ -10,6 +10,7 @@ #include "Minecraft.World/net/minecraft/world/phys/net.minecraft.world.phys.h" #include "ChestTile.h" #include "Minecraft.World/net/minecraft/Facing.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" ChestTile::ChestTile(int id, int type) : BaseEntityTile(id, Material::wood, false) { diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/tile/ChestTile.h b/minecraft/Minecraft.World/net/minecraft/world/level/tile/ChestTile.h index a25502287..970787770 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/tile/ChestTile.h +++ b/minecraft/Minecraft.World/net/minecraft/world/level/tile/ChestTile.h @@ -4,6 +4,7 @@ class Player; class Random; +class Container; class ChestTile : public BaseEntityTile { friend class Tile; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/tile/LeafTile.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/tile/LeafTile.cpp index f4749be63..1a510ae48 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/tile/LeafTile.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/tile/LeafTile.cpp @@ -6,6 +6,7 @@ #include "Minecraft.World/net/minecraft/world/item/net.minecraft.world.item.h" #include "Minecraft.World/net/minecraft/stats/net.minecraft.stats.h" #include "Minecraft.World/net/minecraft/world/net.minecraft.world.h" +#include "Minecraft.Client/Common/Source Files/Colours/ColourTable.h" const unsigned int LeafTile::LEAF_NAMES[LEAF_NAMES_LENGTH] = { IDS_TILE_LEAVES_OAK, diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/tile/SkullTile.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/tile/SkullTile.cpp index d8a000064..1f47623d1 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/tile/SkullTile.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/tile/SkullTile.cpp @@ -7,6 +7,8 @@ #include "Minecraft.World/net/minecraft/world/entity/boss/wither/WitherBoss.h" #include "Minecraft.World/net/minecraft/net.minecraft.h" #include "SkullTile.h" +#include "Minecraft.World/ConsoleHelpers/StringHelpers.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" SkullTile::SkullTile(int id) : BaseEntityTile(id, Material::decoration, false) { setShape(4.0f / 16.0f, 0, 4.0f / 16.0f, 12.0f / 16.0f, .5f, 12.0f / 16.0f); diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/tile/TallGrassPlantTile.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/tile/TallGrassPlantTile.cpp index a69310d8d..36c3ed36a 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/tile/TallGrassPlantTile.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/tile/TallGrassPlantTile.cpp @@ -6,6 +6,7 @@ #include "Minecraft.World/net/minecraft/stats/net.minecraft.stats.h" #include "Minecraft.World/net/minecraft/world/net.minecraft.world.h" #include "TallGrassPlantTile.h" +#include "Minecraft.Client/Common/Source Files/Colours/ColourTable.h" const unsigned int TallGrass::TALL_GRASS_TILE_NAMES[TALL_GRASS_TILE_NAMES_LENGTH] = { diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/tile/Tile.h b/minecraft/Minecraft.World/net/minecraft/world/level/tile/Tile.h index 5579d4a21..ffab6ad7c 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/tile/Tile.h +++ b/minecraft/Minecraft.World/net/minecraft/world/level/tile/Tile.h @@ -5,6 +5,8 @@ #include "Minecraft.World/Header Files/SoundTypes.h" #include #include +#include +#include class GrassTile; class LeafTile; @@ -40,8 +42,11 @@ class TileEntity; class HalfSlabTile; class Icon; class IconRegister; - +class Explosion; class ChunkRebuildData; +class Entity; +class ItemInstance; +class LivingEntity; class Tile { // 4J Stu - Stair tile accesses the protected members of a Tile object diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp index 410add4b9..fb0d5432e 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/BrewingStandTileEntity.cpp @@ -6,6 +6,7 @@ #include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h" #include "Minecraft.World/net/minecraft/world/item/net.minecraft.world.item.h" #include "Minecraft.World/net/minecraft/world/item/alchemy/net.minecraft.world.item.alchemy.h" +#include "Minecraft.Client/Common/Potion_Macros.h" int slotsForUp[] = {BrewingStandTileEntity::INGREDIENT_SLOT}; int slotsForOtherFaces[] = {0, 1, 2}; diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp index 6ee8f161f..40177c2c4 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/EnchantmentTableTileEntity.cpp @@ -1,3 +1,5 @@ +#include + #include "Minecraft.World/Header Files/stdafx.h" #include "EnchantmentTableTileEntity.h" #include "Minecraft.World/net/minecraft/world/entity/player/net.minecraft.world.entity.player.h" diff --git a/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/HopperTileEntity.cpp b/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/HopperTileEntity.cpp index 2c8767b2f..73401af85 100644 --- a/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/HopperTileEntity.cpp +++ b/minecraft/Minecraft.World/net/minecraft/world/level/tile/entity/HopperTileEntity.cpp @@ -9,6 +9,7 @@ #include "Minecraft.World/net/minecraft/world/phys/net.minecraft.world.phys.h" #include "Minecraft.World/net/minecraft/world/net.minecraft.world.h" #include "HopperTileEntity.h" +#include "Minecraft.World/net/minecraft/util/Mth.h" HopperTileEntity::HopperTileEntity() { items = std::vector>(5);