chore: format Minecraft.Client

This commit is contained in:
Tropical
2026-03-13 17:10:10 -05:00
parent 33d0737d1d
commit e8424f2000
531 changed files with 67709 additions and 62690 deletions

View File

@@ -6,58 +6,57 @@
#include "../../../Minecraft.World/Headers/net.minecraft.world.item.h"
#include "../../../Minecraft.World/Headers/net.minecraft.world.h"
ItemSpriteRenderer::ItemSpriteRenderer(Item *sourceItem, int sourceItemAuxValue /*= 0*/) : EntityRenderer()
{
this->sourceItem = sourceItem;
this->sourceItemAuxValue = sourceItemAuxValue;
ItemSpriteRenderer::ItemSpriteRenderer(Item* sourceItem,
int sourceItemAuxValue /*= 0*/)
: EntityRenderer() {
this->sourceItem = sourceItem;
this->sourceItemAuxValue = sourceItemAuxValue;
}
//ItemSpriteRenderer::ItemSpriteRenderer(int icon) : EntityRenderer()
// ItemSpriteRenderer::ItemSpriteRenderer(int icon) : EntityRenderer()
//{
// this(sourceItem, 0);
//}
// }
void ItemSpriteRenderer::render(std::shared_ptr<Entity> e, double x, double y, double z, float rot, float a)
{
// the icon is already cached in the item object, so there should not be any performance impact by not caching it here
Icon *icon = sourceItem->getIcon(sourceItemAuxValue);
if (icon == NULL)
{
return;
}
void ItemSpriteRenderer::render(std::shared_ptr<Entity> e, double x, double y,
double z, float rot, float a) {
// the icon is already cached in the item object, so there should not be any
// performance impact by not caching it here
Icon* icon = sourceItem->getIcon(sourceItemAuxValue);
if (icon == NULL) {
return;
}
glPushMatrix();
glTranslatef((float) x, (float) y, (float) z);
glTranslatef((float)x, (float)y, (float)z);
glEnable(GL_RESCALE_NORMAL);
glScalef(1 / 2.0f, 1 / 2.0f, 1 / 2.0f);
bindTexture(TN_GUI_ITEMS); // 4J - was L"/gui/items.png"
Tesselator *t = Tesselator::getInstance();
bindTexture(TN_GUI_ITEMS); // 4J - was L"/gui/items.png"
Tesselator* t = Tesselator::getInstance();
if (icon == PotionItem::getTexture(PotionItem::THROWABLE_ICON) )
{
if (icon == PotionItem::getTexture(PotionItem::THROWABLE_ICON)) {
int col = PotionBrewing::getColorValue(
(std::dynamic_pointer_cast<ThrownPotion>(e))->getPotionValue(),
false);
float red = ((col >> 16) & 0xff) / 255.0f;
float g = ((col >> 8) & 0xff) / 255.0f;
float b = ((col) & 0xff) / 255.0f;
int col = PotionBrewing::getColorValue((std::dynamic_pointer_cast<ThrownPotion>(e) )->getPotionValue(), false);
float red = ((col >> 16) & 0xff) / 255.0f;
float g = ((col >> 8) & 0xff) / 255.0f;
float b = ((col) & 0xff) / 255.0f;
glColor3f(red, g, b);
glPushMatrix();
renderIcon(t, PotionItem::getTexture(PotionItem::CONTENTS_ICON));
glPopMatrix();
glColor3f(1, 1, 1);
}
renderIcon(t, icon);
glColor3f(red, g, b);
glPushMatrix();
renderIcon(t, PotionItem::getTexture(PotionItem::CONTENTS_ICON));
glPopMatrix();
glColor3f(1, 1, 1);
}
renderIcon(t, icon);
glDisable(GL_RESCALE_NORMAL);
glPopMatrix();
glDisable(GL_RESCALE_NORMAL);
glPopMatrix();
}
void ItemSpriteRenderer::renderIcon(Tesselator *t, Icon *icon)
{
void ItemSpriteRenderer::renderIcon(Tesselator* t, Icon* icon) {
float u0 = icon->getU0();
float u1 = icon->getU1();
float v0 = icon->getV0();
@@ -71,9 +70,13 @@ void ItemSpriteRenderer::renderIcon(Tesselator *t, Icon *icon)
glRotatef(-entityRenderDispatcher->playerRotX, 1, 0, 0);
t->begin();
t->normal(0, 1, 0);
t->vertexUV((float)(0 - xo), (float)( 0 - yo), (float)( 0), (float)( u0), (float)( v1));
t->vertexUV((float)(r - xo), (float)( 0 - yo), (float)( 0), (float)( u1), (float)( v1));
t->vertexUV((float)(r - xo), (float)( r - yo), (float)( 0), (float)( u1), (float)( v0));
t->vertexUV((float)(0 - xo), (float)( r - yo), (float)( 0), (float)( u0), (float)( v0));
t->vertexUV((float)(0 - xo), (float)(0 - yo), (float)(0), (float)(u0),
(float)(v1));
t->vertexUV((float)(r - xo), (float)(0 - yo), (float)(0), (float)(u1),
(float)(v1));
t->vertexUV((float)(r - xo), (float)(r - yo), (float)(0), (float)(u1),
(float)(v0));
t->vertexUV((float)(0 - xo), (float)(r - yo), (float)(0), (float)(u0),
(float)(v0));
t->end();
}