aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/EnderChestRenderer.cpp
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/EnderChestRenderer.cpp
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.Client/EnderChestRenderer.cpp')
-rw-r--r--Minecraft.Client/EnderChestRenderer.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/Minecraft.Client/EnderChestRenderer.cpp b/Minecraft.Client/EnderChestRenderer.cpp
new file mode 100644
index 00000000..2996b65f
--- /dev/null
+++ b/Minecraft.Client/EnderChestRenderer.cpp
@@ -0,0 +1,52 @@
+#include "stdafx.h"
+#include "..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
+#include "ModelPart.h"
+#include "EnderChestRenderer.h"
+
+void EnderChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled)
+{
+ // 4J Convert as we aren't using a templated class
+ shared_ptr<EnderChestTileEntity> chest = dynamic_pointer_cast<EnderChestTileEntity>(_chest);
+
+ int data = 0;
+
+ if (chest->hasLevel())
+ {
+ data = chest->getData();
+ }
+
+ bindTexture(TN_TILE_ENDER_CHEST); //"/item/enderchest.png");
+
+ glPushMatrix();
+ glEnable(GL_RESCALE_NORMAL);
+ //glColor4f(1, 1, 1, 1);
+ if( setColor ) glColor4f(1, 1, 1, alpha);
+ glTranslatef((float) x, (float) y + 1, (float) z + 1);
+ glScalef(1, -1, -1);
+
+ glTranslatef(0.5f, 0.5f, 0.5f);
+ int rot = 0;
+ if (data == 2) rot = 180;
+ if (data == 3) rot = 0;
+ if (data == 4) rot = 90;
+ if (data == 5) rot = -90;
+
+ // if (data == 2) {
+ // glTranslatef(1, 0, 0);
+ // }
+ // if (data == 5) {
+ // glTranslatef(0, 0, -1);
+ // }
+ glRotatef(rot, 0, 1, 0);
+ glTranslatef(-0.5f, -0.5f, -0.5f);
+
+ float open = chest->oOpenness + (chest->openness - chest->oOpenness) * a;
+ open = 1 - open;
+ open = 1 - open * open * open;
+
+ chestModel.lid->xRot = -(open * PI / 2);
+ chestModel.render(useCompiled);
+ glDisable(GL_RESCALE_NORMAL);
+ glPopMatrix();
+ if( setColor ) glColor4f(1, 1, 1, 1);
+}