Made changes to skin related code

Renamed all Alex skins and Developer Steve skin to match the official file names, reordered default skin to match the order in the official release of LCE, modified model type logic to be more optimized, added more anim flags to HumanoidModel.h, added code to show armor if the corresponding part is hidden but the "show armor" part anim flag is present, added code to handle extra skin box values of "hide with armor", "mirror skin box", and "scale", corrected player model second/overlay layer scale from 0.5 to 0.25, and fixed skin boxes not rendering on 64x64 DLC skins.
This commit is contained in:
Langtanium
2026-06-22 15:14:52 -07:00
committed by Langtanium
parent a4cc0659b5
commit bccca54ea0
43 changed files with 249 additions and 339 deletions
+11 -92
View File
@@ -8,29 +8,23 @@
#include "../Minecraft.World/Arrow.h"
#include "../Minecraft.World/Mth.h"
#include "../Minecraft.World/Player.h"
#include "Skins.h"
ResourceLocation LivingEntityRenderer::ENCHANT_GLINT_LOCATION = ResourceLocation(TN__BLUR__MISC_GLINT);
int LivingEntityRenderer::MAX_ARMOR_LAYERS = 4;
LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow, bool slimHands, bool createNewVar)
LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow, bool isPlayer)
{
this->model = model;
if (slimHands == true)
this->modelSlim = new HumanoidModel(0, 0, 64, 32, true);
if (createNewVar)
if (isPlayer)
{
this->newModel = new HumanoidModel(0, 0, 64, 64, false, false);
if (slimHands == true)
this->newModelSlim = new HumanoidModel(0, 0, 64, 64, true, false);
this->modelWide = new HumanoidModel(0, 0, 64, 64, false);
this->modelSlim = new HumanoidModel(0, 0, 64, 64, true);
}
shadowRadius = shadow;
armor = nullptr;
resModel = model;
}
void LivingEntityRenderer::setArmor(Model *armor)
@@ -38,6 +32,11 @@ void LivingEntityRenderer::setArmor(Model *armor)
this->armor = armor;
}
void LivingEntityRenderer::setPlayerModelType(Model *humanoidModel)
{
resModel = humanoidModel;
}
float LivingEntityRenderer::rotlerp(float from, float to, float a)
{
float diff = to - from;
@@ -56,8 +55,6 @@ void LivingEntityRenderer::render(shared_ptr<Entity> _mob, double x, double y, d
}
shared_ptr<LivingEntity> mob = dynamic_pointer_cast<LivingEntity>(_mob);
shared_ptr<Player> player = dynamic_pointer_cast<Player>(_mob);
Model *resModel = static_cast<HumanoidModel *>(model);
if (mob == nullptr)
{
@@ -67,30 +64,6 @@ void LivingEntityRenderer::render(shared_ptr<Entity> _mob, double x, double y, d
glPushMatrix();
glDisable(GL_CULL_FACE);
if (player != nullptr)
{
Textures *textures = Minecraft::GetInstance()->textures;
int skinId = player->getPlayerDefaultSkin() - 1;
int defaultSkin = player->getPlayerDefaultSkin() + 35;
if (slim[skinId] == true)
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel *>(newModelSlim);
else
resModel = static_cast<HumanoidModel *>(modelSlim);
}
else
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel *>(newModel);
else
resModel = static_cast<HumanoidModel *>(model);
}
}
else
resModel = static_cast<HumanoidModel *>(model);
resModel->attackTime = getAttackAnim(mob, a);
if (armor != nullptr) armor->attackTime = resModel->attackTime;
resModel->riding = mob->isRiding();
@@ -281,33 +254,6 @@ void LivingEntityRenderer::render(shared_ptr<Entity> _mob, double x, double y, d
void LivingEntityRenderer::renderModel(shared_ptr<LivingEntity> mob, float wp, float ws, float bob, float headRotMinusBodyRot, float headRotx, float scale)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>(mob);
Model *resModel = static_cast<HumanoidModel *>(model);
if (player != nullptr)
{
Textures *textures = Minecraft::GetInstance()->textures;
int skinId = player->getPlayerDefaultSkin() - 1;
int defaultSkin = player->getPlayerDefaultSkin() + 35;
if (slim[skinId] == true)
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel *>(newModelSlim);
else
resModel = static_cast<HumanoidModel *>(modelSlim);
}
else
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel *>(newModel);
else
resModel = static_cast<HumanoidModel *>(model);
}
}
else
resModel = static_cast<HumanoidModel *>(model);
bindTexture(mob);
if (!mob->isInvisible())
{
@@ -351,7 +297,7 @@ void LivingEntityRenderer::setupRotations(shared_ptr<LivingEntity> mob, float bo
else
{
wstring name = mob->getAName();
if (name == L"Dinnerbone" || name == L"Grumm")
if (name == L"Dinnerbone" || name == L"Grumm" || mob->getAnimOverrideBitmask() & (1 << HumanoidModel::eAnim_Dinnerbone))
{
if ( !mob->instanceof(eTYPE_PLAYER) || !dynamic_pointer_cast<Player>(mob)->isCapeHidden() )
{
@@ -379,33 +325,6 @@ void LivingEntityRenderer::additionalRendering(shared_ptr<LivingEntity> mob, flo
void LivingEntityRenderer::renderArrows(shared_ptr<LivingEntity> mob, float a)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>(mob);
Model *resModel = static_cast<HumanoidModel *>(model);
if (player != nullptr)
{
Textures *textures = Minecraft::GetInstance()->textures;
int skinId = player->getPlayerDefaultSkin() - 1;
int defaultSkin = player->getPlayerDefaultSkin() + 35;
if (slim[skinId] == true)
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel *>(newModelSlim);
else
resModel = static_cast<HumanoidModel *>(modelSlim);
}
else
{
if (textures->getHeight(player->customTextureUrl, defaultSkin) == 64)
resModel = static_cast<HumanoidModel *>(newModel);
else
resModel = static_cast<HumanoidModel *>(model);
}
}
else
resModel = static_cast<HumanoidModel *>(model);
int arrowCount = mob->getArrowCount();
if (arrowCount > 0)