mirror of
https://github.com/BluTac10/Xbox-Neo.git
synced 2026-05-22 02:46:50 +00:00
Notably also adds some metadata files for NixOS * add support for linux clang cross compiles * add linux clang instructions * un-capitalize Mob.horse.* * update the description in flake.nix --------- Co-authored-by: Loki <lokirautio@gmail.com>
65 lines
2.1 KiB
C++
65 lines
2.1 KiB
C++
#include "stdafx.h"
|
|
#include "SheepRenderer.h"
|
|
#include "MultiPlayerLocalPlayer.h"
|
|
#include "../Minecraft.World/net.minecraft.world.entity.animal.h"
|
|
|
|
ResourceLocation SheepRenderer::SHEEP_LOCATION = ResourceLocation(TN_MOB_SHEEP);
|
|
ResourceLocation SheepRenderer::SHEEP_FUR_LOCATION = ResourceLocation(TN_MOB_SHEEP_FUR);
|
|
|
|
SheepRenderer::SheepRenderer(Model *model, Model *armor, float shadow) : MobRenderer(model, shadow)
|
|
{
|
|
setArmor(armor);
|
|
}
|
|
|
|
int SheepRenderer::prepareArmor(shared_ptr<LivingEntity> _sheep, int layer, float a)
|
|
{
|
|
shared_ptr<Sheep> sheep = dynamic_pointer_cast<Sheep>(_sheep);
|
|
|
|
if (layer == 0 && !sheep->isSheared() &&
|
|
!sheep->isInvisibleTo(Minecraft::GetInstance()->player))
|
|
{
|
|
MemSect(31);
|
|
bindTexture(&SHEEP_FUR_LOCATION);
|
|
MemSect(0);
|
|
|
|
if (sheep->hasCustomName() && sheep->getCustomName().compare(L"jeb_") == 0)
|
|
{
|
|
int colorDuration = 25;
|
|
int value = (sheep->tickCount / colorDuration) + sheep->entityId;
|
|
int c1 = value % Sheep::COLOR_LENGTH;
|
|
int c2 = (value + 1) % Sheep::COLOR_LENGTH;
|
|
float subStep = ((sheep->tickCount % colorDuration) + a) / static_cast<float>(colorDuration);
|
|
|
|
float r = Sheep::COLOR[c1][0] * (1.0f - subStep) + Sheep::COLOR[c2][0] * subStep;
|
|
float g = Sheep::COLOR[c1][1] * (1.0f - subStep) + Sheep::COLOR[c2][1] * subStep;
|
|
float b = Sheep::COLOR[c1][2] * (1.0f - subStep) + Sheep::COLOR[c2][2] * subStep;
|
|
|
|
float brightness = SharedConstants::TEXTURE_LIGHTING ? 1.0f : sheep->getBrightness(a);
|
|
glColor3f(r * brightness, g * brightness, b * brightness);
|
|
}
|
|
else
|
|
{
|
|
int color = sheep->getColor();
|
|
|
|
float r = Sheep::COLOR[color][0];
|
|
float g = Sheep::COLOR[color][1];
|
|
float b = Sheep::COLOR[color][2];
|
|
|
|
float brightness = SharedConstants::TEXTURE_LIGHTING ? 1.0f : sheep->getBrightness(a);
|
|
glColor3f(r * brightness, g * brightness, b * brightness);
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
void SheepRenderer::render(shared_ptr<Entity> mob, double x, double y, double z, float rot, float a)
|
|
{
|
|
MobRenderer::render(mob, x, y, z, rot, a);
|
|
}
|
|
|
|
ResourceLocation *SheepRenderer::getTextureLocation(shared_ptr<Entity> mob)
|
|
{
|
|
return &SHEEP_LOCATION;
|
|
} |