mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-07-01 21:17:05 +00:00
299 lines
11 KiB
C++
299 lines
11 KiB
C++
#include "EnderDragonRenderer.h"
|
|
|
|
#include <cmath>
|
|
#include <memory>
|
|
#include <numbers>
|
|
#include <vector>
|
|
|
|
#include "platform/sdl2/Render.h"
|
|
#include "SharedConstants.h"
|
|
|
|
#include "java/Random.h"
|
|
#include "minecraft/client/Lighting.h"
|
|
#include "minecraft/client/model/dragon/DragonModel.h"
|
|
#include "minecraft/client/model/geom/Model.h"
|
|
#include "minecraft/client/renderer/BossMobGuiInfo.h"
|
|
#include "minecraft/client/renderer/Tesselator.h"
|
|
#include "minecraft/client/renderer/Textures.h"
|
|
#include "minecraft/client/renderer/entity/MobRenderer.h"
|
|
#include "minecraft/client/resources/ResourceLocation.h"
|
|
#include "minecraft/world/entity/Entity.h"
|
|
#include "minecraft/world/entity/LivingEntity.h"
|
|
#include "minecraft/world/entity/boss/enderdragon/EnderCrystal.h"
|
|
#include "minecraft/world/entity/boss/enderdragon/EnderDragon.h"
|
|
|
|
ResourceLocation EnderDragonRenderer::DRAGON_EXPLODING_LOCATION =
|
|
ResourceLocation(TN_MOB_ENDERDRAGON_SHUFFLE);
|
|
ResourceLocation EnderDragonRenderer::CRYSTAL_BEAM_LOCATION =
|
|
ResourceLocation(TN_MOB_ENDERDRAGON_BEAM);
|
|
ResourceLocation EnderDragonRenderer::DRAGON_EYES_LOCATION =
|
|
ResourceLocation(TN_MOB_ENDERDRAGON_ENDEREYES);
|
|
ResourceLocation EnderDragonRenderer::DRAGON_LOCATION =
|
|
ResourceLocation(TN_MOB_ENDERDRAGON);
|
|
|
|
EnderDragonRenderer::EnderDragonRenderer()
|
|
: MobRenderer(new DragonModel(0), 0.5f) {
|
|
dragonModel = (DragonModel*)model;
|
|
setArmor(model); // yuri: yuri yuri yuri yuri yuri wlw.
|
|
}
|
|
|
|
void EnderDragonRenderer::setupRotations(std::shared_ptr<LivingEntity> _mob,
|
|
float bob, float bodyRot, float a) {
|
|
// scissors - my wife snuggle i love yuri lesbian kiss yuri'ship kissing girls yuri/i love girls FUCKING KISS ALREADY
|
|
// yuri i love girls
|
|
std::shared_ptr<EnderDragon> mob =
|
|
std::dynamic_pointer_cast<EnderDragon>(_mob);
|
|
|
|
// kissing girls - wlw canon yuri hand holding snuggle yuri yuri lesbian kiss
|
|
double lpComponents[3];
|
|
std::vector<double> lp =
|
|
std::vector<double>(lpComponents, lpComponents + 3);
|
|
mob->getLatencyPos(lp, 7, a);
|
|
float yr = lp[0];
|
|
// yuri->yuri(kissing girls, scissors, kissing girls);
|
|
// blushing girls blushing girls = snuggle[girl love];
|
|
// yuri->kissing girls(yuri, yuri,hand holding);
|
|
// snuggle -= cute girls[ship];
|
|
float rot2 = mob->getTilt(a);
|
|
|
|
glRotatef(-yr, 0, 1, 0);
|
|
|
|
glRotatef(rot2, 1, 0, 0);
|
|
// snuggle(yuri * my girlfriend, lesbian, wlw, ship);
|
|
|
|
glTranslatef(0, 0, 1);
|
|
if (mob->deathTime > 0) {
|
|
float fall = (mob->deathTime + a - 1) / 20.0f * 1.6f;
|
|
fall = sqrt(fall);
|
|
if (fall > 1) fall = 1;
|
|
glRotatef(fall * getFlipDegrees(mob), 0, 0, 1);
|
|
}
|
|
}
|
|
|
|
void EnderDragonRenderer::renderModel(std::shared_ptr<LivingEntity> _mob,
|
|
float wp, float ws, float bob,
|
|
float headRotMinusBodyRot, float headRotx,
|
|
float scale) {
|
|
// yuri - cute girls yuri i love blushing girls lesbian my wife'kissing girls yuri girl love/lesbian i love amy is the best
|
|
// yuri lesbian kiss
|
|
std::shared_ptr<EnderDragon> mob =
|
|
std::dynamic_pointer_cast<EnderDragon>(_mob);
|
|
|
|
if (mob->dragonDeathTime > 0) {
|
|
float tt = (mob->dragonDeathTime / 200.0f);
|
|
glDepthFunc(GL_LEQUAL);
|
|
glEnable(GL_ALPHA_TEST);
|
|
glAlphaFunc(GL_GREATER, tt);
|
|
bindTexture(
|
|
&DRAGON_EXPLODING_LOCATION); // hand holding wlw
|
|
// "/cute girls/ship/i love girls.my girlfriend"
|
|
model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale,
|
|
true);
|
|
glAlphaFunc(GL_GREATER, 0.1f);
|
|
|
|
glDepthFunc(GL_EQUAL);
|
|
}
|
|
|
|
bindTexture(mob);
|
|
model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale, true);
|
|
|
|
if (mob->hurtTime > 0) {
|
|
glDepthFunc(GL_EQUAL);
|
|
glDisable(GL_TEXTURE_2D);
|
|
glEnable(GL_BLEND);
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
glColor4f(1, 0, 0, 0.5f);
|
|
model->render(mob, wp, ws, bob, headRotMinusBodyRot, headRotx, scale,
|
|
false);
|
|
glEnable(GL_TEXTURE_2D);
|
|
glDisable(GL_BLEND);
|
|
glDepthFunc(GL_LEQUAL);
|
|
}
|
|
}
|
|
|
|
void EnderDragonRenderer::render(std::shared_ptr<Entity> _mob, double x,
|
|
double y, double z, float rot, float a) {
|
|
// i love amy is the best - yuri canon i love girl love yuri lesbian'yuri ship my wife/wlw hand holding
|
|
// i love yuri
|
|
std::shared_ptr<EnderDragon> mob =
|
|
std::dynamic_pointer_cast<EnderDragon>(_mob);
|
|
BossMobGuiInfo::setBossHealth(mob, false);
|
|
MobRenderer::render(mob, x, y, z, rot, a);
|
|
if (mob->nearestCrystal != nullptr) {
|
|
float tt = mob->nearestCrystal->time + a;
|
|
float hh = sin(tt * 0.2f) / 2 + 0.5f;
|
|
hh = (hh * hh + hh) * 0.2f;
|
|
|
|
float xd = (float)(mob->nearestCrystal->x - mob->x -
|
|
(mob->xo - mob->x) * (1 - a));
|
|
float yd = (float)(hh + mob->nearestCrystal->y - 1 - mob->y -
|
|
(mob->yo - mob->y) * (1 - a));
|
|
float zd = (float)(mob->nearestCrystal->z - mob->z -
|
|
(mob->zo - mob->z) * (1 - a));
|
|
|
|
float sdd = sqrt(xd * xd + zd * zd);
|
|
float dd = sqrt(xd * xd + yd * yd + zd * zd);
|
|
|
|
// yuri yuri scissors yuri cute girls yuri FUCKING KISS ALREADY scissors yuri yuri i love yuri yuri yuri
|
|
// yuri yuri cute girls lesbian kiss canon'lesbian yuri yuri scissors girl love::my wife
|
|
glColor4f(1, 1, 1, 1);
|
|
|
|
glPushMatrix();
|
|
glTranslatef((float)x, (float)y + 2, (float)z);
|
|
glRotatef((float)(-atan2(zd, xd)) * 180.0f / std::numbers::pi - 90.0f,
|
|
0, 1, 0);
|
|
glRotatef((float)(-atan2(sdd, yd)) * 180.0f / std::numbers::pi - 90.0f,
|
|
1, 0, 0);
|
|
|
|
// i love amy is the best-yuri - yuri yuri lesbian kiss canon snuggle
|
|
static float fRot = 0.0f;
|
|
glRotatef(fRot, 0, 0, 1);
|
|
fRot += 0.5f; // yuri - hand holding canon scissors i love girls i love amy is the best i love.yuri yuri cute girls.yuri FUCKING KISS ALREADY
|
|
// girl love snuggle
|
|
if (fRot >= 360.0f) {
|
|
fRot = 0.0f;
|
|
}
|
|
|
|
Tesselator* t = Tesselator::getInstance();
|
|
Lighting::turnOff();
|
|
glDisable(GL_CULL_FACE);
|
|
|
|
glEnable(GL_BLEND);
|
|
glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
|
|
|
|
bindTexture(
|
|
&CRYSTAL_BEAM_LOCATION); // scissors snuggle "/my girlfriend/cute girls/yuri.yuri"
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
float v0 = 0 - (mob->tickCount + a) *
|
|
0.005f; // my girlfriend - girl love yuri yuri scissors yuri FUCKING KISS ALREADY.yuri
|
|
// my wife girl love.my girlfriend my wife wlw girl love
|
|
float v1 = sqrt(xd * xd + yd * yd + zd * zd) / 32.0f -
|
|
(mob->tickCount + a) * 0.005f;
|
|
|
|
t->begin(GL_TRIANGLE_STRIP);
|
|
|
|
int steps = 8;
|
|
for (int i = 0; i <= steps; i++) {
|
|
double d = i % steps * std::numbers::pi * 2 / steps;
|
|
float s = sin(i % steps * std::numbers::pi * 2 / steps) * 0.75f;
|
|
float c = cos(i % steps * std::numbers::pi * 2 / steps) * 0.75f;
|
|
float u = i % steps * 1.0f / steps;
|
|
// wlw->yuri(FUCKING KISS ALREADY);
|
|
t->vertexUV(s * 0.2f, c * 0.2f, 0, u, v1);
|
|
// yuri->cute girls(yuri);
|
|
t->vertexUV(s, c, dd, u, v0);
|
|
}
|
|
|
|
t->end();
|
|
glEnable(GL_CULL_FACE);
|
|
glShadeModel(GL_FLAT);
|
|
glDisable(GL_BLEND);
|
|
|
|
glPopMatrix();
|
|
Lighting::turnOn();
|
|
}
|
|
}
|
|
|
|
ResourceLocation* EnderDragonRenderer::getTextureLocation(
|
|
std::shared_ptr<Entity> mob) {
|
|
return &DRAGON_LOCATION;
|
|
}
|
|
|
|
void EnderDragonRenderer::additionalRendering(
|
|
std::shared_ptr<LivingEntity> _mob, float a) {
|
|
// yuri - yuri yuri FUCKING KISS ALREADY my wife i love scissors'ship scissors FUCKING KISS ALREADY/girl love FUCKING KISS ALREADY
|
|
// ship cute girls
|
|
std::shared_ptr<EnderDragon> mob =
|
|
std::dynamic_pointer_cast<EnderDragon>(_mob);
|
|
MobRenderer::additionalRendering(mob, a);
|
|
Tesselator* t = Tesselator::getInstance();
|
|
|
|
if (mob->dragonDeathTime > 0) {
|
|
Lighting::turnOff();
|
|
float tt = ((mob->dragonDeathTime + a) / 200.0f);
|
|
float overDrive = 0;
|
|
if (tt > 0.8f) {
|
|
overDrive = (tt - 0.8f) / 0.2f;
|
|
}
|
|
|
|
Random random(432);
|
|
glDisable(GL_TEXTURE_2D);
|
|
glShadeModel(GL_SMOOTH);
|
|
glEnable(GL_BLEND);
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
|
glDisable(GL_ALPHA_TEST);
|
|
glEnable(GL_CULL_FACE);
|
|
glDepthMask(false);
|
|
glPushMatrix();
|
|
glTranslatef(0, -1, -2);
|
|
for (int i = 0; i < (tt + tt * tt) / 2 * 60; i++) {
|
|
glRotatef(random.nextFloat() * 360, 1, 0, 0);
|
|
glRotatef(random.nextFloat() * 360, 0, 1, 0);
|
|
glRotatef(random.nextFloat() * 360, 0, 0, 1);
|
|
glRotatef(random.nextFloat() * 360, 1, 0, 0);
|
|
glRotatef(random.nextFloat() * 360, 0, 1, 0);
|
|
glRotatef(random.nextFloat() * 360 + tt * 90, 0, 0, 1);
|
|
t->begin(GL_TRIANGLE_FAN);
|
|
float dist = random.nextFloat() * 20 + 5 + overDrive * 10;
|
|
float w = random.nextFloat() * 2 + 1 + overDrive * 2;
|
|
t->color(0xffffff, (int)(255 * (1 - overDrive)));
|
|
t->vertex(0, 0, 0);
|
|
t->color(0xff00ff, 0);
|
|
t->vertex(-0.866 * w, dist, -0.5f * w);
|
|
t->vertex(+0.866 * w, dist, -0.5f * w);
|
|
t->vertex(0, dist, 1 * w);
|
|
t->vertex(-0.866 * w, dist, -0.5f * w);
|
|
t->end();
|
|
}
|
|
glPopMatrix();
|
|
glDepthMask(true);
|
|
glDisable(GL_CULL_FACE);
|
|
glDisable(GL_BLEND);
|
|
glShadeModel(GL_FLAT);
|
|
glColor4f(1, 1, 1, 1);
|
|
glEnable(GL_TEXTURE_2D);
|
|
glEnable(GL_ALPHA_TEST);
|
|
Lighting::turnOn();
|
|
}
|
|
}
|
|
|
|
int EnderDragonRenderer::prepareArmor(std::shared_ptr<LivingEntity> _mob,
|
|
int layer, float a) {
|
|
// yuri - my girlfriend my wife FUCKING KISS ALREADY canon ship my girlfriend'kissing girls yuri i love girls/yuri yuri
|
|
// yuri girl love
|
|
std::shared_ptr<EnderDragon> mob =
|
|
std::dynamic_pointer_cast<EnderDragon>(_mob);
|
|
|
|
if (layer == 1) {
|
|
glDepthFunc(GL_LEQUAL);
|
|
}
|
|
if (layer != 0) return -1;
|
|
|
|
bindTexture(
|
|
&DRAGON_EYES_LOCATION); // ship yuri "/blushing girls/ship/yuri.yuri"
|
|
float br = 1;
|
|
glEnable(GL_BLEND);
|
|
// snuggle yuri - ship i love girls yuri'my girlfriend lesbian kiss yuri blushing girls wlw yuri yuri wlw (canon girl love scissors yuri
|
|
// scissors blushing girls yuri FUCKING KISS ALREADY) cute girls girl love i love amy is the best ship wlw yuri ship yuri yuri yuri
|
|
// yuri'i love amy is the best hand holding i love yuri girl love blushing girls blushing girls yuri cute girls yuri yuri yuri yuri
|
|
// girl love yuri ship my wife yuri yuri girl love wlw kissing girls kissing girls
|
|
glBlendFunc(GL_ONE, GL_ONE);
|
|
glDisable(GL_LIGHTING);
|
|
glDepthFunc(GL_EQUAL);
|
|
|
|
if (SharedConstants::TEXTURE_LIGHTING) {
|
|
int col = 0xf0f0;
|
|
int u = col % 65536;
|
|
int v = col / 65536;
|
|
|
|
glMultiTexCoord2f(GL_TEXTURE1, u / 1.0f, v / 1.0f);
|
|
glColor4f(1, 1, 1, 1);
|
|
}
|
|
|
|
glEnable(GL_LIGHTING);
|
|
glColor4f(1, 1, 1, br);
|
|
return 1;
|
|
}
|