This commit is contained in:
ItzSonicFaner 2026-03-15 12:42:16 +02:00
parent 0d4bd61c06
commit ceefe7558d
9 changed files with 229 additions and 5 deletions

View file

@ -259,6 +259,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
HumanoidModel *model;
Textures *t = Minecraft::GetInstance()->textures;
<<<<<<< Updated upstream
if (t->loadMemTexture(m_customTextureUrl, m_backupTexture) >= 46 && t->loadMemTexture(m_customTextureUrl, m_backupTexture) <= 53)
model = static_cast<HumanoidModel *>(renderer->getModelSlim());
@ -266,7 +267,17 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
model = static_cast<HumanoidModel *>(renderer->getModel());
else
model = static_cast<HumanoidModel *>(renderer->getModelCustom());
=======
>>>>>>> Stashed changes
if (t->loadMemTexture(m_customTextureUrl, m_backupTexture) >= 45 && t->loadMemTexture(m_customTextureUrl, m_backupTexture) <= 53)
model = static_cast<HumanoidModel *>(renderer->getNewModelSlim());
else if (t->loadMemTexture(m_customTextureUrl, m_backupTexture) == 54)
model = static_cast<HumanoidModel *>(renderer->getNewModel());
else
model = static_cast<HumanoidModel *>(renderer->getModel());
app.DebugPrintf("5rh56h56yhg6 %ls;\n", model);
//getAttackAnim(mob, a);
//if (armor != nullptr) armor->attackTime = model->attackTime;
//model->riding = mob->isRiding();

View file

@ -19,8 +19,14 @@ ResourceLocation EntityRenderer::SHADOW_LOCATION = ResourceLocation(TN__CLAMP__M
EntityRenderer::EntityRenderer()
{
model = nullptr;
<<<<<<< Updated upstream
modelCustom = nullptr;
modelSlim = nullptr;
=======
modelSlim = nullptr;
newModel = nullptr;
newModelSlim = nullptr;
>>>>>>> Stashed changes
tileRenderer = new TileRenderer();
shadowRadius = 0;
shadowStrength = 1.0f;

View file

@ -30,8 +30,14 @@ private:
protected:
Model *model; // TODO 4J: Check why exactly this is here, it seems to get shadowed by classes inheriting from this by their own
<<<<<<< Updated upstream
Model *modelCustom;
Model *modelSlim;
=======
Model *modelSlim;
Model *newModel;
Model *newModelSlim;
>>>>>>> Stashed changes
protected:
TileRenderer *tileRenderer; // 4J - changed to protected so derived classes can use instead of shadowing their own
@ -70,7 +76,13 @@ public:
public:
// 4J Added
virtual Model *getModel() { return model; }
<<<<<<< Updated upstream
virtual Model *getModelCustom() { return modelCustom; }
virtual Model *getModelSlim() { return modelSlim; }
=======
virtual Model *getModelSlim() { return modelSlim; }
virtual Model *getNewModel() { return newModel; }
virtual Model *getNewModelSlim() { return newModelSlim; }
>>>>>>> Stashed changes
virtual void SetItemFrame(bool bSet) {}
};

View file

@ -58,11 +58,21 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox)
return pNewBox;
}
<<<<<<< Updated upstream
void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, int skinType)
=======
void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, bool slimHands, bool mirror)
>>>>>>> Stashed changes
{
this->texWidth = texWidth;
this->texHeight = texHeight;
body_layer = nullptr;
arm0_layer = nullptr;
arm1_layer = nullptr;
leg0_layer = nullptr;
leg1_layer = nullptr;
m_fYOffset=yOffset;
cloak = new ModelPart(this, 0, 0);
cloak->addHumanoidBox(-5, -0, -1, 10, 16, 1, g); // Cloak
@ -78,10 +88,18 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, i
hair->addHumanoidBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Head
hair->setPos(0, 0 + yOffset, 0);
if (texWidth == 64 && texHeight == 64)
{
body_layer = new ModelPart(this, 16, 32);
body_layer->addHumanoidBox(-4, 0, -2, 8, 12, 4, g + 0.5);
body_layer->setPos(0, 0 + yOffset, 0);
}
body = new ModelPart(this, 16, 16);
body->addHumanoidBox(-4, 0, -2, 8, 12, 4, g); // Body
body->setPos(0, 0 + yOffset, 0);
<<<<<<< Updated upstream
arm0 = new ModelPart(this, 24 + 16, 16);
arm0->setPos(-5, 2 + yOffset, 0);
@ -105,12 +123,76 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, i
}
arm1->addHumanoidBox(-1, -2, -2, 4, 12, 4, g); // Arm1
}
=======
if (texWidth == 64 && texHeight == 64)
{
arm0 = new ModelPart(this, 24 + 16, 16);
arm1 = new ModelPart(this, 16 + 16, 48);
arm0_layer = new ModelPart(this, 24 + 16, 32);
arm1_layer = new ModelPart(this, 32 + 16, 48);
if (slimHands == false)
{
arm0_layer->addHumanoidBox(-3, -2, -2, 4, 12, 4, g + 0.5);
arm1_layer->addHumanoidBox(-1, -2, -2, 4, 12, 4, g + 0.5);
}
else if (slimHands == true)
{
arm0_layer->addHumanoidBox(-2, -2, -2, 3, 12, 4, g + 0.5);
arm1_layer->addHumanoidBox(-1, -2, -2, 3, 12, 4, g + 0.5);
}
arm0_layer->setPos(-5, 2 + yOffset, 0);
arm1_layer->setPos(5, 2 + yOffset, 0);
}
else if (texWidth == 64 && texHeight == 32)
{
arm0 = new ModelPart(this, 24 + 16, 16);
arm1 = new ModelPart(this, 24 + 16, 16);
}
if (slimHands == false)
{
arm0->addHumanoidBox(-3, -2, -2, 4, 12, 4, g);
arm1->addHumanoidBox(-1, -2, -2, 4, 12, 4, g);
}
else if (slimHands == true)
{
arm0->addHumanoidBox(-2, -2, -2, 3, 12, 4, g);
arm1->addHumanoidBox(-1, -2, -2, 3, 12, 4, g);
}
arm0->setPos(-5, 2 + yOffset, 0);
>>>>>>> Stashed changes
arm1->setPos(5, 2 + yOffset, 0);
leg0 = new ModelPart(this, 0, 16);
if (mirror == true)
arm1->bMirror = true;
if (texWidth == 64 && texHeight == 64)
{
leg0 = new ModelPart(this, 0, 16);
leg1 = new ModelPart(this, 16, 48);
leg0_layer = new ModelPart(this, 0, 32);
leg0_layer->addHumanoidBox(-2, 0, -2, 4, 12, 4, g + 0.5);
leg0_layer->setPos(-1.9, 12 + yOffset, 0);
leg1_layer = new ModelPart(this, 0, 48);
leg1_layer->addHumanoidBox(-2, 0, -2, 4, 12, 4, g + 0.5);
leg1_layer->setPos(1.9, 12 + yOffset, 0);
}
else if (texWidth == 64 && texHeight == 32)
{
leg0 = new ModelPart(this, 0, 16);
leg1 = new ModelPart(this, 0, 16);
}
leg0->addHumanoidBox(-2, 0, -2, 4, 12, 4, g); // Leg0
leg0->setPos(-1.9, 12 + yOffset, 0);
<<<<<<< Updated upstream
if (skinType >= 1)
leg1 = new ModelPart(this, 16, 16 * 3);
else
@ -118,9 +200,14 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, i
leg1 = new ModelPart(this, 0, 16);
leg1->bMirror = true;
}
=======
>>>>>>> Stashed changes
leg1->addHumanoidBox(-2, 0, -2, 4, 12, 4, g); // Leg1
leg1->setPos(1.9, 12 + yOffset, 0);
if (mirror == true)
leg1->bMirror = true;
// 4J added - compile now to avoid random performance hit first time cubes are rendered
// 4J Stu - Not just performance, but alpha+depth tests don't work right unless we compile here
cloak->compile(1.0f/16.0f);
@ -133,6 +220,17 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, i
leg1->compile(1.0f/16.0f);
hair->compile(1.0f/16.0f);
if (body_layer != 0)
body_layer->compile(1.0f/16.0f);
if (arm0_layer != 0)
arm0_layer->compile(1.0f/16.0f);
if (arm1_layer != 0)
arm1_layer->compile(1.0f/16.0f);
if (leg0_layer != 0)
leg0_layer->compile(1.0f/16.0f);
if (leg1_layer != 0)
leg1_layer->compile(1.0f/16.0f);
holdingLeftHand=0;
holdingRightHand=0;
sneaking=false;
@ -149,22 +247,44 @@ void HumanoidModel::_init(float g, float yOffset, int texWidth, int texHeight, i
HumanoidModel::HumanoidModel() : Model()
{
<<<<<<< Updated upstream
_init(0, 0, 64, 32, 0);
=======
_init(0, 0, 64, 32, false, true);
>>>>>>> Stashed changes
}
HumanoidModel::HumanoidModel(float g) : Model()
{
<<<<<<< Updated upstream
_init(g, 0, 64, 32, 0);
=======
_init(g, 0, 64, 32, false, true);
>>>>>>> Stashed changes
}
HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight) : Model()
{
<<<<<<< Updated upstream
_init(g,yOffset,texWidth,texHeight,0);
}
HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight, int skinType) : Model()
{
_init(g,yOffset,texWidth,texHeight,skinType);
=======
_init(g,yOffset,texWidth,texHeight, false, true);
}
HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands) : Model()
{
_init(g,yOffset,texWidth,texHeight, slimHands, true);
}
HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands, bool mirror) : Model()
{
_init(g,yOffset,texWidth,texHeight, slimHands, mirror);
>>>>>>> Stashed changes
}
void HumanoidModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)

