Files
MinecraftConsoles/Minecraft.Client/MushroomCowRenderer.cpp
ModMaker101 a9be52c41a Project modernization (#630)
* Fixed boats falling and a TP glitch #266

* Replaced every C-style cast with C++ ones

* Replaced every C-style cast with C++ ones

* Fixed boats falling and a TP glitch #266

* Updated NULL to nullptr and fixing some type issues

* Modernized and fixed a few bugs

- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.

* Fixing more conflicts

* Replace int loops with size_t and start work on overrides
2026-03-08 09:56:03 +07:00

58 lines
2.0 KiB
C++

#include "stdafx.h"
#include "ModelPart.h"
#include "MushroomCowRenderer.h"
#include "TextureAtlas.h"
#include "QuadrupedModel.h"
#include "..\Minecraft.World\net.minecraft.world.entity.animal.h"
#include "..\Minecraft.World\net.minecraft.world.level.tile.h"
ResourceLocation MushroomCowRenderer::MOOSHROOM_LOCATION = ResourceLocation(TN_MOB_RED_COW);
MushroomCowRenderer::MushroomCowRenderer(Model *model, float shadow) : MobRenderer(model, shadow)
{
}
void MushroomCowRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
{
// 4J - original version used generics and thus had an input parameter of type MushroomCow rather than shared_ptr<Entity> we have here -
// do some casting around instead
//shared_ptr<MushroomCow> mob = dynamic_pointer_cast<MushroomCow>(_mob);
// 4J Stu - No need to do the cast, just pass through as-is
MobRenderer::render(_mob, x, y, z, rot, a);
}
void MushroomCowRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
{
// 4J - original version used generics and thus had an input parameter of type MushroomCow rather than shared_ptr<Mob> we have here -
// do some casting around instead
shared_ptr<MushroomCow> mob = dynamic_pointer_cast<MushroomCow>(_mob);
MobRenderer::additionalRendering(mob, a);
if (mob->isBaby()) return;
bindTexture(&TextureAtlas::LOCATION_BLOCKS); // 4J was "/terrain.png"
glEnable(GL_CULL_FACE);
glPushMatrix();
glScalef(1, -1, 1);
glTranslatef(0.2f, 0.4f, 0.5f);
glRotatef(42, 0, 1, 0);
tileRenderer->renderTile(Tile::mushroom_red, 0, 1);
glTranslatef(0.1f, 0, -0.6f);
glRotatef(42, 0, 1, 0);
tileRenderer->renderTile(Tile::mushroom_red, 0, 1);
glPopMatrix();
glPushMatrix();
static_cast<QuadrupedModel *>(model)->head->translateTo(1 / 16.0f);
glScalef(1, -1, 1);
glTranslatef(0, 0.75f, -0.2f);
glRotatef(12, 0, 1, 0);
tileRenderer->renderTile(Tile::mushroom_red, 0, 1);
glPopMatrix();
glDisable(GL_CULL_FACE);
}
ResourceLocation *MushroomCowRenderer::getTextureLocation(shared_ptr<Entity> mob)
{
return &MOOSHROOM_LOCATION;
}