diff --git a/Minecraft.Client/ArmorStandModel.cpp b/Minecraft.Client/ArmorStandModel.cpp index c6349eb9..5232eb5c 100644 --- a/Minecraft.Client/ArmorStandModel.cpp +++ b/Minecraft.Client/ArmorStandModel.cpp @@ -8,7 +8,6 @@ ArmorStandModel::ArmorStandModel(float scale) : HumanoidModel(scale) { texWidth = 64; texHeight = 64; - head = new ModelPart(this, 0, 0); head->addBox(-1.0f, -7.0f, -1.0f, 2, 7, 2, scale); diff --git a/Minecraft.Client/ArmorStandRenderer.cpp b/Minecraft.Client/ArmorStandRenderer.cpp index 77bc7c61..15654c65 100644 --- a/Minecraft.Client/ArmorStandRenderer.cpp +++ b/Minecraft.Client/ArmorStandRenderer.cpp @@ -16,6 +16,7 @@ #include "PlayerRenderer.h" #include "../Minecraft.World/SkullItem.h" #include "../Minecraft.World/SkullTileEntity.h" +#include "../Minecraft.World/ElytraItem.h" static const float DEG_TO_RAD = 3.14159265f / 180.0f; @@ -179,6 +180,46 @@ void ArmorStandRenderer::renderModel(shared_ptr mob, void ArmorStandRenderer::additionalRendering(shared_ptr mob, float a) { + { + shared_ptr chestItem = mob->getEquipmentSlots()[ArmorStand::SLOT_CHEST]; + if (chestItem != nullptr && dynamic_cast(chestItem->getItem()) != nullptr) + { + static ResourceLocation elytraTexture(L"item/elytra.png"); + bindTexture(&elytraTexture); + + float brightness2 = SharedConstants::TEXTURE_LIGHTING ? 1 : mob->getBrightness(a); + glColor3f(brightness2, brightness2, brightness2); + + ArmorStandModel* standModel = ((ArmorStandModel*)this->model); + ArmorStand* stand = dynamic_cast(mob.get()); + + float wf = 0.2617994f; + float wf1 = -0.2617994f; + float wf2 = standModel->body->y; + float wf3 = 0.0f; + + stand->rotateElytraX += (wf - stand->rotateElytraX) * 0.3f; + stand->rotateElytraY += (wf3 - stand->rotateElytraY) * 0.3f; + stand->rotateElytraZ += (wf1 - stand->rotateElytraZ) * 0.3f; + + + standModel->elytraRight->y = wf2; + standModel->elytraRight->xRot = stand->rotateElytraX; + standModel->elytraRight->yRot = stand->rotateElytraY; + standModel->elytraRight->zRot = stand->rotateElytraZ; + + standModel->elytraLeft->y = wf2; + standModel->elytraLeft->xRot = stand->rotateElytraX; + standModel->elytraLeft->yRot = -stand->rotateElytraY; + standModel->elytraLeft->zRot = -stand->rotateElytraZ; + + glPushMatrix(); + glTranslatef(0, 0.0f, (2.0f + 0.125f) / 16.0f); + standModel->renderElytra(1 / 16.0f, true); + glPopMatrix(); + } + } + std::shared_ptr item = mob->getCarriedItem(); if (item != nullptr) { diff --git a/Minecraft.World/ArmorStand.cpp b/Minecraft.World/ArmorStand.cpp index eb7658a3..e83efe54 100644 --- a/Minecraft.World/ArmorStand.cpp +++ b/Minecraft.World/ArmorStand.cpp @@ -45,6 +45,10 @@ void ArmorStand::init() for (int i = 0; i < equipmentCount; i++) equipment[i] = nullptr; + rotateElytraX = 0.2617994f; + rotateElytraY = 0.0f; + rotateElytraZ = -0.2617994f; + headPose = DEFAULT_HEAD_POSE; bodyPose = DEFAULT_BODY_POSE; leftArmPose = DEFAULT_LEFT_ARM_POSE; diff --git a/Minecraft.World/ArmorStand.h b/Minecraft.World/ArmorStand.h index 629d08aa..1e18cb47 100644 --- a/Minecraft.World/ArmorStand.h +++ b/Minecraft.World/ArmorStand.h @@ -56,6 +56,10 @@ private: bool isMarkerFlag; bool noPhysics; float standDamage; +public: + float rotateElytraX; + float rotateElytraY; + float rotateElytraZ; public: long long lastHit;