View file

@ -4,7 +4,7 @@
class HumanoidModel : public Model
{
public:
ModelPart *head, *hair, *body, *arm0, *arm1, *leg0, *leg1, *ear, *cloak;
ModelPart *head, *hair, *body, *body_layer, *arm0, *arm0_layer, *arm1, *arm1_layer, *leg0, *leg0_layer, *leg1, *leg1_layer, *ear, *cloak;
//ModelPart *hat;
int holdingLeftHand;
@ -50,11 +50,20 @@ public:
(1<<HumanoidModel::eAnim_DisableRenderHair);
<<<<<<< Updated upstream
void _init(float g, float yOffset, int texWidth, int texHeight, int skinType); // 4J added
HumanoidModel();
HumanoidModel(float g);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, int skinType);
=======
void _init(float g, float yOffset, int texWidth, int texHeight, bool slimHands, bool mirror); // 4J added
HumanoidModel();
HumanoidModel(float g);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands, bool mirror);
>>>>>>> Stashed changes
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim = 0);
void renderHair(float scale, bool usecompiled);

View file

@ -12,11 +12,25 @@
ResourceLocation LivingEntityRenderer::ENCHANT_GLINT_LOCATION = ResourceLocation(TN__BLUR__MISC_GLINT);
int LivingEntityRenderer::MAX_ARMOR_LAYERS = 4;
LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow)
LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow, bool slimHands, bool createNewVar)
{
this->model = model;
<<<<<<< Updated upstream
this->modelCustom = new HumanoidModel(0, 0, 64, 64, 1);
this->modelSlim = new HumanoidModel(0, 0, 64, 64, 2);
=======
if (slimHands == true)
this->modelSlim = new HumanoidModel(0, 0, 64, 32, true);
if (createNewVar)
{
this->newModel = new HumanoidModel(0, 0, 64, 64, false, false);
if (slimHands == true)
this->newModelSlim = new HumanoidModel(0, 0, 64, 64, true, false);
}
>>>>>>> Stashed changes
shadowRadius = shadow;
armor = nullptr;
@ -56,9 +70,15 @@ void LivingEntityRenderer::render(shared_ptr<Entity> _mob, double x, double y, d
glPushMatrix();
glDisable(GL_CULL_FACE);
<<<<<<< Updated upstream
if (player != nullptr && model != nullptr && player->getCustomSkin() >= 0 && player->getCustomSkin() <= 9) resModel = model;
else if (player != nullptr && modelSlim != nullptr && player->getCustomSkin() >= 10 && player->getCustomSkin() <= 17) resModel = modelSlim;
else resModel = modelCustom;
=======
if (player != nullptr && newModel != nullptr && player->getCustomSkin() == 18) resModel = newModel;
else if (player != nullptr && newModelSlim != nullptr && player->getCustomSkin() >= 8 && player->getCustomSkin() <= 17) resModel = newModelSlim;
else resModel = model;
>>>>>>> Stashed changes
resModel->attackTime = getAttackAnim(mob, a);
if (armor != nullptr) armor->attackTime = resModel->attackTime;
@ -253,9 +273,15 @@ void LivingEntityRenderer::renderModel(shared_ptr<LivingEntity> mob, float wp, f
shared_ptr<Player> player = dynamic_pointer_cast<Player>(mob);
Model *resModel;
<<<<<<< Updated upstream
if (player != nullptr && model != nullptr && player->getCustomSkin() >= 0 && player->getCustomSkin() <= 9) resModel = model;
else if (player != nullptr && modelSlim != nullptr && player->getCustomSkin() >= 10 && player->getCustomSkin() <= 17) resModel = modelSlim;
else resModel = modelCustom;
=======
if (player != nullptr && newModel != nullptr && player->getCustomSkin() == 18) resModel = newModel;
else if (player != nullptr && newModelSlim != nullptr && player->getCustomSkin() >= 8 && player->getCustomSkin() <= 17) resModel = newModelSlim;
else resModel = model;
>>>>>>> Stashed changes
bindTexture(mob);
if (!mob->isInvisible())
@ -331,9 +357,15 @@ void LivingEntityRenderer::renderArrows(shared_ptr<LivingEntity> mob, float a)
shared_ptr<Player> player = dynamic_pointer_cast<Player>(mob);
Model *resModel;
<<<<<<< Updated upstream
if (player != nullptr && model != nullptr && player->getCustomSkin() >= 0 && player->getCustomSkin() <= 9) resModel = model;
else if (player != nullptr && modelSlim != nullptr && player->getCustomSkin() >= 10 && player->getCustomSkin() <= 17) resModel = modelSlim;
else resModel = modelCustom;
=======
if (player != nullptr && newModel != nullptr && player->getCustomSkin() == 18) resModel = newModel;
else if (player != nullptr && newModelSlim != nullptr && player->getCustomSkin() >= 8 && player->getCustomSkin() <= 17) resModel = newModelSlim;
else resModel = model;
>>>>>>> Stashed changes
int arrowCount = mob->getArrowCount();

View file

@ -19,7 +19,7 @@ protected:
Model *armor;
public:
LivingEntityRenderer(Model *model, float shadow);
LivingEntityRenderer(Model *model, float shadow, bool slimHands = 0, bool createNewVar = 0);
virtual void render(shared_ptr<Entity> mob, double x, double y, double z, float rot, float a);
virtual void setArmor(Model *armor);

View file

@ -55,11 +55,17 @@ static unsigned int nametagColorForIndex(int index)
ResourceLocation PlayerRenderer::DEFAULT_LOCATION = ResourceLocation(TN_MOB_CHAR);
PlayerRenderer::PlayerRenderer() : LivingEntityRenderer( new HumanoidModel(0), 0.5f )
PlayerRenderer::PlayerRenderer() : LivingEntityRenderer( new HumanoidModel(0), 0.5f, true, true )
{
humanoidModel = static_cast<HumanoidModel *>(model);
<<<<<<< Updated upstream
humanoidModelCustom = static_cast<HumanoidModel *>(modelCustom);
humanoidModelSlim = static_cast<HumanoidModel *>(modelSlim);
=======
humanoidModelSlim = static_cast<HumanoidModel *>(modelSlim);
newHumanoidModel = static_cast<HumanoidModel *>(newModel);
newHumanoidModelSlim = static_cast<HumanoidModel *>(newModelSlim);
>>>>>>> Stashed changes
armorParts1 = new HumanoidModel(1.0f);
armorParts2 = new HumanoidModel(0.5f);
@ -167,9 +173,15 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
if(mob == nullptr) return;
if(mob->hasInvisiblePrivilege()) return;
<<<<<<< Updated upstream
if (mob != nullptr && humanoidModel != nullptr && mob->getCustomSkin() >= 0 && mob->getCustomSkin() <= 9) resModel = humanoidModel;
else if (mob != nullptr && humanoidModelSlim != nullptr && mob->getCustomSkin() >= 10 && mob->getCustomSkin() <= 17) resModel = humanoidModelSlim;
else resModel = humanoidModelCustom;
=======
if (mob != nullptr && newHumanoidModel != nullptr && mob->getCustomSkin() == 18) resModel = newHumanoidModel;
else if (mob != nullptr && newHumanoidModelSlim != nullptr && mob->getCustomSkin() >= 8 && mob->getCustomSkin() <= 17) resModel = newHumanoidModelSlim;
else resModel = humanoidModel;
>>>>>>> Stashed changes
shared_ptr<ItemInstance> item = mob->inventory->getSelected();
@ -274,9 +286,15 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
shared_ptr<Player> mob = dynamic_pointer_cast<Player>(_mob);
HumanoidModel *resModel;
<<<<<<< Updated upstream
if (mob != nullptr && humanoidModel != nullptr && mob->getCustomSkin() >= 0 && mob->getCustomSkin() <= 9) resModel = humanoidModel;
else if (mob != nullptr && humanoidModelSlim != nullptr && mob->getCustomSkin() >= 10 && mob->getCustomSkin() <= 17) resModel = humanoidModelSlim;
else resModel = humanoidModelCustom;
=======
if (mob != nullptr && newHumanoidModel != nullptr && mob->getCustomSkin() == 18) resModel = newHumanoidModel;
else if (mob != nullptr && newHumanoidModelSlim != nullptr && mob->getCustomSkin() >= 8 && mob->getCustomSkin() <= 17) resModel = newHumanoidModelSlim;
else resModel = humanoidModel;
>>>>>>> Stashed changes
shared_ptr<ItemInstance> headGear = mob->inventory->getArmor(3);
if (headGear != nullptr)
@ -523,9 +541,15 @@ void PlayerRenderer::renderHand()
shared_ptr<Player> player = dynamic_pointer_cast<Player>(Minecraft::GetInstance()->player);
HumanoidModel *resModel;
<<<<<<< Updated upstream
if (player != nullptr && humanoidModel != nullptr && player->getCustomSkin() >= 0 && player->getCustomSkin() <= 9) resModel = humanoidModel;
else if (player != nullptr && humanoidModelSlim != nullptr && player->getCustomSkin() >= 10 && player->getCustomSkin() <= 17) resModel = humanoidModelSlim;
else resModel = humanoidModelCustom;
=======
if (player != nullptr && newHumanoidModel != nullptr && player->getCustomSkin() == 18) resModel = newHumanoidModel;
else if (player != nullptr && newHumanoidModelSlim != nullptr && player->getCustomSkin() >= 8 && player->getCustomSkin() <= 17) resModel = newHumanoidModelSlim;
else resModel = humanoidModel;
>>>>>>> Stashed changes
float brightness = 1;
glColor3f(brightness, brightness, brightness);

View file

@ -14,11 +14,21 @@ public:
private:
HumanoidModel *humanoidModel;
<<<<<<< Updated upstream
HumanoidModel *humanoidModelCustom;
HumanoidModel *humanoidModelSlim;
HumanoidModel *armorParts1;
HumanoidModel *armorParts2;
int defaultSkinType;
=======
HumanoidModel *humanoidModelSlim;
HumanoidModel *newHumanoidModel;
HumanoidModel *newHumanoidModelSlim;
HumanoidModel *armorParts1;
HumanoidModel *armorParts2;
bool defaultSlimHands;
>>>>>>> Stashed changes
public:
PlayerRenderer();