aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/WitherBossRenderer.cpp
diff options
context:
space:
mode:
authordaoge <3523206925@qq.com>2026-03-03 03:04:10 +0800
committerGitHub <noreply@github.com>2026-03-03 03:04:10 +0800
commitb3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch)
tree267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.Client/WitherBossRenderer.cpp
parent84c31a2331f7a0ec85b9d438992e244f60e5020f (diff)
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict * feat: TU19 (Dec 2014) Features & Content (#32) * December 2014 files * Working release build * Fix compilation issues * Add sound to Windows64Media * Add DLC content and force Tutorial DLC * Revert "Add DLC content and force Tutorial DLC" This reverts commit 97a43994725008e35fceb984d5549df9c8cea470. * Disable broken light packing * Disable breakpoint during DLC texture map load Allows DLC loading but the DLC textures are still broken * Fix post build not working * ... * fix vs2022 build * fix cmake build --------- Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.Client/WitherBossRenderer.cpp')
-rw-r--r--Minecraft.Client/WitherBossRenderer.cpp110
1 files changed, 110 insertions, 0 deletions
diff --git a/Minecraft.Client/WitherBossRenderer.cpp b/Minecraft.Client/WitherBossRenderer.cpp
new file mode 100644
index 00000000..254a00bc
--- /dev/null
+++ b/Minecraft.Client/WitherBossRenderer.cpp
@@ -0,0 +1,110 @@
+#include "stdafx.h"
+#include "WitherBossRenderer.h"
+#include "WitherBossModel.h"
+#include "MobRenderer.h"
+#include "../Minecraft.World/WitherBoss.h"
+#include "../Minecraft.Client/BossMobGuiInfo.h"
+
+ResourceLocation WitherBossRenderer::WITHER_ARMOR_LOCATION = ResourceLocation(TN_MOB_WITHER_ARMOR);
+ResourceLocation WitherBossRenderer::WITHER_INVULERABLE_LOCATION = ResourceLocation(TN_MOB_WITHER_INVULNERABLE);
+ResourceLocation WitherBossRenderer::WITHER_LOCATION = ResourceLocation(TN_MOB_WITHER);
+
+
+WitherBossRenderer::WitherBossRenderer() : MobRenderer(new WitherBossModel(), 1.0f)
+{
+ modelVersion = dynamic_cast<WitherBossModel*>(model)->modelVersion();
+}
+
+void WitherBossRenderer::render(shared_ptr<Entity> entity, double x, double y, double z, float rot, float a)
+{
+ shared_ptr<WitherBoss> mob = dynamic_pointer_cast<WitherBoss>(entity);
+
+ BossMobGuiInfo::setBossHealth(mob, true);
+
+ int modelVersion = dynamic_cast<WitherBossModel*>(model)->modelVersion();
+ if (modelVersion != this->modelVersion)
+ {
+ this->modelVersion = modelVersion;
+ model = new WitherBossModel();
+ }
+ MobRenderer::render(entity, x, y, z, rot, a);
+}
+
+ResourceLocation *WitherBossRenderer::getTextureLocation(shared_ptr<Entity> entity)
+{
+ shared_ptr<WitherBoss> mob = dynamic_pointer_cast<WitherBoss>(entity);
+
+ int invulnerableTicks = mob->getInvulnerableTicks();
+ if (invulnerableTicks <= 0 || ( (invulnerableTicks <= (SharedConstants::TICKS_PER_SECOND * 4)) && (invulnerableTicks / 5) % 2 == 1) )
+ {
+ return &WITHER_LOCATION;
+ }
+ return &WITHER_INVULERABLE_LOCATION;
+}
+
+void WitherBossRenderer::scale(shared_ptr<LivingEntity> _mob, float a)
+{
+ shared_ptr<WitherBoss> mob = dynamic_pointer_cast<WitherBoss>(_mob);
+ int inTicks = mob->getInvulnerableTicks();
+ if (inTicks > 0)
+ {
+ float scale = 2.0f - (((float) inTicks - a) / (SharedConstants::TICKS_PER_SECOND * 11)) * .5f;
+ glScalef(scale, scale, scale);
+ }
+ else
+ {
+ glScalef(2, 2, 2);
+ }
+}
+
+int WitherBossRenderer::prepareArmor(shared_ptr<LivingEntity> entity, int layer, float a)
+{
+ shared_ptr<WitherBoss> mob = dynamic_pointer_cast<WitherBoss>(entity);
+
+ if (mob->isPowered())
+ {
+ if (mob->isInvisible())
+ {
+ glDepthMask(false);
+ }
+ else
+ {
+ glDepthMask(true);
+ }
+
+ if (layer == 1)
+ {
+ float time = mob->tickCount + a;
+ bindTexture(&WITHER_ARMOR_LOCATION);
+ glMatrixMode(GL_TEXTURE);
+ glLoadIdentity();
+ float uo = cos(time * 0.02f) * 3;
+ float vo = time * 0.01f;
+ glTranslatef(uo, vo, 0);
+ setArmor(model);
+ glMatrixMode(GL_MODELVIEW);
+ glEnable(GL_BLEND);
+ float br = 0.5f;
+ glColor4f(br, br, br, 1);
+ glDisable(GL_LIGHTING);
+ glBlendFunc(GL_ONE, GL_ONE);
+ glTranslatef(0, -.01f, 0);
+ glScalef(1.1f, 1.1f, 1.1f);
+ return 1;
+ }
+ if (layer == 2)
+ {
+ glMatrixMode(GL_TEXTURE);
+ glLoadIdentity();
+ glMatrixMode(GL_MODELVIEW);
+ glEnable(GL_LIGHTING);
+ glDisable(GL_BLEND);
+ }
+ }
+ return -1;
+}
+
+int WitherBossRenderer::prepareArmorOverlay(shared_ptr<LivingEntity> entity, int layer, float a)
+{
+ return -1;
+} \ No newline at end of file