mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-21 05:12:55 +00:00
refactor: revert GameMath rename back to Mth
This commit is contained in:
parent
72ae771560
commit
e942d0d472
|
|
@ -5,7 +5,7 @@
|
|||
#include "../../../net/minecraft/client/multiplayer/MultiPlayerLocalPlayer.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/storage/LevelData.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "../../../net/minecraft/client/skins/TexturePackRepository.h"
|
||||
#include "../../../net/minecraft/client/skins/DLCTexturePack.h"
|
||||
#include "../DLC/DLCAudioFile.h"
|
||||
|
|
@ -733,8 +733,8 @@ void SoundEngine::tick(shared_ptr<Mob>* players, float a) {
|
|||
|
||||
float yRot = players[i]->yRotO +
|
||||
(players[i]->yRot - players[i]->yRotO) * a;
|
||||
float yCos = (float)cos(yRot * GameMath::DEG_TO_RAD);
|
||||
float ySin = (float)sin(yRot * GameMath::DEG_TO_RAD);
|
||||
float yCos = (float)cos(yRot * Mth::DEG_TO_RAD);
|
||||
float ySin = (float)sin(yRot * Mth::DEG_TO_RAD);
|
||||
|
||||
// store the listener positions for splitscreen
|
||||
m_ListenerA[i].vPosition.x = x;
|
||||
|
|
@ -1111,8 +1111,8 @@ void SoundEngine::tick(std::shared_ptr<Mob>* players, float a) {
|
|||
|
||||
float yRot = players[i]->yRotO +
|
||||
(players[i]->yRot - players[i]->yRotO) * a;
|
||||
float yCos = (float)cos(-yRot * GameMath::DEG_TO_RAD - std::numbers::pi);
|
||||
float ySin = (float)sin(-yRot * GameMath::DEG_TO_RAD - std::numbers::pi);
|
||||
float yCos = (float)cos(-yRot * Mth::DEG_TO_RAD - std::numbers::pi);
|
||||
float ySin = (float)sin(-yRot * Mth::DEG_TO_RAD - std::numbers::pi);
|
||||
|
||||
// store the listener positions for splitscreen
|
||||
m_ListenerA[i].vPosition.x = x;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
|
||||
#include "java/Random.h"
|
||||
#include "../../../../../net/minecraft/client/User.h"
|
||||
|
|
@ -347,7 +347,7 @@ void UIScene_MainMenu::customDrawSplash(IggyCustomDrawCallbackRegion* region) {
|
|||
glTranslatef(xo, yo, 0);
|
||||
|
||||
glRotatef(-17, 0, 0, 1);
|
||||
float sss = 1.8f - GameMath::abs(sinf(System::currentTimeMillis() % 1000 /
|
||||
float sss = 1.8f - Mth::abs(sinf(System::currentTimeMillis() % 1000 /
|
||||
1000.0f * std::numbers::pi * 2) *
|
||||
0.1f);
|
||||
sss *= (m_fScreenWidth / m_fRawWidth);
|
||||
|
|
|
|||
|
|
@ -3559,9 +3559,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(GameMath::floor(player->x),
|
||||
GameMath::floor(player->y),
|
||||
GameMath::floor(player->z));
|
||||
levels[i]->animateTick(Mth::floor(player->x),
|
||||
Mth::floor(player->y),
|
||||
Mth::floor(player->z));
|
||||
|
||||
if (levelsTickedFlags & (1 << i))
|
||||
continue; // Don't tick further if we've already ticked this
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
|||
double totalAbsorption =
|
||||
minecraft->localplayers[iPad]->getAbsorptionAmount();
|
||||
int NUM_HEARTS_PER_ROW = 10; // 4jcraft: missing definition
|
||||
int numHealthRows = GameMath::ceil((maxHealth + totalAbsorption) /
|
||||
int numHealthRows = Mth::ceil((maxHealth + totalAbsorption) /
|
||||
2 / (float)NUM_HEARTS_PER_ROW);
|
||||
int healthRowHeight = max(10 - (numHealthRows - 2), 3);
|
||||
yLine2 = yLine1 - (numHealthRows - 1) * healthRowHeight - 10;
|
||||
|
|
@ -516,7 +516,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
|||
}
|
||||
|
||||
// minecraft.profiler.popPush("health");
|
||||
for (int i = GameMath::ceil((maxHealth + totalAbsorption) / 2) - 1;
|
||||
for (int i = Mth::ceil((maxHealth + totalAbsorption) / 2) - 1;
|
||||
i >= 0; i--) {
|
||||
int healthTexBaseX = 16;
|
||||
if (minecraft->player->hasEffect(MobEffect::poison)) {
|
||||
|
|
@ -529,7 +529,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
|||
int bg = 0;
|
||||
if (blink) bg = 1;
|
||||
int rowIndex =
|
||||
GameMath::ceil((i + 1) / (float)NUM_HEARTS_PER_ROW) - 1;
|
||||
Mth::ceil((i + 1) / (float)NUM_HEARTS_PER_ROW) - 1;
|
||||
int xo = xLeft + (i % NUM_HEARTS_PER_ROW) * 8;
|
||||
int yo = yLine1 - rowIndex * healthRowHeight;
|
||||
if (currentHealth <= 4) {
|
||||
|
|
@ -1010,15 +1010,15 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth
|
|||
font,
|
||||
L"f: " +
|
||||
_toString<double>(
|
||||
GameMath::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) &
|
||||
Mth::floor(minecraft->player->yRot * 4.0f / 360.0f + 0.5) &
|
||||
0x3) +
|
||||
L"/ yRot: " + _toString<double>(minecraft->player->yRot),
|
||||
iSafezoneXHalf + 2, iYPos + 8 * 3, 0xe0e0e0);
|
||||
iYPos += 8 * 4;
|
||||
|
||||
int px = GameMath::floor(minecraft->player->x);
|
||||
int py = GameMath::floor(minecraft->player->y);
|
||||
int pz = GameMath::floor(minecraft->player->z);
|
||||
int px = Mth::floor(minecraft->player->x);
|
||||
int py = Mth::floor(minecraft->player->y);
|
||||
int pz = Mth::floor(minecraft->player->z);
|
||||
if (minecraft->level != nullptr &&
|
||||
minecraft->level->hasChunkAt(px, py, pz)) {
|
||||
LevelChunk* chunkAt = minecraft->level->getChunkAt(px, pz);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "BlazeModel.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "BookModel.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "ChickenModel.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "CreeperModel.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "java/Random.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "GhastModel.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "HumanoidModel.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/Entity.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
|
|
@ -324,7 +324,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 = -GameMath::abs(cosf(eating_t / 4.0f * std::numbers::pi) * 0.1f) *
|
||||
arm0->xRot = -Mth::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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "LavaSlimeModel.h"
|
||||
#include "geom/ModelPart.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/monster/LavaSlime.h"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/animal/net.minecraft.world.entity.animal.h"
|
||||
#include "ModelHorse.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
|
@ -450,7 +450,7 @@ void ModelHorse::prepareMobModel(std::shared_ptr<LivingEntity> mob, float wp,
|
|||
// animations
|
||||
{
|
||||
// TODO: Magic numbers
|
||||
Head->xRot = standing * ((15 * GameMath::DEG_TO_RAD) + (HeadXRot)) +
|
||||
Head->xRot = standing * ((15 * Mth::DEG_TO_RAD) + (HeadXRot)) +
|
||||
eating * 2.18166f +
|
||||
(1.0f - std::max(standing, eating)) * Head->xRot;
|
||||
Head->yRot = standing * (headRotMinusBodyRot / 57.29578f) +
|
||||
|
|
@ -515,8 +515,8 @@ void ModelHorse::prepareMobModel(std::shared_ptr<LivingEntity> mob, float wp,
|
|||
{
|
||||
float r90 = std::numbers::pi * .5f;
|
||||
float r270 = std::numbers::pi * 1.5f;
|
||||
float r300 = -60 * GameMath::DEG_TO_RAD;
|
||||
float standAngle = 15 * GameMath::DEG_TO_RAD * standing;
|
||||
float r300 = -60 * Mth::DEG_TO_RAD;
|
||||
float standAngle = 15 * Mth::DEG_TO_RAD * standing;
|
||||
float bobValue = cosf((bob * 0.6f) + 3.141593f);
|
||||
|
||||
Leg3A->y = -2.f * standing + 9.f * iStanding;
|
||||
|
|
@ -553,14 +553,14 @@ void ModelHorse::prepareMobModel(std::shared_ptr<LivingEntity> mob, float wp,
|
|||
|
||||
Leg1A->xRot = standAngle + (-legAnim1 * 0.5f * ws) * iStanding;
|
||||
Leg1B->xRot =
|
||||
(-5 * GameMath::DEG_TO_RAD) * standing +
|
||||
(-5 * Mth::DEG_TO_RAD) * standing +
|
||||
((-legAnim1 * 0.5f * ws) - std::max(0.0f, legAnim1 * .5f * ws)) *
|
||||
iStanding;
|
||||
Leg1C->xRot = Leg1B->xRot;
|
||||
|
||||
Leg2A->xRot = standAngle + (legAnim1 * 0.5f * ws) * iStanding;
|
||||
Leg2B->xRot =
|
||||
(-5 * GameMath::DEG_TO_RAD) * standing +
|
||||
(-5 * Mth::DEG_TO_RAD) * standing +
|
||||
((legAnim1 * 0.5f * ws) - std::max(0.0f, -legAnim1 * .5f * ws)) *
|
||||
iStanding;
|
||||
Leg2C->xRot = Leg2B->xRot;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "geom/ModelPart.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/animal/net.minecraft.world.entity.animal.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "OcelotModel.h"
|
||||
|
||||
const float OcelotModel::xo = 0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "QuadrupedModel.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
QuadrupedModel::QuadrupedModel(int legSize, float g) : Model() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "SilverfishModel.h"
|
||||
#include "geom/Cube.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
const int SilverfishModel::BODY_SIZES[BODY_COUNT][3] = {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "SkeletonModel.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/monster/net.minecraft.world.entity.monster.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "SnowManModel.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
SnowManModel::SnowManModel() : Model() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "SpiderModel.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
SpiderModel::SpiderModel() : Model() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "SquidModel.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
SquidModel::SquidModel() : Model() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "VillagerModel.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
void VillagerModel::_init(float g, float yOffset, int xTexSize, int yTexSize) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "geom/ModelPart.h"
|
||||
#include "VillagerZombieModel.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
|
||||
void VillagerZombieModel::_init(float g, float yOffset, bool isArmor) {
|
||||
delete head;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "geom/ModelPart.h"
|
||||
#include "WitchModel.h"
|
||||
#include "VillagerModel.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.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);
|
||||
|
|
@ -19,24 +19,24 @@ WitchModel::WitchModel(float g) : VillagerModel(g, 0, 64, 128) {
|
|||
hat2->setTexSize(64, 128);
|
||||
hat2->setPos(1.75f, -4, 2.f);
|
||||
hat2->texOffs(0, 76)->addBox(0, 0, 0, 7, 4, 7);
|
||||
hat2->xRot = -3.f * GameMath::DEG_TO_RAD;
|
||||
hat2->zRot = 1.5f * GameMath::DEG_TO_RAD;
|
||||
hat2->xRot = -3.f * Mth::DEG_TO_RAD;
|
||||
hat2->zRot = 1.5f * Mth::DEG_TO_RAD;
|
||||
hat->addChild(hat2);
|
||||
|
||||
ModelPart* hat3 = new ModelPart(this);
|
||||
hat3->setTexSize(64, 128);
|
||||
hat3->setPos(1.75f, -4, 2.f);
|
||||
hat3->texOffs(0, 87)->addBox(0, 0, 0, 4, 4, 4);
|
||||
hat3->xRot = -6.f * GameMath::DEG_TO_RAD;
|
||||
hat3->zRot = 3.f * GameMath::DEG_TO_RAD;
|
||||
hat3->xRot = -6.f * Mth::DEG_TO_RAD;
|
||||
hat3->zRot = 3.f * Mth::DEG_TO_RAD;
|
||||
hat2->addChild(hat3);
|
||||
|
||||
ModelPart* hat4 = new ModelPart(this);
|
||||
hat4->setTexSize(64, 128);
|
||||
hat4->setPos(1.75f, -2, 2.f);
|
||||
hat4->texOffs(0, 95)->addBox(0, 0, 0, 1, 2, 1, 0.25f);
|
||||
hat4->xRot = -12.f * GameMath::DEG_TO_RAD;
|
||||
hat4->zRot = 6.f * GameMath::DEG_TO_RAD;
|
||||
hat4->xRot = -12.f * Mth::DEG_TO_RAD;
|
||||
hat4->zRot = 6.f * Mth::DEG_TO_RAD;
|
||||
hat3->addChild(hat4);
|
||||
|
||||
// 4J added - compile now to avoid random performance hit first time cubes
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "WolfModel.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/animal/Wolf.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
WolfModel::WolfModel() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "ZombieModel.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "geom/ModelPart.h"
|
||||
|
||||
ZombieModel::ZombieModel() : HumanoidModel(0, 0, 64, 32) {}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "DragonModel.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/boss/enderdragon/EnderDragon.h"
|
||||
|
||||
DragonModel::DragonModel(float g) : Model() {
|
||||
|
|
|
|||
|
|
@ -2579,9 +2579,9 @@ void ClientConnection::handleContainerOpen(
|
|||
}
|
||||
} break;
|
||||
case ContainerOpenPacket::WORKBENCH: {
|
||||
if (player->startCrafting(GameMath::floor(player->x),
|
||||
GameMath::floor(player->y),
|
||||
GameMath::floor(player->z))) {
|
||||
if (player->startCrafting(Mth::floor(player->x),
|
||||
Mth::floor(player->y),
|
||||
Mth::floor(player->z))) {
|
||||
player->containerMenu->containerId = packet->containerId;
|
||||
} else {
|
||||
failed = true;
|
||||
|
|
@ -2589,8 +2589,8 @@ void ClientConnection::handleContainerOpen(
|
|||
} break;
|
||||
case ContainerOpenPacket::ENCHANTMENT: {
|
||||
if (player->startEnchanting(
|
||||
GameMath::floor(player->x), GameMath::floor(player->y),
|
||||
GameMath::floor(player->z),
|
||||
Mth::floor(player->x), Mth::floor(player->y),
|
||||
Mth::floor(player->z),
|
||||
packet->customName ? packet->title : L"")) {
|
||||
player->containerMenu->containerId = packet->containerId;
|
||||
} else {
|
||||
|
|
@ -2621,9 +2621,9 @@ void ClientConnection::handleContainerOpen(
|
|||
}
|
||||
} break;
|
||||
case ContainerOpenPacket::REPAIR_TABLE: {
|
||||
if (player->startRepairing(GameMath::floor(player->x),
|
||||
GameMath::floor(player->y),
|
||||
GameMath::floor(player->z))) {
|
||||
if (player->startRepairing(Mth::floor(player->x),
|
||||
Mth::floor(player->y),
|
||||
Mth::floor(player->z))) {
|
||||
player->containerMenu->containerId = packet->containerId;
|
||||
} else {
|
||||
failed = true;
|
||||
|
|
@ -2655,9 +2655,9 @@ void ClientConnection::handleContainerOpen(
|
|||
}
|
||||
} break;
|
||||
case ContainerOpenPacket::FIREWORKS: {
|
||||
if (player->openFireworks(GameMath::floor(player->x),
|
||||
GameMath::floor(player->y),
|
||||
GameMath::floor(player->z))) {
|
||||
if (player->openFireworks(Mth::floor(player->x),
|
||||
Mth::floor(player->y),
|
||||
Mth::floor(player->z))) {
|
||||
player->containerMenu->containerId = packet->containerId;
|
||||
} else {
|
||||
failed = true;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "ClientConnection.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
|
||||
#include "Minecraft.World/net/minecraft/network/net.minecraft.network.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/net/minecraft/world/phys/AABB.h"
|
||||
#include "Minecraft.World/net/minecraft/stats/net.minecraft.stats.h"
|
||||
#include "Minecraft.World/net/minecraft/world/inventory/net.minecraft.world.inventory.h"
|
||||
|
|
@ -61,7 +61,7 @@ void MultiplayerLocalPlayer::tick() {
|
|||
);
|
||||
}*/
|
||||
|
||||
if (!level->hasChunkAt(GameMath::floor(x), 0, GameMath::floor(z))) return;
|
||||
if (!level->hasChunkAt(Mth::floor(x), 0, Mth::floor(z))) return;
|
||||
|
||||
double tempX = x, tempY = y, tempZ = z;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "BubbleParticle.h"
|
||||
#include "java/Random.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "java/JavaMath.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/material/net.minecraft.world.level.material.h"
|
||||
|
|
@ -35,7 +35,7 @@ void BubbleParticle::tick() {
|
|||
yd *= 0.85f;
|
||||
zd *= 0.85f;
|
||||
|
||||
if (level->getMaterial(GameMath::floor(x), GameMath::floor(y), GameMath::floor(z)) !=
|
||||
if (level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z)) !=
|
||||
Material::water)
|
||||
remove();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "Minecraft.World/net/minecraft/world/level/material/net.minecraft.world.level.material.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/tile/net.minecraft.world.level.tile.h"
|
||||
#include "java/JavaMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "DripParticle.h"
|
||||
|
||||
DripParticle::DripParticle(Level* level, double x, double y, double z,
|
||||
|
|
@ -119,11 +119,11 @@ void DripParticle::tick() {
|
|||
}
|
||||
|
||||
Material* m =
|
||||
level->getMaterial(GameMath::floor(x), GameMath::floor(y), GameMath::floor(z));
|
||||
level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z));
|
||||
if (m->isLiquid() || m->isSolid()) {
|
||||
double y0 = GameMath::floor(y) + 1 -
|
||||
double y0 = Mth::floor(y) + 1 -
|
||||
LiquidTile::getHeight(level->getData(
|
||||
GameMath::floor(x), GameMath::floor(y), GameMath::floor(z)));
|
||||
Mth::floor(x), Mth::floor(y), Mth::floor(z)));
|
||||
if (y < y0) {
|
||||
remove();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "FootstepParticle.h"
|
||||
#include "../renderer/Textures.h"
|
||||
#include "../renderer/Tesselator.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
|
||||
#include "../resources/ResourceLocation.h"
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ void FootstepParticle::render(Tesselator* t, float a, float xa, float ya,
|
|||
float zz = (float)(z - zOff);
|
||||
|
||||
float br =
|
||||
level->getBrightness(GameMath::floor(x), GameMath::floor(y), GameMath::floor(z));
|
||||
level->getBrightness(Mth::floor(x), Mth::floor(y), Mth::floor(z));
|
||||
|
||||
textures->bindTexture(&FOOTPRINT_LOCATION);
|
||||
glEnable(GL_BLEND);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "NoteParticle.h"
|
||||
|
||||
void NoteParticle::init(Level* level, double x, double y, double z, double xa,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "Particle.h"
|
||||
#include "../renderer/Tesselator.h"
|
||||
#include "java/Random.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "java/JavaMath.h"
|
||||
#include "Minecraft.World/net/minecraft/world/net.minecraft.world.h"
|
||||
|
||||
|
|
@ -56,7 +56,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)(GameMath::sqrt(xd * xd + yd * yd + zd * zd));
|
||||
float dd = (float)(Mth::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;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "java/Random.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
|
||||
#include "java/JavaMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/material/net.minecraft.world.level.material.h"
|
||||
|
||||
SuspendedParticle::SuspendedParticle(Level* level, double x, double y, double z,
|
||||
|
|
@ -38,7 +38,7 @@ void SuspendedParticle::tick() {
|
|||
|
||||
move(xd, yd, zd);
|
||||
|
||||
if (level->getMaterial(GameMath::floor(x), GameMath::floor(y), GameMath::floor(z)) !=
|
||||
if (level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z)) !=
|
||||
Material::water)
|
||||
remove();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "../renderer/entity/EntityRenderDispatcher.h"
|
||||
#include "Minecraft.World/net/minecraft/world/item/net.minecraft.world.item.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
|
||||
TakeAnimationParticle::TakeAnimationParticle(Level* level,
|
||||
std::shared_ptr<Entity> item,
|
||||
|
|
@ -40,9 +40,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 = GameMath::floor(xx);
|
||||
int yTile = GameMath::floor(yy + heightOffset / 2.0f);
|
||||
int zTile = GameMath::floor(zz);
|
||||
int xTile = Mth::floor(xx);
|
||||
int yTile = Mth::floor(yy + heightOffset / 2.0f);
|
||||
int zTile = Mth::floor(zz);
|
||||
|
||||
// 4J - change brought forward from 1.8.2
|
||||
if (SharedConstants::TEXTURE_LIGHTING) {
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ void WaterDropParticle::tick() {
|
|||
}
|
||||
|
||||
Material* m =
|
||||
level->getMaterial(GameMath::floor(x), GameMath::floor(y), GameMath::floor(z));
|
||||
level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z));
|
||||
if (m->isLiquid() || m->isSolid()) {
|
||||
double y0 = GameMath::floor(y) + 1 -
|
||||
double y0 = Mth::floor(y) + 1 -
|
||||
LiquidTile::getHeight(level->getData(
|
||||
GameMath::floor(x), GameMath::floor(y), GameMath::floor(z)));
|
||||
Mth::floor(x), Mth::floor(y), Mth::floor(z)));
|
||||
if (y < y0) {
|
||||
remove();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#include "nbt/com.mojang.nbt.h"
|
||||
#include "java/Random.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/tile/entity/TileEntity.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "../gui/achievement/AchievementPopup.h"
|
||||
#include "../particle/CritParticle.h"
|
||||
|
||||
|
|
@ -1094,9 +1094,9 @@ bool LocalPlayer::isSolidBlock(int x, int y, int z) {
|
|||
}
|
||||
|
||||
bool LocalPlayer::checkInTile(double x, double y, double z) {
|
||||
int xTile = GameMath::floor(x);
|
||||
int yTile = GameMath::floor(y);
|
||||
int zTile = GameMath::floor(z);
|
||||
int xTile = Mth::floor(x);
|
||||
int yTile = Mth::floor(y);
|
||||
int zTile = Mth::floor(z);
|
||||
|
||||
double xd = x - xTile;
|
||||
double zd = z - zTile;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "RemotePlayer.h"
|
||||
#include "Minecraft.World/net/minecraft/world/item/net.minecraft.world.item.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
|
||||
RemotePlayer::RemotePlayer(Level* level, const std::wstring& name)
|
||||
: Player(level, name) {
|
||||
|
|
@ -46,7 +46,7 @@ void RemotePlayer::tick() {
|
|||
walkAnimSpeedO = walkAnimSpeed;
|
||||
double xxd = x - xo;
|
||||
double zzd = z - zo;
|
||||
float wst = GameMath::sqrt(xxd * xxd + zzd * zzd) * 4;
|
||||
float wst = Mth::sqrt(xxd * xxd + zzd * zzd) * 4;
|
||||
if (wst > 1) wst = 1;
|
||||
walkAnimSpeed += (wst - walkAnimSpeed) * 0.4f;
|
||||
walkAnimPos += walkAnimSpeed;
|
||||
|
|
@ -98,7 +98,7 @@ void RemotePlayer::aiStep() {
|
|||
}
|
||||
oBob = bob;
|
||||
|
||||
float tBob = (float)GameMath::sqrt(xd * xd + zd * zd);
|
||||
float tBob = (float)Mth::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;
|
||||
|
|
|
|||
|
|
@ -212,9 +212,9 @@ void GameRenderer::tick(bool first) // 4J - add bFirst
|
|||
mc->cameraTargetPlayer = std::dynamic_pointer_cast<Mob>(mc->player);
|
||||
}
|
||||
|
||||
float brr = mc->level->getBrightness(GameMath::floor(mc->cameraTargetPlayer->x),
|
||||
GameMath::floor(mc->cameraTargetPlayer->y),
|
||||
GameMath::floor(mc->cameraTargetPlayer->z));
|
||||
float brr = mc->level->getBrightness(Mth::floor(mc->cameraTargetPlayer->x),
|
||||
Mth::floor(mc->cameraTargetPlayer->y),
|
||||
Mth::floor(mc->cameraTargetPlayer->z));
|
||||
float whiteness = (3 - mc->options->viewDistance) / 3.0f;
|
||||
float fogBrT = brr * (1 - whiteness) + whiteness;
|
||||
fogBr += (fogBrT - fogBr) * 0.1f;
|
||||
|
|
@ -450,12 +450,12 @@ void GameRenderer::moveCameraToPlayer(float a) {
|
|||
glTranslatef(0.0f, 0.3f, 0);
|
||||
if (!mc->options->fixedCamera) {
|
||||
int t =
|
||||
mc->level->getTile(GameMath::floor(player->x), GameMath::floor(player->y),
|
||||
GameMath::floor(player->z));
|
||||
mc->level->getTile(Mth::floor(player->x), Mth::floor(player->y),
|
||||
Mth::floor(player->z));
|
||||
if (t == Tile::bed_Id) {
|
||||
int data = mc->level->getData(GameMath::floor(player->x),
|
||||
GameMath::floor(player->y),
|
||||
GameMath::floor(player->z));
|
||||
int data = mc->level->getData(Mth::floor(player->x),
|
||||
Mth::floor(player->y),
|
||||
Mth::floor(player->z));
|
||||
|
||||
int direction = data & 3;
|
||||
glRotatef((float)direction * 90, 0.0f, 1.0f, 0.0f);
|
||||
|
|
@ -1522,9 +1522,9 @@ void GameRenderer::tickRain() {
|
|||
std::shared_ptr<LivingEntity> player = mc->cameraTargetPlayer;
|
||||
Level* level = mc->level;
|
||||
|
||||
int x0 = GameMath::floor(player->x);
|
||||
int y0 = GameMath::floor(player->y);
|
||||
int z0 = GameMath::floor(player->z);
|
||||
int x0 = Mth::floor(player->x);
|
||||
int y0 = Mth::floor(player->y);
|
||||
int z0 = Mth::floor(player->z);
|
||||
|
||||
int r = 10;
|
||||
|
||||
|
|
@ -1575,9 +1575,9 @@ void GameRenderer::tickRain() {
|
|||
rainSoundTime = 0;
|
||||
MemSect(24);
|
||||
if (rainPosY > player->y + 1 &&
|
||||
level->getTopRainBlock(GameMath::floor(player->x),
|
||||
GameMath::floor(player->z)) >
|
||||
GameMath::floor(player->y)) {
|
||||
level->getTopRainBlock(Mth::floor(player->x),
|
||||
Mth::floor(player->z)) >
|
||||
Mth::floor(player->y)) {
|
||||
mc->level->playLocalSound(rainPosX, rainPosY, rainPosZ,
|
||||
eSoundType_AMBIENT_WEATHER_RAIN, 0.1f,
|
||||
0.5f);
|
||||
|
|
@ -1608,7 +1608,7 @@ void GameRenderer::renderSnowAndRain(float a) {
|
|||
for (int x = 0; x < 32; x++) {
|
||||
float xa = x - 16;
|
||||
float za = z - 16;
|
||||
float d = GameMath::sqrt(xa * xa + za * za);
|
||||
float d = Mth::sqrt(xa * xa + za * za);
|
||||
rainXa[z << 5 | x] = -za / d;
|
||||
rainZa[z << 5 | x] = xa / d;
|
||||
}
|
||||
|
|
@ -1618,9 +1618,9 @@ void GameRenderer::renderSnowAndRain(float a) {
|
|||
std::shared_ptr<LivingEntity> player = mc->cameraTargetPlayer;
|
||||
Level* level = mc->level;
|
||||
|
||||
int x0 = GameMath::floor(player->x);
|
||||
int y0 = GameMath::floor(player->y);
|
||||
int z0 = GameMath::floor(player->z);
|
||||
int x0 = Mth::floor(player->x);
|
||||
int y0 = Mth::floor(player->y);
|
||||
int z0 = Mth::floor(player->z);
|
||||
|
||||
Tesselator* t = Tesselator::getInstance();
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
|
@ -1638,7 +1638,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 = GameMath::floor(yo);
|
||||
int yMin = Mth::floor(yo);
|
||||
|
||||
int r = 5;
|
||||
// 4J - was if(mc.options.fancyGraphics) r = 10;
|
||||
|
|
@ -1703,7 +1703,7 @@ void GameRenderer::renderSnowAndRain(float a) {
|
|||
|
||||
double xd = (x + 0.5f) - player->x;
|
||||
double zd = (z + 0.5f) - player->z;
|
||||
float dd = (float)GameMath::sqrt(xd * xd + zd * zd) / r;
|
||||
float dd = (float)Mth::sqrt(xd * xd + zd * zd) / r;
|
||||
|
||||
float br = 1.0f;
|
||||
float s = 1.0f;
|
||||
|
|
|
|||
|
|
@ -432,13 +432,13 @@ void ItemInHandRenderer::render(float a) {
|
|||
std::shared_ptr<ItemInstance> item = selectedItem;
|
||||
|
||||
float br = minecraft->level->getBrightness(
|
||||
GameMath::floor(player->x), GameMath::floor(player->y), GameMath::floor(player->z));
|
||||
Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z));
|
||||
// 4J - change brought forward from 1.8.2
|
||||
if (SharedConstants::TEXTURE_LIGHTING) {
|
||||
br = 1;
|
||||
int col = minecraft->level->getLightColor(GameMath::floor(player->x),
|
||||
GameMath::floor(player->y),
|
||||
GameMath::floor(player->z), 0);
|
||||
int col = minecraft->level->getLightColor(Mth::floor(player->x),
|
||||
Mth::floor(player->y),
|
||||
Mth::floor(player->z), 0);
|
||||
int u = col % 65536;
|
||||
int v = col / 65536;
|
||||
#if defined(__linux__)
|
||||
|
|
@ -603,7 +603,7 @@ void ItemInHandRenderer::render(float a) {
|
|||
is = is * is * is;
|
||||
float iss = 1 - is;
|
||||
glTranslatef(0,
|
||||
GameMath::abs(cosf(t / 4 * std::numbers::pi) * 0.1f) *
|
||||
Mth::abs(cosf(t / 4 * std::numbers::pi) * 0.1f) *
|
||||
(swing > 0.2 ? 1 : 0),
|
||||
0);
|
||||
glTranslatef(iss * 0.6f, -iss * 0.5f, 0);
|
||||
|
|
@ -769,9 +769,9 @@ void ItemInHandRenderer::renderScreenEffect(float a) {
|
|||
|
||||
if (minecraft->player->isInWall()) // Inside a tile
|
||||
{
|
||||
int x = GameMath::floor(minecraft->player->x);
|
||||
int y = GameMath::floor(minecraft->player->y);
|
||||
int z = GameMath::floor(minecraft->player->z);
|
||||
int x = Mth::floor(minecraft->player->x);
|
||||
int y = Mth::floor(minecraft->player->y);
|
||||
int z = Mth::floor(minecraft->player->z);
|
||||
|
||||
int tile = minecraft->level->getTile(x, y, z);
|
||||
if (minecraft->level->isSolidBlockingTile(x, y, z)) {
|
||||
|
|
@ -784,9 +784,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 = GameMath::floor(x + xo);
|
||||
int yt = GameMath::floor(y + yo);
|
||||
int zt = GameMath::floor(z + zo);
|
||||
int xt = Mth::floor(x + xo);
|
||||
int yt = Mth::floor(y + yo);
|
||||
int zt = Mth::floor(z + zo);
|
||||
if (minecraft->level->isSolidBlockingTile(xt, yt, zt)) {
|
||||
tile = minecraft->level->getTile(xt, yt, zt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -499,8 +499,8 @@ void LevelRenderer::allChanged(int playerIndex) {
|
|||
if (level[playerIndex] != nullptr) {
|
||||
std::shared_ptr<Entity> player = mc->cameraTargetPlayer;
|
||||
if (player != nullptr) {
|
||||
this->resortChunks(GameMath::floor(player->x), GameMath::floor(player->y),
|
||||
GameMath::floor(player->z));
|
||||
this->resortChunks(Mth::floor(player->x), Mth::floor(player->y),
|
||||
Mth::floor(player->z));
|
||||
// sort(sortedChunks[playerIndex]->begin(),sortedChunks[playerIndex]->end(),
|
||||
// DistanceChunkSorter(player)); // 4J - removed - not sorting
|
||||
// our chunks anymore
|
||||
|
|
@ -597,8 +597,8 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) {
|
|||
!mc->cameraTargetPlayer->isSleeping())
|
||||
continue;
|
||||
|
||||
if (!level[playerIndex]->hasChunkAt(GameMath::floor(entity->x), 0,
|
||||
GameMath::floor(entity->z))) {
|
||||
if (!level[playerIndex]->hasChunkAt(Mth::floor(entity->x), 0,
|
||||
Mth::floor(entity->z))) {
|
||||
continue;
|
||||
}
|
||||
renderedEntities++;
|
||||
|
|
@ -731,8 +731,8 @@ int LevelRenderer::render(std::shared_ptr<LivingEntity> player, int layer,
|
|||
yOld[playerIndex] = player->y;
|
||||
zOld[playerIndex] = player->z;
|
||||
|
||||
resortChunks(GameMath::floor(player->x), GameMath::floor(player->y),
|
||||
GameMath::floor(player->z));
|
||||
resortChunks(Mth::floor(player->x), Mth::floor(player->y),
|
||||
Mth::floor(player->z));
|
||||
// sort(sortedChunks[playerIndex]->begin(),sortedChunks[playerIndex]->end(),
|
||||
// DistanceChunkSorter(player)); // 4J - removed - not sorting
|
||||
// our chunks anymore
|
||||
|
|
@ -1176,8 +1176,8 @@ void LevelRenderer::renderClouds(float alpha) {
|
|||
double zo =
|
||||
mc->cameraTargetPlayer->zo +
|
||||
(mc->cameraTargetPlayer->z - mc->cameraTargetPlayer->zo) * alpha;
|
||||
int xOffs = GameMath::floor(xo / 2048);
|
||||
int zOffs = GameMath::floor(zo / 2048);
|
||||
int xOffs = Mth::floor(xo / 2048);
|
||||
int zOffs = Mth::floor(zo / 2048);
|
||||
xo -= xOffs * 2048;
|
||||
zo -= zOffs * 2048;
|
||||
|
||||
|
|
@ -1419,8 +1419,8 @@ void LevelRenderer::renderAdvancedClouds(float alpha) {
|
|||
0.33f;
|
||||
float yy = (float)(level[playerIndex]->dimension->getCloudHeight() - yOffs +
|
||||
0.33f);
|
||||
int xOffs = GameMath::floor(xo / 2048);
|
||||
int zOffs = GameMath::floor(zo / 2048);
|
||||
int xOffs = Mth::floor(xo / 2048);
|
||||
int zOffs = Mth::floor(zo / 2048);
|
||||
xo -= xOffs * 2048;
|
||||
zo -= zOffs * 2048;
|
||||
|
||||
|
|
@ -1468,16 +1468,16 @@ void LevelRenderer::renderAdvancedClouds(float alpha) {
|
|||
|
||||
float scale = 1 / 256.0f;
|
||||
|
||||
uo = (float)(GameMath::floor(xo)) * scale;
|
||||
vo = (float)(GameMath::floor(zo)) * scale;
|
||||
uo = (float)(Mth::floor(xo)) * scale;
|
||||
vo = (float)(Mth::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 - GameMath::floor(xo));
|
||||
float zoffs = (float)(zo - GameMath::floor(zo));
|
||||
float xoffs = (float)(xo - Mth::floor(xo));
|
||||
float zoffs = (float)(zo - Mth::floor(zo));
|
||||
|
||||
int D = 8;
|
||||
|
||||
|
|
@ -2278,12 +2278,12 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1,
|
|||
// come from when connection is being ticked outside of normal level tick,
|
||||
// and player won't be set up
|
||||
if (level == nullptr) level = this->level[mc->player->GetXboxPad()];
|
||||
int _x0 = GameMath::intFloorDiv(x0, CHUNK_XZSIZE);
|
||||
int _y0 = GameMath::intFloorDiv(y0, CHUNK_SIZE);
|
||||
int _z0 = GameMath::intFloorDiv(z0, CHUNK_XZSIZE);
|
||||
int _x1 = GameMath::intFloorDiv(x1, CHUNK_XZSIZE);
|
||||
int _y1 = GameMath::intFloorDiv(y1, CHUNK_SIZE);
|
||||
int _z1 = GameMath::intFloorDiv(z1, CHUNK_XZSIZE);
|
||||
int _x0 = Mth::intFloorDiv(x0, CHUNK_XZSIZE);
|
||||
int _y0 = Mth::intFloorDiv(y0, CHUNK_SIZE);
|
||||
int _z0 = Mth::intFloorDiv(z0, CHUNK_XZSIZE);
|
||||
int _x1 = Mth::intFloorDiv(x1, CHUNK_XZSIZE);
|
||||
int _y1 = Mth::intFloorDiv(y1, CHUNK_SIZE);
|
||||
int _z1 = Mth::intFloorDiv(z1, CHUNK_XZSIZE);
|
||||
|
||||
for (int x = _x0; x <= _x1; x++) {
|
||||
for (int y = _y0; y <= _y1; y++) {
|
||||
|
|
@ -3608,10 +3608,10 @@ int LevelRenderer::getGlobalIndexForChunk(int x, int y, int z,
|
|||
// int xx = ( x / CHUNK_XZSIZE ) + ( MAX_LEVEL_RENDER_SIZE[dimIdx] / 2 );
|
||||
// int yy = y / CHUNK_SIZE;
|
||||
// int zz = ( z / CHUNK_XZSIZE ) + ( MAX_LEVEL_RENDER_SIZE[dimIdx] / 2 );
|
||||
int xx = (GameMath::intFloorDiv(x, CHUNK_XZSIZE)) +
|
||||
int xx = (Mth::intFloorDiv(x, CHUNK_XZSIZE)) +
|
||||
(MAX_LEVEL_RENDER_SIZE[dimIdx] / 2);
|
||||
int yy = GameMath::intFloorDiv(y, CHUNK_SIZE);
|
||||
int zz = (GameMath::intFloorDiv(z, CHUNK_XZSIZE)) +
|
||||
int yy = Mth::intFloorDiv(y, CHUNK_SIZE);
|
||||
int zz = (Mth::intFloorDiv(z, CHUNK_XZSIZE)) +
|
||||
(MAX_LEVEL_RENDER_SIZE[dimIdx] / 2);
|
||||
|
||||
if ((xx < 0) || (xx >= MAX_LEVEL_RENDER_SIZE[dimIdx])) return -1;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "ViewportCuller.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
|
||||
ViewportCuller::Face::Face(double x, double y, double z, float yRot,
|
||||
float xRot) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "ArrowRenderer.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/projectile/net.minecraft.world.entity.projectile.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
|
||||
ResourceLocation ArrowRenderer::ARROW_LOCATION =
|
||||
ResourceLocation(TN_ITEM_ARROWS);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "BoatRenderer.h"
|
||||
#include "../../model/BoatModel.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/item/net.minecraft.world.entity.item.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
|
||||
ResourceLocation BoatRenderer::BOAT_LOCATION = ResourceLocation(TN_ITEM_BOAT);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "ChickenRenderer.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/animal/net.minecraft.world.entity.animal.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "CreeperRenderer.h"
|
||||
#include "../../model/CreeperModel.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/monster/net.minecraft.world.entity.monster.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
|
||||
ResourceLocation CreeperRenderer::POWER_LOCATION =
|
||||
ResourceLocation(TN_POWERED_CREEPER);
|
||||
|
|
|
|||
|
|
@ -224,12 +224,12 @@ void EntityRenderDispatcher::prepare(
|
|||
this->crosshairPickMob = crosshairPickMob;
|
||||
|
||||
if (player->isSleeping()) {
|
||||
int t = level->getTile(GameMath::floor(player->x), GameMath::floor(player->y),
|
||||
GameMath::floor(player->z));
|
||||
int t = level->getTile(Mth::floor(player->x), Mth::floor(player->y),
|
||||
Mth::floor(player->z));
|
||||
if (t == Tile::bed_Id) {
|
||||
int data =
|
||||
level->getData(GameMath::floor(player->x), GameMath::floor(player->y),
|
||||
GameMath::floor(player->z));
|
||||
level->getData(Mth::floor(player->x), Mth::floor(player->y),
|
||||
Mth::floor(player->z));
|
||||
|
||||
int direction = data & 3;
|
||||
playerRotY = (float)(direction * 90 + 180);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include "Minecraft.World/net/minecraft/world/entity/net.minecraft.world.entity.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/Level.h"
|
||||
#include "Minecraft.World/net/minecraft/world/phys/AABB.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/animal/net.minecraft.world.entity.animal.h"
|
||||
|
||||
ResourceLocation EntityRenderer::SHADOW_LOCATION =
|
||||
|
|
@ -175,12 +175,12 @@ void EntityRenderer::renderShadow(std::shared_ptr<Entity> e, double x, double y,
|
|||
}
|
||||
double ez = e->zOld + (e->z - e->zOld) * a;
|
||||
|
||||
int x0 = GameMath::floor(ex - r);
|
||||
int x1 = GameMath::floor(ex + r);
|
||||
int y0 = GameMath::floor(ey - r);
|
||||
int y1 = GameMath::floor(ey);
|
||||
int z0 = GameMath::floor(ez - r);
|
||||
int z1 = GameMath::floor(ez + r);
|
||||
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);
|
||||
|
||||
double xo = x - ex;
|
||||
double yo = y - ey;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "Minecraft.World/net/minecraft/world/item/net.minecraft.world.item.h"
|
||||
#include "../Tesselator.h"
|
||||
#include "EntityRenderDispatcher.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "java/JavaMath.h"
|
||||
|
||||
ResourceLocation ExperienceOrbRenderer::XP_ORB_LOCATION =
|
||||
|
|
|
|||
|
|
@ -39,28 +39,28 @@ void FallingTileRenderer::render(std::shared_ptr<Entity> _tile, double x,
|
|||
tileRenderer->level = level;
|
||||
Tesselator* t = Tesselator::getInstance();
|
||||
t->begin();
|
||||
t->offset(-GameMath::floor(tile->x) - 0.5f, -GameMath::floor(tile->y) - 0.5f,
|
||||
-GameMath::floor(tile->z) - 0.5f);
|
||||
t->offset(-Mth::floor(tile->x) - 0.5f, -Mth::floor(tile->y) - 0.5f,
|
||||
-Mth::floor(tile->z) - 0.5f);
|
||||
tileRenderer->tesselateAnvilInWorld(
|
||||
(AnvilTile*)tt, GameMath::floor(tile->x), GameMath::floor(tile->y),
|
||||
GameMath::floor(tile->z), tile->data);
|
||||
(AnvilTile*)tt, Mth::floor(tile->x), Mth::floor(tile->y),
|
||||
Mth::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(-GameMath::floor(tile->x) - 0.5f, -GameMath::floor(tile->y) - 0.5f,
|
||||
-GameMath::floor(tile->z) - 0.5f);
|
||||
tileRenderer->tesselateInWorld(tt, GameMath::floor(tile->x),
|
||||
GameMath::floor(tile->y),
|
||||
GameMath::floor(tile->z));
|
||||
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(0, 0, 0);
|
||||
t->end();
|
||||
} else if (tt != nullptr) {
|
||||
tileRenderer->setShape(tt);
|
||||
tileRenderer->renderBlock(tt, level, GameMath::floor(tile->x),
|
||||
GameMath::floor(tile->y), GameMath::floor(tile->z),
|
||||
tileRenderer->renderBlock(tt, level, Mth::floor(tile->x),
|
||||
Mth::floor(tile->y), Mth::floor(tile->z),
|
||||
tile->data);
|
||||
}
|
||||
glEnable(GL_LIGHTING);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "Minecraft.World/net/minecraft/world/entity/projectile/net.minecraft.world.entity.projectile.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/player/net.minecraft.world.entity.player.h"
|
||||
#include "Minecraft.World/net/minecraft/world/phys/Vec3.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "../../multiplayer/MultiPlayerLocalPlayer.h"
|
||||
|
||||
ResourceLocation FishingHookRenderer::PARTICLE_LOCATION =
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ void ItemFrameRenderer::drawItem(std::shared_ptr<ItemFrame> entity) {
|
|||
ct->rota = 0;
|
||||
ct->updateFromPosition(
|
||||
entity->level, entity->x, entity->z,
|
||||
GameMath::wrapDegrees((float)(180 + entity->dir * 90)), false, true);
|
||||
Mth::wrapDegrees((float)(180 + entity->dir * 90)), false, true);
|
||||
ct->rot = compassRot;
|
||||
ct->rota = compassRotA;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ void ItemRenderer::render(std::shared_ptr<Entity> _itemEntity, double x,
|
|||
sinf((itemEntity->age + a) / 10.0f + itemEntity->bobOffs) * 0.1f +
|
||||
0.1f;
|
||||
float spin =
|
||||
((itemEntity->age + a) / 20.0f + itemEntity->bobOffs) * GameMath::RAD_TO_DEG;
|
||||
((itemEntity->age + a) / 20.0f + itemEntity->bobOffs) * Mth::RAD_TO_DEG;
|
||||
|
||||
int count = 1;
|
||||
if (itemEntity->getItem()->count > 1) count = 2;
|
||||
|
|
@ -211,7 +211,7 @@ void ItemRenderer::renderItemBillboard(std::shared_ptr<ItemEntity> entity,
|
|||
glRotatef(180, 0, 1, 0);
|
||||
} else {
|
||||
glRotatef(
|
||||
((entity->age + a) / 20.0f + entity->bobOffs) * GameMath::RAD_TO_DEG, 0,
|
||||
((entity->age + a) / 20.0f + entity->bobOffs) * Mth::RAD_TO_DEG, 0,
|
||||
1, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "EntityRenderDispatcher.h"
|
||||
#include "../../multiplayer/MultiPlayerLocalPlayer.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/projectile/Arrow.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/player/Player.h"
|
||||
|
||||
ResourceLocation LivingEntityRenderer::ENCHANT_GLINT_LOCATION =
|
||||
|
|
@ -53,7 +53,7 @@ void LivingEntityRenderer::render(std::shared_ptr<Entity> _mob, double x,
|
|||
std::dynamic_pointer_cast<LivingEntity>(mob->riding);
|
||||
bodyRot = rotlerp(riding->yBodyRotO, riding->yBodyRot, a);
|
||||
|
||||
float headDiff = GameMath::wrapDegrees(headRot - bodyRot);
|
||||
float headDiff = Mth::wrapDegrees(headRot - bodyRot);
|
||||
if (headDiff < -85) headDiff = -85;
|
||||
if (headDiff >= 85) headDiff = +85;
|
||||
bodyRot = headRot - headDiff;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "Minecraft.World/net/minecraft/world/entity/player/net.minecraft.world.entity.player.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/projectile/net.minecraft.world.entity.projectile.h"
|
||||
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "EntityRenderDispatcher.h"
|
||||
|
||||
MobRenderer::MobRenderer(Model* model, float shadow)
|
||||
|
|
@ -37,9 +37,9 @@ void MobRenderer::renderLeash(std::shared_ptr<Mob> entity, double x, double y,
|
|||
y -= (1.6 - entity->bbHeight) * .5;
|
||||
Tesselator* tessellator = Tesselator::getInstance();
|
||||
double roperYRot =
|
||||
lerp(roper->yRotO, roper->yRot, a * .5f) * GameMath::DEG_TO_RAD;
|
||||
lerp(roper->yRotO, roper->yRot, a * .5f) * Mth::DEG_TO_RAD;
|
||||
double roperXRot =
|
||||
lerp(roper->xRotO, roper->xRot, a * .5f) * GameMath::DEG_TO_RAD;
|
||||
lerp(roper->xRotO, roper->xRot, a * .5f) * Mth::DEG_TO_RAD;
|
||||
double rotOffCos = cos(roperYRot);
|
||||
double rotOffSin = sin(roperYRot);
|
||||
double yOff = sin(roperXRot);
|
||||
|
|
@ -58,7 +58,7 @@ void MobRenderer::renderLeash(std::shared_ptr<Mob> entity, double x, double y,
|
|||
(rotOffCos * 0.5 * swingOff);
|
||||
|
||||
double entityYRot =
|
||||
lerp(entity->yBodyRotO, entity->yBodyRot, a) * GameMath::DEG_TO_RAD +
|
||||
lerp(entity->yBodyRotO, entity->yBodyRot, a) * Mth::DEG_TO_RAD +
|
||||
std::numbers::pi * .5;
|
||||
rotOffCos = cos(entityYRot) * entity->bbWidth * .4;
|
||||
rotOffSin = sin(entityYRot) * entity->bbWidth * .4;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "Minecraft.World/net/minecraft/world/entity/net.minecraft.world.entity.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
|
||||
#include "java/Random.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
|
||||
ResourceLocation PaintingRenderer::PAINTING_LOCATION(TN_ART_KZ);
|
||||
|
||||
|
|
@ -118,13 +118,13 @@ void PaintingRenderer::renderPainting(std::shared_ptr<Painting> painting, int w,
|
|||
|
||||
void PaintingRenderer::setBrightness(std::shared_ptr<Painting> painting,
|
||||
float ss, float ya) {
|
||||
int x = GameMath::floor(painting->x);
|
||||
int y = GameMath::floor(painting->y + ya / 16.0f);
|
||||
int z = GameMath::floor(painting->z);
|
||||
if (painting->dir == 0) x = GameMath::floor(painting->x + ss / 16.0f);
|
||||
if (painting->dir == 1) z = GameMath::floor(painting->z - ss / 16.0f);
|
||||
if (painting->dir == 2) x = GameMath::floor(painting->x - ss / 16.0f);
|
||||
if (painting->dir == 3) z = GameMath::floor(painting->z + ss / 16.0f);
|
||||
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 col = this->entityRenderDispatcher->level->getLightColor(x, y, z, 0);
|
||||
int u = col % 65536;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "Minecraft.World/Header Files/stdafx.h"
|
||||
#include "../../model/BookModel.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/tile/entity/net.minecraft.world.level.tile.entity.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "EnchantTableRenderer.h"
|
||||
|
||||
ResourceLocation EnchantTableRenderer::BOOK_LOCATION =
|
||||
|
|
@ -36,8 +36,8 @@ void EnchantTableRenderer::render(std::shared_ptr<TileEntity> _table, double x,
|
|||
|
||||
float ff1 = table->oFlip + (table->flip - table->oFlip) * a + 0.25f;
|
||||
float ff2 = table->oFlip + (table->flip - table->oFlip) * a + 0.75f;
|
||||
ff1 = (ff1 - GameMath::fastFloor(ff1)) * 1.6f - 0.3f;
|
||||
ff2 = (ff2 - GameMath::fastFloor(ff2)) * 1.6f - 0.3f;
|
||||
ff1 = (ff1 - Mth::fastFloor(ff1)) * 1.6f - 0.3f;
|
||||
ff2 = (ff2 - Mth::fastFloor(ff2)) * 1.6f - 0.3f;
|
||||
|
||||
if (ff1 < 0) ff1 = 0;
|
||||
if (ff2 < 0) ff2 = 0;
|
||||
|
|
|
|||
|
|
@ -391,7 +391,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 - GameMath::abs(sinf(System::currentTimeMillis() % 1000 /
|
||||
float sss = 1.8f - Mth::abs(sinf(System::currentTimeMillis() % 1000 /
|
||||
1000.0f * std::numbers::pi * 2) *
|
||||
0.1f);
|
||||
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData* initData,
|
|||
settings->getInt(L"max-build-height", Level::maxBuildHeight));
|
||||
setMaxBuildHeight(((getMaxBuildHeight() + 8) / 16) * 16);
|
||||
setMaxBuildHeight(
|
||||
GameMath::clamp(getMaxBuildHeight(), 64, Level::maxBuildHeight));
|
||||
Mth::clamp(getMaxBuildHeight(), 64, Level::maxBuildHeight));
|
||||
// settings->setProperty(L"max-build-height", maxBuildHeight);
|
||||
|
||||
// logger.info("Preparing level \"" + levelName + "\"");
|
||||
|
|
@ -1014,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 = GameMath::abs(x - spawnPos->x);
|
||||
int zd = GameMath::abs(z - spawnPos->z);
|
||||
int xd = Mth::abs(x - spawnPos->x);
|
||||
int zd = Mth::abs(z - spawnPos->z);
|
||||
int dist = std::max(xd, zd);
|
||||
|
||||
return dist <= getSpawnProtectionRadius();
|
||||
|
|
|
|||
|
|
@ -373,17 +373,17 @@ void PlayerList::validatePlayerSpawnPosition(
|
|||
|
||||
double targetX = 0;
|
||||
if (player->x < 0)
|
||||
targetX = GameMath::ceil(player->x) - 0.5;
|
||||
targetX = Mth::ceil(player->x) - 0.5;
|
||||
else
|
||||
targetX = GameMath::floor(player->x) + 0.5;
|
||||
targetX = Mth::floor(player->x) + 0.5;
|
||||
|
||||
double targetY = floor(player->y);
|
||||
|
||||
double targetZ = 0;
|
||||
if (player->z < 0)
|
||||
targetZ = GameMath::ceil(player->z) - 0.5;
|
||||
targetZ = Mth::ceil(player->z) - 0.5;
|
||||
else
|
||||
targetZ = GameMath::floor(player->z) + 0.5;
|
||||
targetZ = Mth::floor(player->z) + 0.5;
|
||||
|
||||
player->setPos(targetX, targetY, targetZ);
|
||||
|
||||
|
|
@ -956,9 +956,9 @@ void PlayerList::repositionAcrossDimension(std::shared_ptr<Entity> entity,
|
|||
}
|
||||
|
||||
if (lastDimension != 1) {
|
||||
xt = (double)GameMath::clamp((int)xt, -Level::MAX_LEVEL_SIZE + 128,
|
||||
xt = (double)Mth::clamp((int)xt, -Level::MAX_LEVEL_SIZE + 128,
|
||||
Level::MAX_LEVEL_SIZE - 128);
|
||||
zt = (double)GameMath::clamp((int)zt, -Level::MAX_LEVEL_SIZE + 128,
|
||||
zt = (double)Mth::clamp((int)zt, -Level::MAX_LEVEL_SIZE + 128,
|
||||
Level::MAX_LEVEL_SIZE - 128);
|
||||
if (entity->isAlive()) {
|
||||
newLevel->addEntity(entity);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "TrackedEntity.h"
|
||||
#include "ServerPlayer.h"
|
||||
#include "ServerLevel.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/net.minecraft.world.entity.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/item/net.minecraft.world.entity.item.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/monster/net.minecraft.world.entity.monster.h"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#include "Minecraft.World/net/minecraft/world/entity/item/PrimedTnt.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/item/FallingTile.h"
|
||||
#include "Minecraft.World/net/minecraft/network/packet/net.minecraft.network.packet.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/net/minecraft/world/level/levelgen/structure/StructurePiece.h"
|
||||
#include "ServerLevelListener.h"
|
||||
#include "Minecraft.World/net/minecraft/util/WeighedTreasure.h"
|
||||
|
|
|
|||
|
|
@ -1663,7 +1663,7 @@ int ServerPlayer::getViewDistance() { return viewDistance; }
|
|||
// }
|
||||
|
||||
Pos* ServerPlayer::getCommandSenderWorldPosition() {
|
||||
return new Pos(GameMath::floor(x), GameMath::floor(y + .5), GameMath::floor(z));
|
||||
return new Pos(Mth::floor(x), Mth::floor(y + .5), Mth::floor(z));
|
||||
}
|
||||
|
||||
void ServerPlayer::resetLastActionTime() {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "TrackedEntity.h"
|
||||
#include "ServerPlayer.h"
|
||||
#include "../network/PlayerConnection.h"
|
||||
#include "Minecraft.World/net/minecraft/util/GameMath.h"
|
||||
#include "Minecraft.World/net/minecraft/util/Mth.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/net.minecraft.world.entity.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/item/net.minecraft.world.entity.item.h"
|
||||
#include "Minecraft.World/net/minecraft/world/entity/monster/net.minecraft.world.entity.monster.h"
|
||||
|
|
@ -39,13 +39,13 @@ TrackedEntity::TrackedEntity(std::shared_ptr<Entity> e, int range,
|
|||
this->updateInterval = updateInterval;
|
||||
this->trackDelta = trackDelta;
|
||||
|
||||
xp = GameMath::floor(e->x * 32);
|
||||
yp = GameMath::floor(e->y * 32);
|
||||
zp = GameMath::floor(e->z * 32);
|
||||
xp = Mth::floor(e->x * 32);
|
||||
yp = Mth::floor(e->y * 32);
|
||||
zp = Mth::floor(e->z * 32);
|
||||
|
||||
yRotp = GameMath::floor(e->yRot * 256 / 360);
|
||||
xRotp = GameMath::floor(e->xRot * 256 / 360);
|
||||
yHeadRotp = GameMath::floor(e->getYHeadRot() * 256 / 360);
|
||||
yRotp = Mth::floor(e->yRot * 256 / 360);
|
||||
xRotp = Mth::floor(e->xRot * 256 / 360);
|
||||
yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360);
|
||||
}
|
||||
|
||||
int c0a = 0, c0b = 0, c1a = 0, c1b = 0, c1c = 0, c2a = 0, c2b = 0;
|
||||
|
|
@ -102,8 +102,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 = GameMath::floor(e->yRot * 256 / 360);
|
||||
int xRotn = GameMath::floor(e->xRot * 256 / 360);
|
||||
int yRotn = Mth::floor(e->yRot * 256 / 360);
|
||||
int xRotn = Mth::floor(e->xRot * 256 / 360);
|
||||
|
||||
// 4J: Changed rotation to be generally sent as a delta as well as
|
||||
// position
|
||||
|
|
@ -113,9 +113,9 @@ void TrackedEntity::tick(EntityTracker* tracker,
|
|||
if (e->riding == nullptr) {
|
||||
teleportDelay++;
|
||||
|
||||
int xn = GameMath::floor(e->x * 32.0);
|
||||
int yn = GameMath::floor(e->y * 32.0);
|
||||
int zn = GameMath::floor(e->z * 32.0);
|
||||
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 xa = xn - xp;
|
||||
int ya = yn - yp;
|
||||
|
|
@ -310,16 +310,16 @@ void TrackedEntity::tick(EntityTracker* tracker,
|
|||
xRotp = xRotn;
|
||||
}
|
||||
|
||||
xp = GameMath::floor(e->x * 32.0);
|
||||
yp = GameMath::floor(e->y * 32.0);
|
||||
zp = GameMath::floor(e->z * 32.0);
|
||||
xp = Mth::floor(e->x * 32.0);
|
||||
yp = Mth::floor(e->y * 32.0);
|
||||
zp = Mth::floor(e->z * 32.0);
|
||||
|
||||
sendDirtyEntityData();
|
||||
|
||||
wasRiding = true;
|
||||
}
|
||||
|
||||
int yHeadRot = GameMath::floor(e->getYHeadRot() * 256 / 360);
|
||||
int yHeadRot = Mth::floor(e->getYHeadRot() * 256 / 360);
|
||||
if (abs(yHeadRot - yHeadRotp) >= TOLERANCE_LEVEL) {
|
||||
broadcast(std::shared_ptr<RotateHeadPacket>(
|
||||
new RotateHeadPacket(e->entityId, (uint8_t)yHeadRot)));
|
||||
|
|
@ -625,8 +625,8 @@ void TrackedEntity::updatePlayer(EntityTracker* tracker,
|
|||
std::shared_ptr<EntityActionAtPositionPacket>(
|
||||
new EntityActionAtPositionPacket(
|
||||
e, EntityActionAtPositionPacket::START_SLEEP,
|
||||
GameMath::floor(e->x), GameMath::floor(e->y),
|
||||
GameMath::floor(e->z))));
|
||||
Mth::floor(e->x), Mth::floor(e->y),
|
||||
Mth::floor(e->z))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -681,7 +681,7 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
|
|||
|
||||
// 4J-PB - replacing with a switch, rather than tons of ifs
|
||||
if (std::dynamic_pointer_cast<Creature>(e) != nullptr) {
|
||||
yHeadRotp = GameMath::floor(e->getYHeadRot() * 256 / 360);
|
||||
yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360);
|
||||
return std::shared_ptr<AddMobPacket>(
|
||||
new AddMobPacket(std::dynamic_pointer_cast<Mob>(e), yRotp, xRotp,
|
||||
xp, yp, zp, yHeadRotp));
|
||||
|
|
@ -717,7 +717,7 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
|
|||
return std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::BOAT, yRotp, xRotp, xp, yp, zp));
|
||||
} else if (e->instanceof(eTYPE_ENDERDRAGON)) {
|
||||
yHeadRotp = GameMath::floor(e->getYHeadRot() * 256 / 360);
|
||||
yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360);
|
||||
return std::shared_ptr<AddMobPacket>(
|
||||
new AddMobPacket(std::dynamic_pointer_cast<LivingEntity>(e), yRotp,
|
||||
xRotp, xp, yp, zp, yHeadRotp));
|
||||
|
|
@ -812,9 +812,9 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
|
|||
std::shared_ptr<AddEntityPacket>(
|
||||
new AddEntityPacket(e, AddEntityPacket::ITEM_FRAME, frame->dir,
|
||||
yRotp, xRotp, xp, yp, zp));
|
||||
packet->x = GameMath::floor(frame->xTile * 32.0f);
|
||||
packet->y = GameMath::floor(frame->yTile * 32.0f);
|
||||
packet->z = GameMath::floor(frame->zTile * 32.0f);
|
||||
packet->x = Mth::floor(frame->xTile * 32.0f);
|
||||
packet->y = Mth::floor(frame->yTile * 32.0f);
|
||||
packet->z = Mth::floor(frame->zTile * 32.0f);
|
||||
return packet;
|
||||
} else if (e->instanceof(eTYPE_LEASHFENCEKNOT)) {
|
||||
std::shared_ptr<LeashFenceKnotEntity> knot =
|
||||
|
|
@ -822,9 +822,9 @@ std::shared_ptr<Packet> TrackedEntity::getAddEntityPacket() {
|
|||
std::shared_ptr<AddEntityPacket> packet =
|
||||
std::shared_ptr<AddEntityPacket>(new AddEntityPacket(
|
||||
e, AddEntityPacket::LEASH_KNOT, yRotp, xRotp, xp, yp, zp));
|
||||
packet->x = GameMath::floor((float)knot->xTile * 32);
|
||||
packet->y = GameMath::floor((float)knot->yTile * 32);
|
||||
packet->z = GameMath::floor((float)knot->zTile * 32);
|
||||
packet->x = Mth::floor((float)knot->xTile * 32);
|
||||
packet->y = Mth::floor((float)knot->yTile * 32);
|
||||
packet->z = Mth::floor((float)knot->zTile * 32);
|
||||
return packet;
|
||||
} else if (e->instanceof(eTYPE_EXPERIENCEORB)) {
|
||||
return std::shared_ptr<AddExperienceOrbPacket>(
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
#include "../ConsoleHelpers/Definitions.h"
|
||||
#include "java/Class.h"
|
||||
#include "java/Exceptions.h"
|
||||
#include "../net/minecraft/util/GameMath.h"
|
||||
#include "../net/minecraft/util/Mth.h"
|
||||
#include "../ConsoleHelpers/StringHelpers.h"
|
||||
#include "../ConsoleHelpers/ArrayWithLength.h"
|
||||
#include "java/Random.h"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ int Direction::RELATIVE_DIRECTION_FACING[4][6] = {
|
|||
Facing::NORTH}};
|
||||
|
||||
int Direction::getDirection(double xd, double zd) {
|
||||
if (GameMath::abs((float)xd) > GameMath::abs((float)zd)) {
|
||||
if (Mth::abs((float)xd) > Mth::abs((float)zd)) {
|
||||
if (xd > 0) {
|
||||
return WEST;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ AddExperienceOrbPacket::AddExperienceOrbPacket() {
|
|||
AddExperienceOrbPacket::AddExperienceOrbPacket(
|
||||
std::shared_ptr<ExperienceOrb> e) {
|
||||
id = e->entityId;
|
||||
x = GameMath::floor(e->x * 32);
|
||||
y = GameMath::floor(e->y * 32);
|
||||
z = GameMath::floor(e->z * 32);
|
||||
x = Mth::floor(e->x * 32);
|
||||
y = Mth::floor(e->y * 32);
|
||||
z = Mth::floor(e->z * 32);
|
||||
value = e->getValue();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ AddGlobalEntityPacket::AddGlobalEntityPacket() {
|
|||
|
||||
AddGlobalEntityPacket::AddGlobalEntityPacket(std::shared_ptr<Entity> e) {
|
||||
id = e->entityId;
|
||||
x = GameMath::floor(e->x * 32);
|
||||
y = GameMath::floor(e->y * 32);
|
||||
z = GameMath::floor(e->z * 32);
|
||||
x = Mth::floor(e->x * 32);
|
||||
y = Mth::floor(e->y * 32);
|
||||
z = Mth::floor(e->z * 32);
|
||||
if (e->instanceof(eTYPE_LIGHTNINGBOLT)) {
|
||||
type = LIGHTNING;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ AddMobPacket::AddMobPacket(std::shared_ptr<LivingEntity> mob, int yRotp,
|
|||
type = EntityIO::getId(mob);
|
||||
// 4J Stu - We should add entities at their "last sent" position so that the
|
||||
// relative update packets put them in the correct place
|
||||
x = xp; // GameMath::floor(mob->x * 32);
|
||||
y = yp; // GameMath::floor(mob->y * 32);
|
||||
z = zp; // GameMath::floor(mob->z * 32);
|
||||
x = xp; // Mth::floor(mob->x * 32);
|
||||
y = yp; // Mth::floor(mob->y * 32);
|
||||
z = zp; // Mth::floor(mob->z * 32);
|
||||
// 4J - changed - send current "previously sent" value of rotations to put
|
||||
// this in sync with other clients
|
||||
yRot = static_cast<uint8_t>(yRotp);
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ AddPlayerPacket::AddPlayerPacket(std::shared_ptr<Player> player, PlayerUID xuid,
|
|||
|
||||
// 4J Stu - Send "previously sent" value of position as well so that we stay
|
||||
// in sync
|
||||
x = xp; // GameMath::floor(player->x * 32);
|
||||
y = yp; // GameMath::floor(player->y * 32);
|
||||
z = zp; // GameMath::floor(player->z * 32);
|
||||
x = xp; // Mth::floor(player->x * 32);
|
||||
y = yp; // Mth::floor(player->y * 32);
|
||||
z = zp; // Mth::floor(player->z * 32);
|
||||
// 4J - changed - send current "previously sent" value of rotations to put
|
||||
// this in sync with other clients
|
||||
yRot = yRotp;
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ TeleportEntityPacket::TeleportEntityPacket() {
|
|||
|
||||
TeleportEntityPacket::TeleportEntityPacket(std::shared_ptr<Entity> e) {
|
||||
id = e->entityId;
|
||||
x = GameMath::floor(e->x * 32);
|
||||
y = GameMath::floor(e->y * 32);
|
||||
z = GameMath::floor(e->z * 32);
|
||||
x = Mth::floor(e->x * 32);
|
||||
y = Mth::floor(e->y * 32);
|
||||
z = Mth::floor(e->z * 32);
|
||||
yRot = (uint8_t)(e->yRot * 256 / 360);
|
||||
xRot = (uint8_t)(e->xRot * 256 / 360);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "../../../Header Files/stdafx.h"
|
||||
#include "GameMath.h"
|
||||
#include "Mth.h"
|
||||
#include "java/Random.h"
|
||||
#include "../../../ConsoleHelpers/StringHelpers.h"
|
||||
|
||||
|
|
@ -18,19 +18,19 @@ static std::array<float, SIN_TAB_CNT> makeSinTable() {
|
|||
|
||||
static const std::array<float, SIN_TAB_CNT> sinTable = makeSinTable();
|
||||
|
||||
float GameMath::sin(float i) {
|
||||
float Mth::sin(float i) {
|
||||
return sinTable[(int32_t)::fmodf(i * SIN_SCALE, (float)SIN_TAB_CNT) &
|
||||
(SIN_TAB_CNT - 1)];
|
||||
}
|
||||
|
||||
float GameMath::cos(float i) {
|
||||
float Mth::cos(float i) {
|
||||
return sinTable[(int32_t)::fmodf(i * SIN_SCALE + (float)SIN_TAB_CNT / 4,
|
||||
(float)SIN_TAB_CNT) &
|
||||
(SIN_TAB_CNT - 1)];
|
||||
}
|
||||
|
||||
// 4J Changed this to remove the use of the actual UUID type
|
||||
std::wstring GameMath::createInsecureUUID(Random* random) {
|
||||
std::wstring Mth::createInsecureUUID(Random* random) {
|
||||
wchar_t output[33];
|
||||
output[32] = 0;
|
||||
int64_t high = (random->nextLong() & ~UUID_VERSION) | UUID_VERSION_TYPE_4;
|
||||
|
|
@ -50,24 +50,24 @@ std::wstring GameMath::createInsecureUUID(Random* random) {
|
|||
return std::wstring(output);
|
||||
}
|
||||
|
||||
int GameMath::getInt(const std::wstring& input, int def) {
|
||||
int Mth::getInt(const std::wstring& input, int def) {
|
||||
std::wistringstream stream(input);
|
||||
int result;
|
||||
return (stream >> result) ? result : def;
|
||||
}
|
||||
|
||||
int GameMath::getInt(const std::wstring& input, int def, int min) {
|
||||
int Mth::getInt(const std::wstring& input, int def, int min) {
|
||||
int result = getInt(input, def);
|
||||
return result < min ? min : result;
|
||||
}
|
||||
|
||||
double GameMath::getDouble(const std::wstring& input, double def) {
|
||||
double Mth::getDouble(const std::wstring& input, double def) {
|
||||
std::wistringstream stream(input);
|
||||
double result;
|
||||
return (stream >> result) ? result : def;
|
||||
}
|
||||
|
||||
double GameMath::getDouble(const std::wstring& input, double def, double min) {
|
||||
double Mth::getDouble(const std::wstring& input, double def, double min) {
|
||||
double result = getDouble(input, def);
|
||||
return result < min ? min : result;
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class Random;
|
||||
|
||||
class GameMath {
|
||||
class Mth {
|
||||
public:
|
||||
static constexpr float DEG_TO_RAD = std::numbers::pi_v<float> / 180.0f;
|
||||
static constexpr float RAD_TO_DEG = 180.0f / std::numbers::pi_v<float>;
|
||||
|
|
@ -19,7 +19,7 @@ void CombatTracker::prepareForDamage() {
|
|||
|
||||
if (mob->onLadder()) {
|
||||
int type = mob->level->getTile(
|
||||
GameMath::floor(mob->x), GameMath::floor(mob->bb.y0), GameMath::floor(mob->z));
|
||||
Mth::floor(mob->x), Mth::floor(mob->bb.y0), Mth::floor(mob->z));
|
||||
|
||||
if (type == Tile::ladder->id) {
|
||||
nextLocation = eLocation_LADDER;
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ void Entity::_init(bool useSmallId, Level* level) {
|
|||
portalEntranceDir = 0;
|
||||
invulnerable = false;
|
||||
if (useSmallId) {
|
||||
uuid = L"ent" + GameMath::createInsecureUUID(random);
|
||||
uuid = L"ent" + Mth::createInsecureUUID(random);
|
||||
}
|
||||
|
||||
// 4J Added
|
||||
|
|
@ -542,9 +542,9 @@ void Entity::baseTick() {
|
|||
}
|
||||
|
||||
if (isSprinting() && !isInWater() && canCreateParticles()) {
|
||||
int xt = GameMath::floor(x);
|
||||
int yt = GameMath::floor(y - 0.2f - heightOffset);
|
||||
int zt = GameMath::floor(z);
|
||||
int xt = Mth::floor(x);
|
||||
int yt = Mth::floor(y - 0.2f - heightOffset);
|
||||
int zt = Mth::floor(z);
|
||||
int t = level->getTile(xt, yt, zt);
|
||||
int d = level->getData(xt, yt, zt);
|
||||
if (t > 0) {
|
||||
|
|
@ -725,8 +725,8 @@ void Entity::move(double xa, double ya, double za,
|
|||
|
||||
// 4J Stu - Particles (and possibly other entities) don't have xChunk and
|
||||
// zChunk set, so calculate the chunk instead
|
||||
int xc = GameMath::floor(x / 16);
|
||||
int zc = GameMath::floor(z / 16);
|
||||
int xc = Mth::floor(x / 16);
|
||||
int zc = Mth::floor(z / 16);
|
||||
if (!level->isClientSide || level->reallyHasChunk(xc, zc)) {
|
||||
// 4J Stu - It's horrible that the client is doing any movement at all!
|
||||
// But if we don't have the chunk data then all the collision info will
|
||||
|
|
@ -853,9 +853,9 @@ void Entity::move(double xa, double ya, double za,
|
|||
double zm = z - zo;
|
||||
|
||||
if (makeStepSound() && !isPlayerSneaking && riding == nullptr) {
|
||||
int xt = GameMath::floor(x);
|
||||
int yt = GameMath::floor(y - 0.2f - heightOffset);
|
||||
int zt = GameMath::floor(z);
|
||||
int xt = Mth::floor(x);
|
||||
int yt = Mth::floor(y - 0.2f - heightOffset);
|
||||
int zt = Mth::floor(z);
|
||||
int t = level->getTile(xt, yt, zt);
|
||||
if (t == 0) {
|
||||
int renderShape = level->getTileRenderShape(xt, yt - 1, zt);
|
||||
|
|
@ -869,14 +869,14 @@ void Entity::move(double xa, double ya, double za,
|
|||
ym = 0;
|
||||
}
|
||||
|
||||
walkDist += GameMath::sqrt(xm * xm + zm * zm) * 0.6;
|
||||
moveDist += GameMath::sqrt(xm * xm + ym * ym + zm * zm) * 0.6;
|
||||
walkDist += Mth::sqrt(xm * xm + zm * zm) * 0.6;
|
||||
moveDist += Mth::sqrt(xm * xm + ym * ym + zm * zm) * 0.6;
|
||||
|
||||
if (moveDist > nextStep && t > 0) {
|
||||
nextStep = (int)moveDist + 1;
|
||||
if (isInWater()) {
|
||||
float speed =
|
||||
GameMath::sqrt(xd * xd * 0.2f + yd * yd + zd * zd * 0.2f) *
|
||||
Mth::sqrt(xd * xd * 0.2f + yd * yd + zd * zd * 0.2f) *
|
||||
0.35f;
|
||||
if (speed > 1) speed = 1;
|
||||
playSound(
|
||||
|
|
@ -912,12 +912,12 @@ void Entity::move(double xa, double ya, double za,
|
|||
}
|
||||
|
||||
void Entity::checkInsideTiles() {
|
||||
int x0 = GameMath::floor(bb.x0 + 0.001);
|
||||
int y0 = GameMath::floor(bb.y0 + 0.001);
|
||||
int z0 = GameMath::floor(bb.z0 + 0.001);
|
||||
int x1 = GameMath::floor(bb.x1 - 0.001);
|
||||
int y1 = GameMath::floor(bb.y1 - 0.001);
|
||||
int z1 = GameMath::floor(bb.z1 - 0.001);
|
||||
int x0 = Mth::floor(bb.x0 + 0.001);
|
||||
int y0 = Mth::floor(bb.y0 + 0.001);
|
||||
int z0 = Mth::floor(bb.z0 + 0.001);
|
||||
int x1 = Mth::floor(bb.x1 - 0.001);
|
||||
int y1 = Mth::floor(bb.y1 - 0.001);
|
||||
int z1 = Mth::floor(bb.z1 - 0.001);
|
||||
|
||||
if (level->hasChunksAt(x0, y0, z0, x1, y1, z1)) {
|
||||
for (int x = x0; x <= x1; x++)
|
||||
|
|
@ -992,9 +992,9 @@ void Entity::causeFallDamage(float distance) {
|
|||
|
||||
bool Entity::isInWaterOrRain() {
|
||||
return wasInWater ||
|
||||
(level->isRainingAt(GameMath::floor(x), GameMath::floor(y), GameMath::floor(z)) ||
|
||||
level->isRainingAt(GameMath::floor(x), GameMath::floor(y + bbHeight),
|
||||
GameMath::floor(z)));
|
||||
(level->isRainingAt(Mth::floor(x), Mth::floor(y), Mth::floor(z)) ||
|
||||
level->isRainingAt(Mth::floor(x), Mth::floor(y + bbHeight),
|
||||
Mth::floor(z)));
|
||||
}
|
||||
|
||||
bool Entity::isInWater() { return wasInWater; }
|
||||
|
|
@ -1005,13 +1005,13 @@ bool Entity::updateInWaterState() {
|
|||
shared_from_this())) {
|
||||
if (!wasInWater && !firstTick && canCreateParticles()) {
|
||||
float speed =
|
||||
GameMath::sqrt(xd * xd * 0.2f + yd * yd + zd * zd * 0.2f) * 0.2f;
|
||||
Mth::sqrt(xd * xd * 0.2f + yd * yd + zd * zd * 0.2f) * 0.2f;
|
||||
if (speed > 1) speed = 1;
|
||||
MemSect(31);
|
||||
playSound(eSoundType_RANDOM_SPLASH, speed,
|
||||
1 + (random->nextFloat() - random->nextFloat()) * 0.4f);
|
||||
MemSect(0);
|
||||
float yt = (float)GameMath::floor(bb.y0);
|
||||
float yt = (float)Mth::floor(bb.y0);
|
||||
for (int i = 0; i < 1 + bbWidth * 20; i++) {
|
||||
float xo = (random->nextFloat() * 2 - 1) * bbWidth;
|
||||
float zo = (random->nextFloat() * 2 - 1) * bbWidth;
|
||||
|
|
@ -1036,10 +1036,10 @@ bool Entity::updateInWaterState() {
|
|||
|
||||
bool Entity::isUnderLiquid(Material* material) {
|
||||
double yp = y + getHeadHeight();
|
||||
int xt = GameMath::floor(x);
|
||||
int yt = GameMath::floor(
|
||||
int xt = Mth::floor(x);
|
||||
int yt = Mth::floor(
|
||||
yp); // 4J - this used to be a nested pair of floors for some reason
|
||||
int zt = GameMath::floor(z);
|
||||
int zt = Mth::floor(z);
|
||||
int t = level->getTile(xt, yt, zt);
|
||||
if (t != 0 && Tile::tiles[t]->material == material) {
|
||||
float hh = LiquidTile::getHeight(level->getData(xt, yt, zt)) - 1 / 9.0f;
|
||||
|
|
@ -1075,12 +1075,12 @@ void Entity::moveRelative(float xa, float za, float speed) {
|
|||
|
||||
// 4J - change brought forward from 1.8.2
|
||||
int Entity::getLightColor(float a) {
|
||||
int xTile = GameMath::floor(x);
|
||||
int zTile = GameMath::floor(z);
|
||||
int xTile = Mth::floor(x);
|
||||
int zTile = Mth::floor(z);
|
||||
|
||||
if (level->hasChunkAt(xTile, 0, zTile)) {
|
||||
double hh = (bb.y1 - bb.y0) * 0.66;
|
||||
int yTile = GameMath::floor(y - heightOffset + hh);
|
||||
int yTile = Mth::floor(y - heightOffset + hh);
|
||||
return level->getLightColor(xTile, yTile, zTile, 0);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1088,11 +1088,11 @@ int Entity::getLightColor(float a) {
|
|||
|
||||
// 4J - changes brought forward from 1.8.2
|
||||
float Entity::getBrightness(float a) {
|
||||
int xTile = GameMath::floor(x);
|
||||
int zTile = GameMath::floor(z);
|
||||
int xTile = Mth::floor(x);
|
||||
int zTile = Mth::floor(z);
|
||||
if (level->hasChunkAt(xTile, 0, zTile)) {
|
||||
double hh = (bb.y1 - bb.y0) * 0.66;
|
||||
int yTile = GameMath::floor(y - heightOffset + hh);
|
||||
int yTile = Mth::floor(y - heightOffset + hh);
|
||||
return level->getBrightness(xTile, yTile, zTile);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1415,9 +1415,9 @@ bool Entity::isInWall() {
|
|||
float xo = ((i >> 0) % 2 - 0.5f) * bbWidth * 0.8f;
|
||||
float yo = ((i >> 1) % 2 - 0.5f) * 0.1f;
|
||||
float zo = ((i >> 2) % 2 - 0.5f) * bbWidth * 0.8f;
|
||||
int xt = GameMath::floor(x + xo);
|
||||
int yt = GameMath::floor(y + getHeadHeight() + yo);
|
||||
int zt = GameMath::floor(z + zo);
|
||||
int xt = Mth::floor(x + xo);
|
||||
int yt = Mth::floor(y + getHeadHeight() + yo);
|
||||
int zt = Mth::floor(z + zo);
|
||||
if (level->isSolidBlockingTile(xt, yt, zt)) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1659,9 +1659,9 @@ void Entity::thunderHit(const LightningBolt* lightningBolt) {
|
|||
void Entity::killed(std::shared_ptr<LivingEntity> mob) {}
|
||||
|
||||
bool Entity::checkInTile(double x, double y, double z) {
|
||||
int xTile = GameMath::floor(x);
|
||||
int yTile = GameMath::floor(y);
|
||||
int zTile = GameMath::floor(z);
|
||||
int xTile = Mth::floor(x);
|
||||
int yTile = Mth::floor(y);
|
||||
int zTile = Mth::floor(z);
|
||||
|
||||
double xd = x - (xTile);
|
||||
double yd = y - (yTile);
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ EntityPos* EntityPos::lerp(std::shared_ptr<Entity> e, float f) {
|
|||
double yd = e->y + (y - e->y) * f;
|
||||
double zd = e->z + (z - e->z) * f;
|
||||
|
||||
float yrdd = GameMath::wrapDegrees(yRot - e->yRot);
|
||||
float xrdd = GameMath::wrapDegrees(xRot - e->xRot);
|
||||
float yrdd = Mth::wrapDegrees(yRot - e->yRot);
|
||||
float xrdd = Mth::wrapDegrees(xRot - e->xRot);
|
||||
|
||||
float yrd = GameMath::wrapDegrees(e->yRot + yrdd * f);
|
||||
float xrd = GameMath::wrapDegrees(e->xRot + xrdd * f);
|
||||
float yrd = Mth::wrapDegrees(e->yRot + yrdd * f);
|
||||
float xrd = Mth::wrapDegrees(e->xRot + xrdd * f);
|
||||
|
||||
if (rot && move) {
|
||||
return new EntityPos(xd, yd, zd, yrd, xrd);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ void ExperienceOrb::tick() {
|
|||
zo = z;
|
||||
|
||||
yd -= 0.03f;
|
||||
if (level->getMaterial(GameMath::floor(x), GameMath::floor(y), GameMath::floor(z)) ==
|
||||
if (level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z)) ==
|
||||
Material::lava) {
|
||||
yd = 0.2f;
|
||||
xd = (random->nextFloat() - random->nextFloat()) * 0.2f;
|
||||
|
|
@ -122,7 +122,7 @@ void ExperienceOrb::tick() {
|
|||
if (onGround) {
|
||||
friction = 0.6f * 0.98f;
|
||||
int t =
|
||||
level->getTile(GameMath::floor(x), GameMath::floor(bb.y0) - 1, GameMath::floor(z));
|
||||
level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1, Mth::floor(z));
|
||||
if (t > 0) {
|
||||
friction = Tile::tiles[t]->friction * 0.98f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ void FlyingMob::travel(float xa, float ya) {
|
|||
float friction = 0.91f;
|
||||
if (onGround) {
|
||||
friction = 0.6f * 0.91f;
|
||||
int t = level->getTile(GameMath::floor(x), GameMath::floor(bb.y0) - 1,
|
||||
GameMath::floor(z));
|
||||
int t = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1,
|
||||
Mth::floor(z));
|
||||
if (t > 0) {
|
||||
friction = Tile::tiles[t]->friction * 0.91f;
|
||||
}
|
||||
|
|
@ -48,8 +48,8 @@ void FlyingMob::travel(float xa, float ya) {
|
|||
friction = 0.91f;
|
||||
if (onGround) {
|
||||
friction = 0.6f * 0.91f;
|
||||
int t = level->getTile(GameMath::floor(x), GameMath::floor(bb.y0) - 1,
|
||||
GameMath::floor(z));
|
||||
int t = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1,
|
||||
Mth::floor(z));
|
||||
if (t > 0) {
|
||||
friction = Tile::tiles[t]->friction * 0.91f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,11 +108,11 @@ bool HangingEntity::survives() {
|
|||
int xt = xTile;
|
||||
int yt = yTile;
|
||||
int zt = zTile;
|
||||
if (dir == Direction::NORTH) xt = GameMath::floor(x - getWidth() / 32.0f);
|
||||
if (dir == Direction::WEST) zt = GameMath::floor(z - getWidth() / 32.0f);
|
||||
if (dir == Direction::SOUTH) xt = GameMath::floor(x - getWidth() / 32.0f);
|
||||
if (dir == Direction::EAST) zt = GameMath::floor(z - getWidth() / 32.0f);
|
||||
yt = GameMath::floor(y - getHeight() / 32.0f);
|
||||
if (dir == Direction::NORTH) xt = Mth::floor(x - getWidth() / 32.0f);
|
||||
if (dir == Direction::WEST) zt = Mth::floor(z - getWidth() / 32.0f);
|
||||
if (dir == Direction::SOUTH) xt = Mth::floor(x - getWidth() / 32.0f);
|
||||
if (dir == Direction::EAST) zt = Mth::floor(z - getWidth() / 32.0f);
|
||||
yt = Mth::floor(y - getHeight() / 32.0f);
|
||||
|
||||
for (int ss = 0; ss < ws; ss++) {
|
||||
for (int yy = 0; yy < hs; yy++) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "../../../../Header Files/stdafx.h"
|
||||
#include "java/JavaMath.h"
|
||||
#include "../../util/GameMath.h"
|
||||
#include "../../util/Mth.h"
|
||||
#include "../../network/packet/net.minecraft.network.packet.h"
|
||||
#include "../level/net.minecraft.world.level.h"
|
||||
#include "../level/tile/net.minecraft.world.level.tile.h"
|
||||
|
|
@ -155,9 +155,9 @@ void LivingEntity::checkFallDamage(double ya, bool onGround) {
|
|||
}
|
||||
|
||||
if (onGround && fallDistance > 0) {
|
||||
int xt = GameMath::floor(x);
|
||||
int yt = GameMath::floor(y - 0.2f - heightOffset);
|
||||
int zt = GameMath::floor(z);
|
||||
int xt = Mth::floor(x);
|
||||
int yt = Mth::floor(y - 0.2f - heightOffset);
|
||||
int zt = Mth::floor(z);
|
||||
int t = level->getTile(xt, yt, zt);
|
||||
if (t == 0) {
|
||||
int renderShape = level->getTileRenderShape(xt, yt - 1, zt);
|
||||
|
|
@ -671,7 +671,7 @@ void LivingEntity::heal(float heal) {
|
|||
float LivingEntity::getHealth() { return entityData->getFloat(DATA_HEALTH_ID); }
|
||||
|
||||
void LivingEntity::setHealth(float health) {
|
||||
entityData->set(DATA_HEALTH_ID, GameMath::clamp(health, 0.0f, getMaxHealth()));
|
||||
entityData->set(DATA_HEALTH_ID, Mth::clamp(health, 0.0f, getMaxHealth()));
|
||||
}
|
||||
|
||||
bool LivingEntity::hurt(DamageSource* source, float dmg) {
|
||||
|
|
@ -867,7 +867,7 @@ void LivingEntity::knockback(std::shared_ptr<Entity> source, float dmg,
|
|||
}
|
||||
|
||||
hasImpulse = true;
|
||||
float dd = GameMath::sqrt(xd * xd + zd * zd);
|
||||
float dd = Mth::sqrt(xd * xd + zd * zd);
|
||||
float pow = 0.4f;
|
||||
|
||||
this->xd /= 2;
|
||||
|
|
@ -897,9 +897,9 @@ void LivingEntity::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) {
|
|||
}
|
||||
|
||||
bool LivingEntity::onLadder() {
|
||||
int xt = GameMath::floor(x);
|
||||
int yt = GameMath::floor(bb.y0);
|
||||
int zt = GameMath::floor(z);
|
||||
int xt = Mth::floor(x);
|
||||
int yt = Mth::floor(bb.y0);
|
||||
int zt = Mth::floor(z);
|
||||
|
||||
// 4J-PB - TU9 - add climbable vines
|
||||
int iTile = level->getTile(xt, yt, zt);
|
||||
|
|
@ -925,9 +925,9 @@ void LivingEntity::causeFallDamage(float distance) {
|
|||
}
|
||||
hurt(DamageSource::fall, dmg);
|
||||
|
||||
int t = level->getTile(GameMath::floor(x),
|
||||
GameMath::floor(y - 0.2f - this->heightOffset),
|
||||
GameMath::floor(z));
|
||||
int t = level->getTile(Mth::floor(x),
|
||||
Mth::floor(y - 0.2f - this->heightOffset),
|
||||
Mth::floor(z));
|
||||
if (t > 0) {
|
||||
const Tile::SoundType* soundType = Tile::tiles[t]->soundType;
|
||||
MemSect(31);
|
||||
|
|
@ -1214,7 +1214,7 @@ void LivingEntity::jumpFromGround() {
|
|||
yd += (getEffect(MobEffect::jump)->getAmplifier() + 1) * .1f;
|
||||
}
|
||||
if (isSprinting()) {
|
||||
float rr = yRot * GameMath::DEG_TO_RAD;
|
||||
float rr = yRot * Mth::DEG_TO_RAD;
|
||||
|
||||
xd -= sinf(rr) * 0.2f;
|
||||
zd += cosf(rr) * 0.2f;
|
||||
|
|
@ -1254,8 +1254,8 @@ void LivingEntity::travel(float xa, float ya) {
|
|||
float friction = 0.91f;
|
||||
if (onGround) {
|
||||
friction = 0.6f * 0.91f;
|
||||
int t = level->getTile(GameMath::floor(x), GameMath::floor(bb.y0) - 1,
|
||||
GameMath::floor(z));
|
||||
int t = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1,
|
||||
Mth::floor(z));
|
||||
if (t > 0) {
|
||||
friction = Tile::tiles[t]->friction * 0.91f;
|
||||
}
|
||||
|
|
@ -1276,8 +1276,8 @@ void LivingEntity::travel(float xa, float ya) {
|
|||
friction = 0.91f;
|
||||
if (onGround) {
|
||||
friction = 0.6f * 0.91f;
|
||||
int t = level->getTile(GameMath::floor(x), GameMath::floor(bb.y0) - 1,
|
||||
GameMath::floor(z));
|
||||
int t = level->getTile(Mth::floor(x), Mth::floor(bb.y0) - 1,
|
||||
Mth::floor(z));
|
||||
if (t > 0) {
|
||||
friction = Tile::tiles[t]->friction * 0.91f;
|
||||
}
|
||||
|
|
@ -1319,7 +1319,7 @@ void LivingEntity::travel(float xa, float ya) {
|
|||
walkAnimSpeedO = walkAnimSpeed;
|
||||
double xxd = x - xo;
|
||||
double zzd = z - zo;
|
||||
float wst = GameMath::sqrt(xxd * xxd + zzd * zzd) * 4;
|
||||
float wst = Mth::sqrt(xxd * xxd + zzd * zzd) * 4;
|
||||
if (wst > 1) wst = 1;
|
||||
walkAnimSpeed += (wst - walkAnimSpeed) * 0.4f;
|
||||
walkAnimPos += walkAnimSpeed;
|
||||
|
|
@ -1333,12 +1333,12 @@ void LivingEntity::travel(float xa, float ya) {
|
|||
int LivingEntity::getLightColor(float a) {
|
||||
float accum[2] = {0, 0};
|
||||
float totVol = (bb.x1 - bb.x0) * (bb.y1 - bb.y0) * (bb.z1 - bb.z0);
|
||||
int xmin = GameMath::floor(bb.x0);
|
||||
int xmax = GameMath::floor(bb.x1);
|
||||
int ymin = GameMath::floor(bb.y0);
|
||||
int ymax = GameMath::floor(bb.y1);
|
||||
int zmin = GameMath::floor(bb.z0);
|
||||
int zmax = GameMath::floor(bb.z1);
|
||||
int xmin = Mth::floor(bb.x0);
|
||||
int xmax = Mth::floor(bb.x1);
|
||||
int ymin = Mth::floor(bb.y0);
|
||||
int ymax = Mth::floor(bb.y1);
|
||||
int zmin = Mth::floor(bb.z0);
|
||||
int zmax = Mth::floor(bb.z1);
|
||||
for (int xt = xmin; xt <= xmax; xt++)
|
||||
for (int yt = ymin; yt <= ymax; yt++)
|
||||
for (int zt = zmin; zt <= zmax; zt++) {
|
||||
|
|
@ -1466,10 +1466,10 @@ void LivingEntity::tick() {
|
|||
}
|
||||
|
||||
float LivingEntity::tickHeadTurn(float yBodyRotT, float walkSpeed) {
|
||||
float yBodyRotD = GameMath::wrapDegrees(yBodyRotT - yBodyRot);
|
||||
float yBodyRotD = Mth::wrapDegrees(yBodyRotT - yBodyRot);
|
||||
yBodyRot += yBodyRotD * 0.3f;
|
||||
|
||||
float headDiff = GameMath::wrapDegrees(yRot - yBodyRot);
|
||||
float headDiff = Mth::wrapDegrees(yRot - yBodyRot);
|
||||
bool behind = headDiff < -90 || headDiff >= 90;
|
||||
if (headDiff < -75) headDiff = -75;
|
||||
if (headDiff >= 75) headDiff = +75;
|
||||
|
|
@ -1492,8 +1492,8 @@ void LivingEntity::aiStep() {
|
|||
double yt = y + (ly - y) / lSteps;
|
||||
double zt = z + (lz - z) / lSteps;
|
||||
|
||||
double yrd = GameMath::wrapDegrees(lyr - yRot);
|
||||
double xrd = GameMath::wrapDegrees(lxr - xRot);
|
||||
double yrd = Mth::wrapDegrees(lyr - yRot);
|
||||
double xrd = Mth::wrapDegrees(lxr - xRot);
|
||||
|
||||
yRot += (float)((yrd) / lSteps);
|
||||
xRot += (float)((xrd) / lSteps);
|
||||
|
|
@ -1652,20 +1652,20 @@ std::optional<Vec3> LivingEntity::getLookAngle() { return getViewVector(1); }
|
|||
|
||||
Vec3 LivingEntity::getViewVector(float a) {
|
||||
if (a == 1) {
|
||||
float yCos = cosf(-yRot * GameMath::DEG_TO_RAD - std::numbers::pi);
|
||||
float ySin = sinf(-yRot * GameMath::DEG_TO_RAD - std::numbers::pi);
|
||||
float xCos = -cosf(-xRot * GameMath::DEG_TO_RAD);
|
||||
float xSin = sinf(-xRot * GameMath::DEG_TO_RAD);
|
||||
float yCos = cosf(-yRot * Mth::DEG_TO_RAD - std::numbers::pi);
|
||||
float ySin = sinf(-yRot * Mth::DEG_TO_RAD - std::numbers::pi);
|
||||
float xCos = -cosf(-xRot * Mth::DEG_TO_RAD);
|
||||
float xSin = sinf(-xRot * Mth::DEG_TO_RAD);
|
||||
|
||||
return Vec3(ySin * xCos, xSin, yCos * xCos);
|
||||
}
|
||||
float xRot = xRotO + (this->xRot - xRotO) * a;
|
||||
float yRot = yRotO + (this->yRot - yRotO) * a;
|
||||
|
||||
float yCos = cosf(-yRot * GameMath::DEG_TO_RAD - std::numbers::pi);
|
||||
float ySin = sinf(-yRot * GameMath::DEG_TO_RAD - std::numbers::pi);
|
||||
float xCos = -cosf(-xRot * GameMath::DEG_TO_RAD);
|
||||
float xSin = sinf(-xRot * GameMath::DEG_TO_RAD);
|
||||
float yCos = cosf(-yRot * Mth::DEG_TO_RAD - std::numbers::pi);
|
||||
float ySin = sinf(-yRot * Mth::DEG_TO_RAD - std::numbers::pi);
|
||||
float xCos = -cosf(-xRot * Mth::DEG_TO_RAD);
|
||||
float xSin = sinf(-xRot * Mth::DEG_TO_RAD);
|
||||
|
||||
return Vec3(ySin * xCos, xSin, yCos * xCos);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -501,7 +501,7 @@ void Mob::lookAt(std::shared_ptr<Entity> e, float yMax, float xMax) {
|
|||
yd = (e->bb.y0 + e->bb.y1) / 2 - (y + getHeadHeight());
|
||||
}
|
||||
|
||||
double sd = GameMath::sqrt(xd * xd + zd * zd);
|
||||
double sd = Mth::sqrt(xd * xd + zd * zd);
|
||||
|
||||
float yRotD = (float)(atan2(zd, xd) * 180 / std::numbers::pi) - 90;
|
||||
float xRotD = (float)-(atan2(yd, sd) * 180 / std::numbers::pi);
|
||||
|
|
@ -514,7 +514,7 @@ bool Mob::isLookingAtAnEntity() { return lookingAt != nullptr; }
|
|||
std::shared_ptr<Entity> Mob::getLookingAt() { return lookingAt; }
|
||||
|
||||
float Mob::rotlerp(float a, float b, float max) {
|
||||
float diff = GameMath::wrapDegrees(b - a);
|
||||
float diff = Mth::wrapDegrees(b - a);
|
||||
if (diff > max) {
|
||||
diff = max;
|
||||
}
|
||||
|
|
@ -886,9 +886,9 @@ void Mob::restoreLeashFromSave() {
|
|||
// resolve bug 10327 :Gameplay: NPCs can spawn over chunks that have not yet
|
||||
// been streamed and display jitter.
|
||||
bool Mob::shouldRender(Vec3* c) {
|
||||
if (!level->reallyHasChunksAt(GameMath::floor(bb.x0), GameMath::floor(bb.y0),
|
||||
GameMath::floor(bb.z0), GameMath::floor(bb.x1),
|
||||
GameMath::floor(bb.y1), GameMath::floor(bb.z1))) {
|
||||
if (!level->reallyHasChunksAt(Mth::floor(bb.x0), Mth::floor(bb.y0),
|
||||
Mth::floor(bb.z0), Mth::floor(bb.x1),
|
||||
Mth::floor(bb.y1), Mth::floor(bb.z1))) {
|
||||
return false;
|
||||
}
|
||||
return Entity::shouldRender(c);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void PathfinderMob::serverAiStep() {
|
|||
// protected.
|
||||
considerForExtraWandering(isDespawnProtected());
|
||||
|
||||
int yFloor = GameMath::floor(bb.y0 + 0.5f);
|
||||
int yFloor = Mth::floor(bb.y0 + 0.5f);
|
||||
|
||||
bool inWater = isInWater();
|
||||
bool inLava = isInLava();
|
||||
|
|
@ -140,7 +140,7 @@ void PathfinderMob::serverAiStep() {
|
|||
double zd = target->z - z;
|
||||
double yd = target->y - yFloor;
|
||||
float yRotD = (float)(atan2(zd, xd) * 180 / std::numbers::pi) - 90;
|
||||
float rotDiff = GameMath::wrapDegrees(yRotD - yRot);
|
||||
float rotDiff = Mth::wrapDegrees(yRotD - yRot);
|
||||
yya = (float)getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)
|
||||
->getValue();
|
||||
if (rotDiff > MAX_TURN) {
|
||||
|
|
@ -191,15 +191,15 @@ void PathfinderMob::findRandomStrollLocation(
|
|||
// request that only stroll locations in one quadrant be found. If -1 is
|
||||
// passed then behaviour is the same as the java game
|
||||
int xt, zt;
|
||||
int yt = GameMath::floor(y + random->nextInt(7) - 3);
|
||||
int yt = Mth::floor(y + random->nextInt(7) - 3);
|
||||
if (quadrant == -1) {
|
||||
xt = GameMath::floor(x + random->nextInt(13) - 6);
|
||||
zt = GameMath::floor(z + random->nextInt(13) - 6);
|
||||
xt = Mth::floor(x + random->nextInt(13) - 6);
|
||||
zt = Mth::floor(z + random->nextInt(13) - 6);
|
||||
} else {
|
||||
int sx = ((quadrant & 1) ? -1 : 1);
|
||||
int sz = ((quadrant & 2) ? -1 : 1);
|
||||
xt = GameMath::floor(x + random->nextInt(7) * sx);
|
||||
zt = GameMath::floor(z + random->nextInt(7) * sz);
|
||||
xt = Mth::floor(x + random->nextInt(7) * sx);
|
||||
zt = Mth::floor(z + random->nextInt(7) * sz);
|
||||
}
|
||||
float value = getWalkTargetValue(xt, yt, zt);
|
||||
if (value > best) {
|
||||
|
|
@ -226,9 +226,9 @@ std::shared_ptr<Entity> PathfinderMob::findAttackTarget() {
|
|||
}
|
||||
|
||||
bool PathfinderMob::canSpawn() {
|
||||
int xt = GameMath::floor(x);
|
||||
int yt = GameMath::floor(bb.y0);
|
||||
int zt = GameMath::floor(z);
|
||||
int xt = Mth::floor(x);
|
||||
int yt = Mth::floor(bb.y0);
|
||||
int zt = Mth::floor(z);
|
||||
return this->Mob::canSpawn() && getWalkTargetValue(xt, yt, zt) >= 0;
|
||||
}
|
||||
|
||||
|
|
@ -249,7 +249,7 @@ void PathfinderMob::setAttackTarget(std::shared_ptr<Entity> attacker) {
|
|||
|
||||
// might move to navigation, might make area
|
||||
bool PathfinderMob::isWithinRestriction() {
|
||||
return isWithinRestriction(GameMath::floor(x), GameMath::floor(y), GameMath::floor(z));
|
||||
return isWithinRestriction(Mth::floor(x), Mth::floor(y), Mth::floor(z));
|
||||
}
|
||||
|
||||
bool PathfinderMob::isWithinRestriction(int x, int y, int z) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ void BodyControl::clientTick() {
|
|||
}
|
||||
|
||||
float BodyControl::clamp(float clampTo, float clampFrom, float clampAngle) {
|
||||
float headDiffBody = GameMath::wrapDegrees(clampTo - clampFrom);
|
||||
float headDiffBody = Mth::wrapDegrees(clampTo - clampFrom);
|
||||
if (headDiffBody < -clampAngle) headDiffBody = -clampAngle;
|
||||
if (headDiffBody >= clampAngle) headDiffBody = +clampAngle;
|
||||
return clampTo - headDiffBody;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ void LookControl::tick() {
|
|||
mob->yHeadRot = rotlerp(mob->yHeadRot, mob->yBodyRot, 10);
|
||||
}
|
||||
|
||||
float headDiffBody = GameMath::wrapDegrees(mob->yHeadRot - mob->yBodyRot);
|
||||
float headDiffBody = Mth::wrapDegrees(mob->yHeadRot - mob->yBodyRot);
|
||||
|
||||
if (!mob->getNavigation()->isDone()) {
|
||||
// head clamped to body
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ void MoveControl::tick() {
|
|||
}
|
||||
|
||||
float MoveControl::rotlerp(float a, float b, float max) {
|
||||
float diff = GameMath::wrapDegrees(b - a);
|
||||
float diff = Mth::wrapDegrees(b - a);
|
||||
if (diff > max) {
|
||||
diff = max;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,17 +46,17 @@ void ControlledByPlayerGoal::tick() {
|
|||
std::dynamic_pointer_cast<Player>(mob->rider.lock());
|
||||
PathfinderMob* pig = (PathfinderMob*)mob;
|
||||
|
||||
float yrd = GameMath::wrapDegrees(player->yRot - mob->yRot) * 0.5f;
|
||||
float yrd = Mth::wrapDegrees(player->yRot - mob->yRot) * 0.5f;
|
||||
if (yrd > 5) yrd = 5;
|
||||
if (yrd < -5) yrd = -5;
|
||||
|
||||
mob->yRot = GameMath::wrapDegrees(mob->yRot + yrd);
|
||||
mob->yRot = Mth::wrapDegrees(mob->yRot + yrd);
|
||||
if (speed < maxSpeed) speed += (maxSpeed - speed) * 0.01f;
|
||||
if (speed > maxSpeed) speed = maxSpeed;
|
||||
|
||||
int x = GameMath::floor(mob->x);
|
||||
int y = GameMath::floor(mob->y);
|
||||
int z = GameMath::floor(mob->z);
|
||||
int x = Mth::floor(mob->x);
|
||||
int y = Mth::floor(mob->y);
|
||||
int z = Mth::floor(mob->z);
|
||||
float moveSpeed = speed;
|
||||
if (boosting) {
|
||||
if (boostTime++ > boostTimeTotal) {
|
||||
|
|
@ -85,7 +85,7 @@ void ControlledByPlayerGoal::tick() {
|
|||
float xa = -(normMoveSpeed * sin);
|
||||
float za = normMoveSpeed * cos;
|
||||
|
||||
if (GameMath::abs(xa) > GameMath::abs(za)) {
|
||||
if (Mth::abs(xa) > Mth::abs(za)) {
|
||||
if (xa < 0) xa -= mob->bbWidth / 2.0f;
|
||||
if (xa > 0) xa += mob->bbWidth / 2.0f;
|
||||
za = 0;
|
||||
|
|
@ -95,12 +95,12 @@ void ControlledByPlayerGoal::tick() {
|
|||
if (za > 0) za += mob->bbWidth / 2.0f;
|
||||
}
|
||||
|
||||
int xt = GameMath::floor(mob->x + xa);
|
||||
int zt = GameMath::floor(mob->z + za);
|
||||
int xt = Mth::floor(mob->x + xa);
|
||||
int zt = Mth::floor(mob->z + za);
|
||||
|
||||
Node* size = new Node(GameMath::floor(mob->bbWidth + 1),
|
||||
GameMath::floor(mob->bbHeight + player->bbHeight + 1),
|
||||
GameMath::floor(mob->bbWidth + 1));
|
||||
Node* size = new Node(Mth::floor(mob->bbWidth + 1),
|
||||
Mth::floor(mob->bbHeight + player->bbHeight + 1),
|
||||
Mth::floor(mob->bbWidth + 1));
|
||||
|
||||
if (x != xt || z != zt) {
|
||||
if (PathFinder::isFree(mob, xt, y, zt, size, false, false, true) ==
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ bool DoorInteractGoal::canUse() {
|
|||
return true;
|
||||
}
|
||||
|
||||
doorX = GameMath::floor(mob->x);
|
||||
doorY = GameMath::floor(mob->y + 1);
|
||||
doorZ = GameMath::floor(mob->z);
|
||||
doorX = Mth::floor(mob->x);
|
||||
doorY = Mth::floor(mob->y + 1);
|
||||
doorZ = Mth::floor(mob->z);
|
||||
doorTile = getDoorTile(doorX, doorY, doorZ);
|
||||
return doorTile != nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ EatTileGoal::EatTileGoal(Mob* mob) {
|
|||
bool EatTileGoal::canUse() {
|
||||
if (mob->getRandom()->nextInt(mob->isBaby() ? 50 : 1000) != 0) return false;
|
||||
|
||||
int xx = GameMath::floor(mob->x);
|
||||
int yy = GameMath::floor(mob->y);
|
||||
int zz = GameMath::floor(mob->z);
|
||||
int xx = Mth::floor(mob->x);
|
||||
int yy = Mth::floor(mob->y);
|
||||
int zz = Mth::floor(mob->z);
|
||||
if (level->getTile(xx, yy, zz) == Tile::tallgrass_Id &&
|
||||
level->getData(xx, yy, zz) == TallGrass::TALL_GRASS)
|
||||
return true;
|
||||
|
|
@ -46,9 +46,9 @@ void EatTileGoal::tick() {
|
|||
eatAnimationTick = std::max(0, eatAnimationTick - 1);
|
||||
if (eatAnimationTick != 4) return;
|
||||
|
||||
int xx = GameMath::floor(mob->x);
|
||||
int yy = GameMath::floor(mob->y);
|
||||
int zz = GameMath::floor(mob->z);
|
||||
int xx = Mth::floor(mob->x);
|
||||
int yy = Mth::floor(mob->y);
|
||||
int zz = Mth::floor(mob->z);
|
||||
|
||||
if (level->getTile(xx, yy, zz) == Tile::tallgrass_Id) {
|
||||
level->destroyTile(xx, yy, zz, false);
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ FleeSunGoal::FleeSunGoal(PathfinderMob* mob, double speedModifier) {
|
|||
bool FleeSunGoal::canUse() {
|
||||
if (!level->isDay()) return false;
|
||||
if (!mob->isOnFire()) return false;
|
||||
if (!level->canSeeSky(GameMath::floor(mob->x), (int)mob->bb.y0,
|
||||
GameMath::floor(mob->z)))
|
||||
if (!level->canSeeSky(Mth::floor(mob->x), (int)mob->bb.y0,
|
||||
Mth::floor(mob->z)))
|
||||
return false;
|
||||
|
||||
auto pos = getHidePos();
|
||||
|
|
@ -38,9 +38,9 @@ void FleeSunGoal::start() {
|
|||
std::optional<Vec3> FleeSunGoal::getHidePos() {
|
||||
Random* random = mob->getRandom();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int xt = GameMath::floor(mob->x + random->nextInt(20) - 10);
|
||||
int yt = GameMath::floor(mob->bb.y0 + random->nextInt(6) - 3);
|
||||
int zt = GameMath::floor(mob->z + random->nextInt(20) - 10);
|
||||
int xt = Mth::floor(mob->x + random->nextInt(20) - 10);
|
||||
int yt = Mth::floor(mob->bb.y0 + random->nextInt(6) - 3);
|
||||
int zt = Mth::floor(mob->z + random->nextInt(20) - 10);
|
||||
if (!level->canSeeSky(xt, yt, zt) &&
|
||||
mob->getWalkTargetValue(xt, yt, zt) < 0)
|
||||
return Vec3(xt, yt, zt);
|
||||
|
|
|
|||
|
|
@ -67,9 +67,9 @@ void FollowOwnerGoal::tick() {
|
|||
return;
|
||||
|
||||
// find a good spawn position nearby the owner
|
||||
int sx = GameMath::floor(owner.lock()->x) - 2;
|
||||
int sz = GameMath::floor(owner.lock()->z) - 2;
|
||||
int y = GameMath::floor(owner.lock()->bb.y0);
|
||||
int sx = Mth::floor(owner.lock()->x) - 2;
|
||||
int sz = Mth::floor(owner.lock()->z) - 2;
|
||||
int y = Mth::floor(owner.lock()->bb.y0);
|
||||
for (int x = 0; x <= 4; x++) {
|
||||
for (int z = 0; z <= 4; z++) {
|
||||
if (x >= 1 && z >= 1 && x <= 3 && z <= 3) {
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ bool MakeLoveGoal::canUse() {
|
|||
if (villager->getAge() != 0) return false;
|
||||
if (villager->getRandom()->nextInt(500) != 0) return false;
|
||||
|
||||
village = level->villages->getClosestVillage(GameMath::floor(villager->x),
|
||||
GameMath::floor(villager->y),
|
||||
GameMath::floor(villager->z), 0);
|
||||
village = level->villages->getClosestVillage(Mth::floor(villager->x),
|
||||
Mth::floor(villager->y),
|
||||
Mth::floor(villager->z), 0);
|
||||
if (village.lock() == nullptr) return false;
|
||||
if (!villageNeedsMoreVillagers()) return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ bool MeleeAttackGoal::canContinueToUse() {
|
|||
if (target == nullptr) return false;
|
||||
if (!target->isAlive()) return false;
|
||||
if (!trackTarget) return !mob->getNavigation()->isDone();
|
||||
if (!mob->isWithinRestriction(GameMath::floor(target->x), GameMath::floor(target->y),
|
||||
GameMath::floor(target->z)))
|
||||
if (!mob->isWithinRestriction(Mth::floor(target->x), Mth::floor(target->y),
|
||||
Mth::floor(target->z)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ bool MoveIndoorsGoal::canUse() {
|
|||
if (insideX != -1 && mob->distanceToSqr(insideX, mob->y, insideZ) < 2 * 2)
|
||||
return false;
|
||||
std::shared_ptr<Village> village = mob->level->villages->getClosestVillage(
|
||||
GameMath::floor(mob->x), GameMath::floor(mob->y), GameMath::floor(mob->z), 14);
|
||||
Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 14);
|
||||
if (village == nullptr) return false;
|
||||
std::shared_ptr<DoorInfo> _doorInfo = village->getBestDoorInfo(
|
||||
GameMath::floor(mob->x), GameMath::floor(mob->y), GameMath::floor(mob->z));
|
||||
Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z));
|
||||
doorInfo = _doorInfo;
|
||||
return _doorInfo != nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ bool MoveThroughVillageGoal::canUse() {
|
|||
if (onlyAtNight && mob->level->isDay()) return false;
|
||||
|
||||
std::shared_ptr<Village> village = mob->level->villages->getClosestVillage(
|
||||
GameMath::floor(mob->x), GameMath::floor(mob->y), GameMath::floor(mob->z), 0);
|
||||
Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 0);
|
||||
if (village == nullptr) return false;
|
||||
|
||||
std::shared_ptr<DoorInfo> _doorInfo = getNextDoorInfo(village);
|
||||
|
|
@ -93,8 +93,8 @@ std::shared_ptr<DoorInfo> MoveThroughVillageGoal::getNextDoorInfo(
|
|||
// for (DoorInfo di : doorInfos)
|
||||
for (auto it = doorInfos->begin(); it != doorInfos->end(); ++it) {
|
||||
std::shared_ptr<DoorInfo> di = *it;
|
||||
int distSqr = di->distanceToSqr(GameMath::floor(mob->x), GameMath::floor(mob->y),
|
||||
GameMath::floor(mob->z));
|
||||
int distSqr = di->distanceToSqr(Mth::floor(mob->x), Mth::floor(mob->y),
|
||||
Mth::floor(mob->z));
|
||||
if (distSqr < closestDistSqr) {
|
||||
if (hasVisited(di)) continue;
|
||||
closest = di;
|
||||
|
|
|
|||
|
|
@ -87,17 +87,17 @@ void RangedAttackGoal::tick() {
|
|||
if (--attackTime == 0) {
|
||||
if (targetDistSqr > attackRadiusSqr || !canSee) return;
|
||||
|
||||
float dist = GameMath::sqrt(targetDistSqr) / attackRadius;
|
||||
float dist = Mth::sqrt(targetDistSqr) / attackRadius;
|
||||
float power = dist;
|
||||
if (power < 0.1f) power = 0.1f;
|
||||
if (power > 1) power = 1;
|
||||
|
||||
rangedAttackMob->performRangedAttack(target.lock(), power);
|
||||
attackTime = GameMath::floor(dist * (attackIntervalMax - attackIntervalMin) +
|
||||
attackTime = Mth::floor(dist * (attackIntervalMax - attackIntervalMin) +
|
||||
attackIntervalMin);
|
||||
} else if (attackTime < 0) {
|
||||
float dist = GameMath::sqrt(targetDistSqr) / attackRadius;
|
||||
attackTime = GameMath::floor(dist * (attackIntervalMax - attackIntervalMin) +
|
||||
float dist = Mth::sqrt(targetDistSqr) / attackRadius;
|
||||
attackTime = Mth::floor(dist * (attackIntervalMax - attackIntervalMin) +
|
||||
attackIntervalMin);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,15 +12,15 @@ RestrictOpenDoorGoal::RestrictOpenDoorGoal(PathfinderMob* mob) {
|
|||
bool RestrictOpenDoorGoal::canUse() {
|
||||
if (mob->level->isDay()) return false;
|
||||
std::shared_ptr<Village> village = mob->level->villages->getClosestVillage(
|
||||
GameMath::floor(mob->x), GameMath::floor(mob->y), GameMath::floor(mob->z), 16);
|
||||
Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 16);
|
||||
if (village == nullptr) return false;
|
||||
std::shared_ptr<DoorInfo> _doorInfo = village->getClosestDoorInfo(
|
||||
GameMath::floor(mob->x), GameMath::floor(mob->y), GameMath::floor(mob->z));
|
||||
Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z));
|
||||
if (_doorInfo == nullptr) return false;
|
||||
doorInfo = _doorInfo;
|
||||
return _doorInfo->distanceToInsideSqr(GameMath::floor(mob->x),
|
||||
GameMath::floor(mob->y),
|
||||
GameMath::floor(mob->z)) < 1.5 * 1.5;
|
||||
return _doorInfo->distanceToInsideSqr(Mth::floor(mob->x),
|
||||
Mth::floor(mob->y),
|
||||
Mth::floor(mob->z)) < 1.5 * 1.5;
|
||||
}
|
||||
|
||||
bool RestrictOpenDoorGoal::canContinueToUse() {
|
||||
|
|
@ -28,7 +28,7 @@ bool RestrictOpenDoorGoal::canContinueToUse() {
|
|||
std::shared_ptr<DoorInfo> _doorInfo = doorInfo.lock();
|
||||
if (_doorInfo == nullptr) return false;
|
||||
return !_doorInfo->removed &&
|
||||
_doorInfo->isInsideSide(GameMath::floor(mob->x), GameMath::floor(mob->z));
|
||||
_doorInfo->isInsideSide(Mth::floor(mob->x), Mth::floor(mob->z));
|
||||
}
|
||||
|
||||
void RestrictOpenDoorGoal::start() {
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ bool TargetGoal::canAttack(std::shared_ptr<LivingEntity> target,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!mob->isWithinRestriction(GameMath::floor(target->x), GameMath::floor(target->y),
|
||||
GameMath::floor(target->z)))
|
||||
if (!mob->isWithinRestriction(Mth::floor(target->x), Mth::floor(target->y),
|
||||
Mth::floor(target->z)))
|
||||
return false;
|
||||
|
||||
if (mustSee && !mob->getSensing()->canSee(target)) return false;
|
||||
|
|
@ -112,8 +112,8 @@ bool TargetGoal::canReach(std::shared_ptr<LivingEntity> target) {
|
|||
delete path;
|
||||
return false;
|
||||
}
|
||||
int xx = last->x - GameMath::floor(target->x);
|
||||
int zz = last->z - GameMath::floor(target->z);
|
||||
int xx = last->x - Mth::floor(target->x);
|
||||
int zz = last->z - Mth::floor(target->z);
|
||||
delete path;
|
||||
return xx * xx + zz * zz <= 1.5 * 1.5;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,15 +59,15 @@ float PathNavigation::getMaxDist() { return (float)dist->getValue(); }
|
|||
|
||||
Path* PathNavigation::createPath(double x, double y, double z) {
|
||||
if (!canUpdatePath()) return nullptr;
|
||||
return level->findPath(mob->shared_from_this(), GameMath::floor(x), (int)y,
|
||||
GameMath::floor(z), getMaxDist(), _canPassDoors,
|
||||
return level->findPath(mob->shared_from_this(), Mth::floor(x), (int)y,
|
||||
Mth::floor(z), getMaxDist(), _canPassDoors,
|
||||
_canOpenDoors, avoidWater, canFloat);
|
||||
}
|
||||
|
||||
bool PathNavigation::moveTo(double x, double y, double z,
|
||||
double speedModifier) {
|
||||
MemSect(52);
|
||||
Path* newPath = createPath(GameMath::floor(x), (int)y, GameMath::floor(z));
|
||||
Path* newPath = createPath(Mth::floor(x), (int)y, Mth::floor(z));
|
||||
MemSect(0);
|
||||
// No need to delete newPath here as this will be copied into the member
|
||||
// variable path and the class can assume responsibility for it
|
||||
|
|
@ -193,12 +193,12 @@ int PathNavigation::getSurfaceY() {
|
|||
|
||||
int surface = (int)(mob->bb.y0);
|
||||
int tileId =
|
||||
level->getTile(GameMath::floor(mob->x), surface, GameMath::floor(mob->z));
|
||||
level->getTile(Mth::floor(mob->x), surface, Mth::floor(mob->z));
|
||||
int steps = 0;
|
||||
while (tileId == Tile::water_Id || tileId == Tile::calmWater_Id) {
|
||||
++surface;
|
||||
tileId =
|
||||
level->getTile(GameMath::floor(mob->x), surface, GameMath::floor(mob->z));
|
||||
level->getTile(Mth::floor(mob->x), surface, Mth::floor(mob->z));
|
||||
if (++steps > 16) return (int)(mob->bb.y0);
|
||||
}
|
||||
return surface;
|
||||
|
|
@ -213,8 +213,8 @@ bool PathNavigation::isInLiquid() {
|
|||
}
|
||||
|
||||
void PathNavigation::trimPathFromSun() {
|
||||
if (level->canSeeSky(GameMath::floor(mob->x), (int)(mob->bb.y0 + 0.5),
|
||||
GameMath::floor(mob->z)))
|
||||
if (level->canSeeSky(Mth::floor(mob->x), (int)(mob->bb.y0 + 0.5),
|
||||
Mth::floor(mob->z)))
|
||||
return;
|
||||
|
||||
for (int i = 0; i < path->getSize(); ++i) {
|
||||
|
|
@ -228,8 +228,8 @@ void PathNavigation::trimPathFromSun() {
|
|||
|
||||
bool PathNavigation::canMoveDirectly(Vec3* startPos, Vec3* stopPos, int sx,
|
||||
int sy, int sz) {
|
||||
int gridPosX = GameMath::floor(startPos->x);
|
||||
int gridPosZ = GameMath::floor(startPos->z);
|
||||
int gridPosX = Mth::floor(startPos->x);
|
||||
int gridPosZ = Mth::floor(startPos->z);
|
||||
|
||||
double dirX = stopPos->x - startPos->x;
|
||||
double dirZ = stopPos->z - startPos->z;
|
||||
|
|
@ -260,8 +260,8 @@ bool PathNavigation::canMoveDirectly(Vec3* startPos, Vec3* stopPos, int sx,
|
|||
|
||||
int stepX = dirX < 0 ? -1 : 1;
|
||||
int stepZ = dirZ < 0 ? -1 : 1;
|
||||
int gridGoalX = GameMath::floor(stopPos->x);
|
||||
int gridGoalZ = GameMath::floor(stopPos->z);
|
||||
int gridGoalX = Mth::floor(stopPos->x);
|
||||
int gridGoalZ = Mth::floor(stopPos->z);
|
||||
int currentDirX = gridGoalX - gridPosX;
|
||||
int currentDirZ = gridGoalZ - gridPosZ;
|
||||
while (currentDirX * stepX > 0 || currentDirZ * stepZ > 0) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ std::optional<Vec3> RandomPos::generateRandomPos(
|
|||
if (mob->hasRestriction()) {
|
||||
double restDist =
|
||||
mob->getRestrictCenter()->distSqr(
|
||||
GameMath::floor(mob->x), GameMath::floor(mob->y), GameMath::floor(mob->z)) +
|
||||
Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)) +
|
||||
4;
|
||||
double radius = mob->getRestrictRadius() + xzDist;
|
||||
bRestrict = restDist < radius * radius;
|
||||
|
|
@ -70,9 +70,9 @@ std::optional<Vec3> RandomPos::generateRandomPos(
|
|||
|
||||
if (dir != nullptr && xt * dir->x + zt * dir->z < 0) continue;
|
||||
|
||||
xt += GameMath::floor(mob->x);
|
||||
yt += GameMath::floor(mob->y);
|
||||
zt += GameMath::floor(mob->z);
|
||||
xt += Mth::floor(mob->x);
|
||||
yt += Mth::floor(mob->y);
|
||||
zt += Mth::floor(mob->z);
|
||||
|
||||
if (bRestrict && !mob->isWithinRestriction(xt, yt, zt)) continue;
|
||||
float value = mob->getWalkTargetValue(xt, yt, zt);
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ int Village::getStanding(const std::wstring& playerName) {
|
|||
|
||||
int Village::modifyStanding(const std::wstring& playerName, int delta) {
|
||||
int current = getStanding(playerName);
|
||||
int newValue = GameMath::clamp(current + delta, -30, 10);
|
||||
int newValue = Mth::clamp(current + delta, -30, 10);
|
||||
playerStanding.insert(std::pair<std::wstring, int>(playerName, newValue));
|
||||
return newValue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ void Bat::tick() {
|
|||
|
||||
if (isResting()) {
|
||||
xd = yd = zd = 0;
|
||||
y = GameMath::floor(y) + 1.0 - bbHeight;
|
||||
y = Mth::floor(y) + 1.0 - bbHeight;
|
||||
} else {
|
||||
yd *= .6f;
|
||||
}
|
||||
|
|
@ -96,8 +96,8 @@ void Bat::newServerAiStep() {
|
|||
AmbientCreature::newServerAiStep();
|
||||
|
||||
if (isResting()) {
|
||||
if (!level->isSolidBlockingTile(GameMath::floor(x), (int)y + 1,
|
||||
GameMath::floor(z))) {
|
||||
if (!level->isSolidBlockingTile(Mth::floor(x), (int)y + 1,
|
||||
Mth::floor(z))) {
|
||||
setResting(false);
|
||||
level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, (int)x,
|
||||
(int)y, (int)z, 0);
|
||||
|
|
@ -138,13 +138,13 @@ void Bat::newServerAiStep() {
|
|||
zd = zd + (signum(dz) * .5f - zd) * .1f;
|
||||
|
||||
float yRotD = (float)(atan2(zd, xd) * 180 / std::numbers::pi) - 90;
|
||||
float rotDiff = GameMath::wrapDegrees(yRotD - yRot);
|
||||
float rotDiff = Mth::wrapDegrees(yRotD - yRot);
|
||||
yya = .5f;
|
||||
yRot += rotDiff;
|
||||
|
||||
if (random->nextInt(100) == 0 &&
|
||||
level->isSolidBlockingTile(GameMath::floor(x), (int)y + 1,
|
||||
GameMath::floor(z))) {
|
||||
level->isSolidBlockingTile(Mth::floor(x), (int)y + 1,
|
||||
Mth::floor(z))) {
|
||||
setResting(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -185,11 +185,11 @@ void Bat::addAdditonalSaveData(CompoundTag* entityTag) {
|
|||
}
|
||||
|
||||
bool Bat::canSpawn() {
|
||||
int yt = GameMath::floor(bb.y0);
|
||||
int yt = Mth::floor(bb.y0);
|
||||
if (yt >= level->seaLevel) return false;
|
||||
|
||||
int xt = GameMath::floor(x);
|
||||
int zt = GameMath::floor(z);
|
||||
int xt = Mth::floor(x);
|
||||
int zt = Mth::floor(z);
|
||||
|
||||
int br = level->getRawBrightness(xt, yt, zt);
|
||||
int maxLight = 4;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue