This commit is contained in:
ItzSonicFaner 2026-03-27 15:22:09 +02:00
parent c678f0d081
commit a0082658a5
143 changed files with 66 additions and 8 deletions

View file

@ -62,6 +62,7 @@ void LivingEntityRenderer::render(shared_ptr<Entity> _mob, double x, double y, d
{ {
return; return;
} }
app.DebugPrintf("LivingEntityRenderer::render called for type %d\n", _mob->GetType());
glPushMatrix(); glPushMatrix();
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
@ -416,8 +417,7 @@ void LivingEntityRenderer::renderArrows(shared_ptr<LivingEntity> mob, float a)
{ {
glPushMatrix(); glPushMatrix();
ModelPart *modelPart; ModelPart *modelPart = resModel->getRandomModelPart(random);
modelPart = resModel->getRandomModelPart(random);
Cube *cube = modelPart->cubes[random.nextInt(modelPart->cubes.size())]; Cube *cube = modelPart->cubes[random.nextInt(modelPart->cubes.size())];
modelPart->translateTo(1 / 16.0f); modelPart->translateTo(1 / 16.0f);

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "ResourceLocation.h" #include "ResourceLocation.h"
#include "EntityRenderer.h" #include "EntityRenderer.h"
#include "..\Minecraft.World\LivingEntity.h" #include "../Minecraft.World/LivingEntity.h"
class LivingEntity; class LivingEntity;

View file

@ -533,7 +533,7 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
} }
} }
void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, wstring msg, float scale, double dist) void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, const wstring &msg, float scale, double dist)
{ {
#if 0 #if 0
if (dist < 10 * 10) if (dist < 10 * 10)
@ -559,7 +559,17 @@ void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, d
} }
#endif #endif
LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist); shared_ptr<Player> pPlayer = dynamic_pointer_cast<Player>(player);
int color = getNametagColour(pPlayer->getPlayerIndex());
if (player->isSleeping())
{
renderNameTag(player, msg, x, y - 1.5f, z, 64, color);
}
else
{
renderNameTag(player, msg, x, y, z, 64, color);
}
} }
void PlayerRenderer::scale(shared_ptr<LivingEntity> player, float a) void PlayerRenderer::scale(shared_ptr<LivingEntity> player, float a)

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "MobRenderer.h" #include "MobRenderer.h"
#include "..\Minecraft.World\Player.h" #include "../Minecraft.World/Player.h"
class HumanoidModel; class HumanoidModel;

View file

@ -51,6 +51,13 @@ void SkullTileRenderer::renderSkull(float x, float y, float z, int face, float r
//model = zombieModel; //model = zombieModel;
break; break;
case SkullTileEntity::TYPE_CHAR: case SkullTileEntity::TYPE_CHAR:
{
Textures *textures = Minecraft::GetInstance()->textures;
if (getHeight(&PlayerRenderer::DEFAULT_LOCATION) == 64)
{
model = new SkeletonHeadModel(0, 0, 64, 64);
}
//if (!extra.empty()) //if (!extra.empty())
//{ //{
// wstring url = "http://skins.minecraft.net/MinecraftSkins/" + StringUtil.stripColor(extra) + ".png"; // wstring url = "http://skins.minecraft.net/MinecraftSkins/" + StringUtil.stripColor(extra) + ".png";
@ -67,6 +74,7 @@ void SkullTileRenderer::renderSkull(float x, float y, float z, int face, float r
bindTexture(&PlayerRenderer::DEFAULT_LOCATION); bindTexture(&PlayerRenderer::DEFAULT_LOCATION);
} }
break; break;
}
case SkullTileEntity::TYPE_CREEPER: case SkullTileEntity::TYPE_CREEPER:
bindTexture(&CREEPER_LOCATION); bindTexture(&CREEPER_LOCATION);
break; break;

View file

@ -1058,6 +1058,7 @@ int Textures::loadHttpTexture(const wstring& url, const wstring& backup)
} }
if (texture == nullptr || texture->id < 0) if (texture == nullptr || texture->id < 0)
{ {
if (backup.empty() ) return -1;
return loadTexture(TN_COUNT, backup); return loadTexture(TN_COUNT, backup);
} }
return texture->id; return texture->id;
@ -1209,7 +1210,6 @@ int Textures::loadMemTexture(const wstring& url, int backup)
return texture->id; return texture->id;
} }
// 4J-PB - adding for texture in memory (from global title storage)
int Textures::getHeight(const wstring& url, int backup) int Textures::getHeight(const wstring& url, int backup)
{ {
MemTexture *texture = nullptr; MemTexture *texture = nullptr;
@ -1262,6 +1262,37 @@ int Textures::getHeight(const wstring& url, int backup)
return texture->loadedImage->getHeight(); return texture->loadedImage->getHeight();
} }
int Textures::getHeight(ResourceLocation resource)
{
if (resource.isPreloaded())
{
TEXTURE_NAME tex = resource.getTexture();
BufferedImage* img = readImage(tex, wstring(preLoaded[tex]) + L".png");
if (img)
{
int h = img->getHeight();
delete img;
return h;
}
return 32;
}
const wstring& path = resource.getPath();
BufferedImage* img = readImage(TN_COUNT, path);
if (img)
{
int h = img->getHeight();
delete img;
return h;
}
return 32;
}
MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *processor) MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *processor)
{ {
MemTexture *texture = nullptr; MemTexture *texture = nullptr;

View file

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "..\Minecraft.World\ArrayWithLength.h" #include "../Minecraft.World/ArrayWithLength.h"
class DynamicTexture; class DynamicTexture;
class BufferedImage; class BufferedImage;
@ -341,6 +341,7 @@ public:
int loadMemTexture(const wstring& url, const wstring& backup); int loadMemTexture(const wstring& url, const wstring& backup);
int loadMemTexture(const wstring& url, int backup); int loadMemTexture(const wstring& url, int backup);
int getHeight(const wstring& url, int backup); int getHeight(const wstring& url, int backup);
int getHeight(ResourceLocation resource);
MemTexture * addMemTexture(const wstring& url, MemTextureProcessor *processor); MemTexture * addMemTexture(const wstring& url, MemTextureProcessor *processor);
//MemTexture * getMemTexture(const wstring& url, MemTextureProcessor *processor); //MemTexture * getMemTexture(const wstring& url, MemTextureProcessor *processor);
void removeMemTexture(const wstring& url); void removeMemTexture(const wstring& url);

View file

@ -14,6 +14,13 @@ void TileEntityRenderer::bindTexture(const wstring& urlTexture, ResourceLocation
if(t != nullptr) t->bind(t->loadHttpTexture(urlTexture, location->getTexture())); if(t != nullptr) t->bind(t->loadHttpTexture(urlTexture, location->getTexture()));
} }
int TileEntityRenderer::getHeight(ResourceLocation *location)
{
Textures *t = tileEntityRenderDispatcher->textures;
if(t != nullptr) return t->getHeight(location->getTexture());
return 32;
}
Level *TileEntityRenderer::getLevel() Level *TileEntityRenderer::getLevel()
{ {
return tileEntityRenderDispatcher->level; return tileEntityRenderDispatcher->level;

View file

@ -17,6 +17,7 @@ public:
protected: protected:
void bindTexture(ResourceLocation *location); // 4J - changed from wstring to int void bindTexture(ResourceLocation *location); // 4J - changed from wstring to int
void bindTexture(const wstring& urlTexture, ResourceLocation *location); // 4J - changed from wstring to int void bindTexture(const wstring& urlTexture, ResourceLocation *location); // 4J - changed from wstring to int
int getHeight(ResourceLocation *location); // 4J - changed from wstring to int
private: private:
Level *getLevel(); Level *getLevel();
public: public:

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more