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

@@ -1,5 +1,5 @@
#include "../../Platform/stdafx.h"
#include "TextEditScreen.h"
#include "TextEditScreen.h"
#include "../Button.h"
#include "../../Rendering/EntityRenderers/TileEntityRenderDispatcher.h"
#include "../../Network/ClientConnection.h"
@@ -10,73 +10,62 @@
#include "../../../Minecraft.World/Headers/net.minecraft.world.level.h"
#include "../../../Minecraft.World/Headers/net.minecraft.world.level.tile.h"
const std::wstring TextEditScreen::allowedChars =
SharedConstants::readAcceptableChars();
const std::wstring TextEditScreen::allowedChars = SharedConstants::readAcceptableChars();
TextEditScreen::TextEditScreen(std::shared_ptr<SignTileEntity> sign) {
// 4J - added initialisers
line = 0;
frame = 0;
title = L"Edit sign message:";
TextEditScreen::TextEditScreen(std::shared_ptr<SignTileEntity> sign)
{
// 4J - added initialisers
line = 0;
frame = 0;
title = L"Edit sign message:";
this->sign = sign;
this->sign = sign;
}
void TextEditScreen::init()
{
void TextEditScreen::init() {
buttons.clear();
Keyboard::enableRepeatEvents(true);
buttons.push_back(new Button(0, width / 2 - 100, height / 4 + 24 * 5, L"Done"));
buttons.push_back(
new Button(0, width / 2 - 100, height / 4 + 24 * 5, L"Done"));
}
void TextEditScreen::removed()
{
void TextEditScreen::removed() {
Keyboard::enableRepeatEvents(false);
if (minecraft->level->isClientSide)
{
minecraft->getConnection(0)->send( std::shared_ptr<SignUpdatePacket>( new SignUpdatePacket(sign->x, sign->y, sign->z, sign->IsVerified(), sign->IsCensored(), sign->GetMessages()) ) );
if (minecraft->level->isClientSide) {
minecraft->getConnection(0)->send(std::shared_ptr<SignUpdatePacket>(
new SignUpdatePacket(sign->x, sign->y, sign->z, sign->IsVerified(),
sign->IsCensored(), sign->GetMessages())));
}
}
void TextEditScreen::tick()
{
frame++;
}
void TextEditScreen::tick() { frame++; }
void TextEditScreen::buttonClicked(Button *button)
{
void TextEditScreen::buttonClicked(Button* button) {
if (!button->active) return;
if (button->id == 0)
{
if (button->id == 0) {
sign->setChanged();
minecraft->setScreen(NULL);
}
}
void TextEditScreen::keyPressed(wchar_t ch, int eventKey)
{
void TextEditScreen::keyPressed(wchar_t ch, int eventKey) {
if (eventKey == Keyboard::KEY_UP) line = (line - 1) & 3;
if (eventKey == Keyboard::KEY_DOWN || eventKey == Keyboard::KEY_RETURN) line = (line + 1) & 3;
if (eventKey == Keyboard::KEY_DOWN || eventKey == Keyboard::KEY_RETURN)
line = (line + 1) & 3;
std::wstring temp=sign->GetMessage(line);
if (eventKey == Keyboard::KEY_BACK && temp.length() > 0)
{
std::wstring temp = sign->GetMessage(line);
if (eventKey == Keyboard::KEY_BACK && temp.length() > 0) {
temp = temp.substr(0, temp.length() - 1);
}
if (allowedChars.find(ch) != std::wstring::npos && temp.length() < 15)
{
if (allowedChars.find(ch) != std::wstring::npos && temp.length() < 15) {
temp += ch;
}
sign->SetMessage(line,temp);
sign->SetMessage(line, temp);
}
void TextEditScreen::render(int xm, int ym, float a)
{
void TextEditScreen::render(int xm, int ym, float a) {
renderBackground();
drawCenteredString(font, title, width / 2, 40, 0xffffff);
@@ -87,16 +76,13 @@ void TextEditScreen::render(int xm, int ym, float a)
glScalef(-ss, -ss, -ss);
glRotatef(180, 0, 1, 0);
Tile *tile = sign->getTile();
Tile* tile = sign->getTile();
if (tile == Tile::sign)
{
if (tile == Tile::sign) {
float rot = sign->getData() * 360 / 16.0f;
glRotatef(rot, 0, 1, 0);
glTranslatef(0, 5 / 16.0f, 0);
}
else
{
} else {
int face = sign->getData();
float rot = 0;
@@ -109,11 +95,11 @@ void TextEditScreen::render(int xm, int ym, float a)
if (frame / 6 % 2 == 0) sign->SetSelectedLine(line);
TileEntityRenderDispatcher::instance->render(sign, 0 - 0.5f, -0.75f, 0 - 0.5f, 0);
TileEntityRenderDispatcher::instance->render(sign, 0 - 0.5f, -0.75f,
0 - 0.5f, 0);
sign->SetSelectedLine(-1);
glPopMatrix();
Screen::render(xm, ym, a);
}