TU46 Test content and patches

TU46 Test content, added missing commits by amending commit and cherry-picking to new branch, ready for iggy guis and tu46 bug fixes
This commit is contained in:
Tranqlmao authored and DrPerkyLegit committed 2026-10-22 13:55:39 -04:00
1 parent 8d6b69f599
commit ff562d1644
497 files changed
+11187 -771

No files matched your search

+53
View File
@@ -4,6 +4,9 @@
#include "net.minecraft.world.entity.ai.control.h"
#include "net.minecraft.world.entity.monster.h"
#include "net.minecraft.world.phys.h"
#include "net.minecraft.world.entity.ai.navigation.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.level.material.h"
#include "MoveControl.h"
const float MoveControl::MIN_SPEED = 0.0005f;
@@ -19,6 +22,9 @@ MoveControl::MoveControl(Mob *mob)
speedModifier = 0.0;
_hasWanted = false;
_strafing = false;
strafeForwards = 0;
strafeRight = 0;
}
bool MoveControl::hasWanted()
@@ -40,9 +46,56 @@ void MoveControl::setWantedPosition(double x, double y, double z, double speedMo
_hasWanted = true;
}
void MoveControl::strafe(float forwards, float right)
{
strafeForwards = forwards;
strafeRight = right;
speedModifier = 0.25;
_strafing = true;
}
void MoveControl::tick()
{
mob->setYya(0);
mob->xxa = 0;
if (_strafing)
{
_strafing = false;
_hasWanted = false;
float speed = static_cast<float>(speedModifier * mob->getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue());
float forwards = strafeForwards;
float right = strafeRight;
float length = Mth::sqrt(right * right + forwards * forwards);
if (length < 1.0f) length = 1.0f;
length = speed / length;
right *= length;
forwards *= length;
float sinYaw = Mth::sin(mob->yRot * PI / 180);
float cosYaw = Mth::cos(mob->yRot * PI / 180);
int tx = Mth::floor(mob->x + right * cosYaw - forwards * sinYaw + mob->xd);
int ty = Mth::floor(mob->y);
int tz = Mth::floor(mob->z + forwards * cosYaw + right * sinYaw + mob->zd);
Level *level = mob->level;
bool blocked = level->getMaterial(tx, ty, tz)->blocksMotion() || !level->getMaterial(tx, ty - 1, tz)->blocksMotion();
PathNavigation *navigation = mob->getNavigation();
bool sunlit = navigation != nullptr && navigation->getAvoidSun() && level->isDay() && level->canSeeSky(tx, ty, tz);
if (blocked || sunlit)
{
mob->LivingEntity::setSpeed(0);
if (!mob->hasImpulse)
{
mob->xd = 0;
mob->zd = 0;
}
return;
}
mob->LivingEntity::setSpeed(speed);
mob->setYya(strafeForwards);
mob->xxa = strafeRight;
return;
}
if (!_hasWanted) return;
_hasWanted = false;