mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-18 02:21:58 +00:00
chore: format Minecraft.Client
This commit is contained in:
@@ -13,84 +13,71 @@
|
||||
#include "../../../Minecraft.World/Headers/net.minecraft.world.level.tile.h"
|
||||
#include "../../../Minecraft.World/Util/JavaMath.h"
|
||||
|
||||
|
||||
|
||||
AchievementScreen::AchievementScreen(StatsCounter *statsCounter)
|
||||
{
|
||||
// 4J - added initialisers
|
||||
AchievementScreen::AchievementScreen(StatsCounter* statsCounter) {
|
||||
// 4J - added initialisers
|
||||
imageWidth = 256;
|
||||
imageHeight = 202;
|
||||
xLastScroll = 0;
|
||||
yLastScroll = 0;
|
||||
scrolling = 0;
|
||||
scrolling = 0;
|
||||
|
||||
// 4J - TODO - investigate - these were static final ints before, but based on members of Achievements which
|
||||
// aren't final Or actually initialised
|
||||
xMin = Achievements::xMin * ACHIEVEMENT_COORD_SCALE - BIGMAP_WIDTH / 2;
|
||||
yMin = Achievements::yMin * ACHIEVEMENT_COORD_SCALE - BIGMAP_WIDTH / 2;
|
||||
xMax = Achievements::xMax * ACHIEVEMENT_COORD_SCALE - BIGMAP_HEIGHT / 2;
|
||||
yMax = Achievements::yMax * ACHIEVEMENT_COORD_SCALE - BIGMAP_HEIGHT / 2;
|
||||
// 4J - TODO - investigate - these were static final ints before, but based
|
||||
// on members of Achievements which aren't final Or actually initialised
|
||||
xMin = Achievements::xMin * ACHIEVEMENT_COORD_SCALE - BIGMAP_WIDTH / 2;
|
||||
yMin = Achievements::yMin * ACHIEVEMENT_COORD_SCALE - BIGMAP_WIDTH / 2;
|
||||
xMax = Achievements::xMax * ACHIEVEMENT_COORD_SCALE - BIGMAP_HEIGHT / 2;
|
||||
yMax = Achievements::yMax * ACHIEVEMENT_COORD_SCALE - BIGMAP_HEIGHT / 2;
|
||||
|
||||
this->statsCounter = statsCounter;
|
||||
int wBigMap = 141;
|
||||
int hBigMap = 141;
|
||||
|
||||
xScrollO = xScrollP = xScrollTarget = Achievements::openInventory->x * ACHIEVEMENT_COORD_SCALE - wBigMap / 2 - 12;
|
||||
yScrollO = yScrollP = yScrollTarget = Achievements::openInventory->y * ACHIEVEMENT_COORD_SCALE - hBigMap / 2;
|
||||
|
||||
xScrollO = xScrollP = xScrollTarget =
|
||||
Achievements::openInventory->x * ACHIEVEMENT_COORD_SCALE - wBigMap / 2 -
|
||||
12;
|
||||
yScrollO = yScrollP = yScrollTarget =
|
||||
Achievements::openInventory->y * ACHIEVEMENT_COORD_SCALE - hBigMap / 2;
|
||||
}
|
||||
|
||||
void AchievementScreen::init()
|
||||
{
|
||||
void AchievementScreen::init() {
|
||||
buttons.clear();
|
||||
// buttons.add(new SmallButton(0, width / 2 - 80 - 24, height / 2 + 74, 110, 20, I18n.get("gui.achievements")));
|
||||
buttons.push_back(new SmallButton(1, width / 2 + 24, height / 2 + 74, 80, 20, I18n::get(L"gui.done")));
|
||||
|
||||
// buttons.add(new SmallButton(0, width / 2 - 80 - 24, height / 2 +
|
||||
// 74, 110, 20, I18n.get("gui.achievements")));
|
||||
buttons.push_back(new SmallButton(1, width / 2 + 24, height / 2 + 74, 80,
|
||||
20, I18n::get(L"gui.done")));
|
||||
}
|
||||
|
||||
void AchievementScreen::buttonClicked(Button *button)
|
||||
{
|
||||
if (button->id == 1)
|
||||
{
|
||||
void AchievementScreen::buttonClicked(Button* button) {
|
||||
if (button->id == 1) {
|
||||
minecraft->setScreen(NULL);
|
||||
// minecraft->grabMouse(); // 4J removed
|
||||
// minecraft->grabMouse(); // 4J removed
|
||||
}
|
||||
Screen::buttonClicked(button);
|
||||
}
|
||||
|
||||
void AchievementScreen::keyPressed(char eventCharacter, int eventKey)
|
||||
{
|
||||
if (eventKey == minecraft->options->keyBuild->key)
|
||||
{
|
||||
void AchievementScreen::keyPressed(char eventCharacter, int eventKey) {
|
||||
if (eventKey == minecraft->options->keyBuild->key) {
|
||||
minecraft->setScreen(NULL);
|
||||
// minecraft->grabMouse(); // 4J removed
|
||||
}
|
||||
else
|
||||
{
|
||||
// minecraft->grabMouse(); // 4J removed
|
||||
} else {
|
||||
Screen::keyPressed(eventCharacter, eventKey);
|
||||
}
|
||||
}
|
||||
|
||||
void AchievementScreen::render(int mouseX, int mouseY, float a)
|
||||
{
|
||||
if (Mouse::isButtonDown(0))
|
||||
{
|
||||
void AchievementScreen::render(int mouseX, int mouseY, float a) {
|
||||
if (Mouse::isButtonDown(0)) {
|
||||
int xo = (width - imageWidth) / 2;
|
||||
int yo = (height - imageHeight) / 2;
|
||||
|
||||
int xBigMap = xo + 8;
|
||||
int yBigMap = yo + 17;
|
||||
|
||||
if (scrolling == 0 || scrolling == 1)
|
||||
{
|
||||
if (mouseX >= xBigMap && mouseX < xBigMap + BIGMAP_WIDTH && mouseY >= yBigMap && mouseY < yBigMap + BIGMAP_HEIGHT)
|
||||
{
|
||||
if (scrolling == 0)
|
||||
{
|
||||
if (scrolling == 0 || scrolling == 1) {
|
||||
if (mouseX >= xBigMap && mouseX < xBigMap + BIGMAP_WIDTH &&
|
||||
mouseY >= yBigMap && mouseY < yBigMap + BIGMAP_HEIGHT) {
|
||||
if (scrolling == 0) {
|
||||
scrolling = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
xScrollP -= mouseX - xLastScroll;
|
||||
yScrollP -= mouseY - yLastScroll;
|
||||
xScrollTarget = xScrollO = xScrollP;
|
||||
@@ -105,9 +92,7 @@ void AchievementScreen::render(int mouseX, int mouseY, float a)
|
||||
if (yScrollTarget < yMin) yScrollTarget = yMin;
|
||||
if (xScrollTarget >= xMax) xScrollTarget = xMax - 1;
|
||||
if (yScrollTarget >= yMax) yScrollTarget = yMax - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
scrolling = 0;
|
||||
}
|
||||
|
||||
@@ -122,42 +107,36 @@ void AchievementScreen::render(int mouseX, int mouseY, float a)
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
}
|
||||
|
||||
void AchievementScreen::tick()
|
||||
{
|
||||
void AchievementScreen::tick() {
|
||||
xScrollO = xScrollP;
|
||||
yScrollO = yScrollP;
|
||||
|
||||
double xd = (xScrollTarget - xScrollP);
|
||||
double yd = (yScrollTarget - yScrollP);
|
||||
if (xd * xd + yd * yd < 4)
|
||||
{
|
||||
if (xd * xd + yd * yd < 4) {
|
||||
xScrollP += xd;
|
||||
yScrollP += yd;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
xScrollP += xd * 0.85;
|
||||
yScrollP += yd * 0.85;
|
||||
}
|
||||
}
|
||||
|
||||
void AchievementScreen::renderLabels()
|
||||
{
|
||||
void AchievementScreen::renderLabels() {
|
||||
int xo = (width - imageWidth) / 2;
|
||||
int yo = (height - imageHeight) / 2;
|
||||
font->draw(L"Achievements", xo + 15, yo + 5, 0x404040);
|
||||
|
||||
// font.draw(xScrollP + ", " + yScrollP, xo + 5, yo + 5 + BIGMAP_HEIGHT + 18, 0x404040);
|
||||
// font.drawWordWrap("Ride a pig off a cliff.", xo + 5, yo + 5 + BIGMAP_HEIGHT + 16, BIGMAP_WIDTH, 0x404040);
|
||||
|
||||
// font.draw(xScrollP + ", " + yScrollP, xo + 5, yo + 5 +
|
||||
// BIGMAP_HEIGHT + 18, 0x404040); font.drawWordWrap("Ride a pig off a
|
||||
// cliff.", xo + 5, yo + 5 + BIGMAP_HEIGHT + 16, BIGMAP_WIDTH,
|
||||
// 0x404040);
|
||||
}
|
||||
|
||||
void AchievementScreen::renderBg(int xm, int ym, float a)
|
||||
{
|
||||
// 4J Unused
|
||||
void AchievementScreen::renderBg(int xm, int ym, float a) {
|
||||
// 4J Unused
|
||||
#if 0
|
||||
int xScroll = Mth::floor(xScrollO + (xScrollP - xScrollO) * a);
|
||||
int yScroll = Mth::floor(yScrollO + (yScrollP - yScrollO) * a);
|
||||
@@ -420,7 +399,4 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool AchievementScreen::isPauseScreen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool AchievementScreen::isPauseScreen() { return true; }
|
||||
Reference in New Issue
Block a user