neoLegacy/Minecraft.Client/RabbitRenderer.cpp
ChristianFalegnami 71018169b5 Rabbit-1
Added Brown Rabbit model and a basic ai system.
added toast variant, others have to be implemented.
TODO:
add other variants, add their spawn in the biomes, add IDS_RABBIT And change sounds.
ADD color to the spwanegg.
2026-03-12 23:51:35 +01:00

51 lines
1.9 KiB
C++

#include "stdafx.h"
#include "RabbitRenderer.h"
#include "RabbitModel.h"
#include "MobRenderer.h"
#include "../Minecraft.World/Rabbit.h"
ResourceLocation RabbitRenderer::LOC_BROWN = ResourceLocation(TN_MOB_RABBIT_BROWN);
ResourceLocation RabbitRenderer::LOC_WHITE = ResourceLocation(TN_MOB_RABBIT_WHITE);
ResourceLocation RabbitRenderer::LOC_BLACK = ResourceLocation(TN_MOB_RABBIT_BLACK);
ResourceLocation RabbitRenderer::LOC_GOLD = ResourceLocation(TN_MOB_RABBIT_GOLD);
ResourceLocation RabbitRenderer::LOC_SALT = ResourceLocation(TN_MOB_RABBIT_SALT);
ResourceLocation RabbitRenderer::LOC_WHITE_SPLOTCHED = ResourceLocation(TN_MOB_RABBIT_WHITE_SPLOTCHED);
ResourceLocation RabbitRenderer::LOC_TOAST = ResourceLocation(TN_MOB_RABBIT_TOAST);
ResourceLocation RabbitRenderer::LOC_EVIL = ResourceLocation(TN_MOB_RABBIT_CAERBANNOG);
RabbitRenderer::RabbitRenderer() : MobRenderer(new RabbitModel(), 0.3f)
{
}
ResourceLocation *RabbitRenderer::getTextureLocation(shared_ptr<Entity> entity)
{
shared_ptr<Rabbit> mob = dynamic_pointer_cast<Rabbit>(entity);
if (mob == nullptr) return &LOC_BROWN;
// easter egg toast
if (mob->hasCustomName() && mob->getCustomName() == L"Toast")
{
return &LOC_TOAST;
}
// variants
switch (mob->getVariant())
{
case Rabbit::Variant::WHITE: return &LOC_WHITE;
case Rabbit::Variant::BLACK: return &LOC_BLACK;
case Rabbit::Variant::GOLD: return &LOC_GOLD;
case Rabbit::Variant::SALT: return &LOC_SALT;
case Rabbit::Variant::WHITE_SPLOTCHED: return &LOC_WHITE_SPLOTCHED;
case Rabbit::Variant::EVIL: return &LOC_EVIL;
case Rabbit::Variant::BROWN:
default: return &LOC_BROWN;
}
}
void RabbitRenderer::scale(shared_ptr<LivingEntity> _mob, float a)
{
glScalef(0.65f, 0.65f, 0.65f);
}