the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "SignRenderer.h"
3#include "SignModel.h"
4#include "ModelPart.h"
5#include "..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
6#include "..\Minecraft.World\net.minecraft.world.level.tile.h"
7#include "..\Minecraft.World\Entity.h"
8#include "..\Minecraft.World\Level.h"
9
10ResourceLocation SignRenderer::SIGN_LOCATION = ResourceLocation(TN_ITEM_SIGN);
11
12SignRenderer::SignRenderer()
13{
14 signModel = new SignModel();
15}
16
17void SignRenderer::render(shared_ptr<TileEntity> _sign, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled)
18{
19 // 4J - dynamic cast required because we aren't using templates/generics in our version
20 shared_ptr<SignTileEntity> sign = dynamic_pointer_cast<SignTileEntity>(_sign);
21
22 Tile *tile = sign->getTile();
23
24 glPushMatrix();
25 float size = 16 / 24.0f;
26 if (tile == Tile::sign)
27 {
28 glTranslatef((float) x + 0.5f, (float) y + 0.75f * size, (float) z + 0.5f);
29 float rot = sign->getData() * 360 / 16.0f;
30 glRotatef(-rot, 0, 1, 0);
31 signModel->cube2->visible = true;
32 }
33 else
34 {
35 int face = sign->getData();
36 float rot = 0;
37
38 if (face == 2) rot = 180;
39 if (face == 4) rot = 90;
40 if (face == 5) rot = -90;
41
42 glTranslatef((float) x + 0.5f, (float) y + 0.75f * size, (float) z + 0.5f);
43 glRotatef(-rot, 0, 1, 0);
44 glTranslatef(0, -5 / 16.0f, -7 / 16.0f);
45
46 signModel->cube2->visible = false;
47 }
48
49 bindTexture(&SIGN_LOCATION); // 4J was L"/item/sign.png"
50
51 glPushMatrix();
52 glScalef(size, -size, -size);
53 signModel->render(true);
54 glPopMatrix();
55 Font *font = getFont();
56
57 float s = 1 / 60.0f * size;
58 glTranslatef(0, 0.5f * size, 0.07f * size);
59 glScalef(s, -s, s);
60 glNormal3f(0, 0, -1 * s);
61 glDepthMask(false);
62
63 int col = Minecraft::GetInstance()->getColourTable()->getColor(eMinecraftColour_Sign_Text);
64 wstring msg;
65 // need to send the new data
66 // Get the current language setting from the console
67 DWORD dwLanguage = XGetLanguage( );
68
69 for (int i = 0; i < MAX_SIGN_LINES; i++) // 4J - was sign.messages.length
70 {
71 if(sign->IsVerified())
72 {
73 if(sign->IsCensored())
74 {
75 switch(dwLanguage)
76 {
77 case XC_LANGUAGE_KOREAN:
78 case XC_LANGUAGE_JAPANESE:
79 case XC_LANGUAGE_TCHINESE:
80 msg = L"Censored";// In-game font, so English only
81 break;
82 default:
83 msg = app.GetString(IDS_STRINGVERIFY_CENSORED);
84 break;
85 }
86 }
87 else
88 {
89 msg = sign->GetMessage(i);
90 }
91 }
92 else
93 {
94 switch(dwLanguage)
95 {
96 case XC_LANGUAGE_KOREAN:
97 case XC_LANGUAGE_JAPANESE:
98 case XC_LANGUAGE_TCHINESE:
99 msg = L"Awaiting Approval";// In-game font, so English only
100 break;
101 default:
102 msg = app.GetString(IDS_STRINGVERIFY_AWAITING_APPROVAL);
103 break;
104 }
105 }
106
107 if (i == sign->GetSelectedLine())
108 {
109 msg = L"> " + msg + L" <";
110 font->draw(msg, -font->width(msg) / 2, i * 10 - (MAX_SIGN_LINES) * 5, col); // 4J - (MAX_SIGN_LINES) was sign.messages.length
111 }
112 else
113 {
114 font->draw(msg, -font->width(msg) / 2, i * 10 - (MAX_SIGN_LINES) * 5, col); // 4J - (MAX_SIGN_LINES) was sign.messages.length
115 }
116 }
117 glDepthMask(true);
118 glColor4f(1, 1, 1, 1);
119 glPopMatrix();
120
121}