Skip to content

Commit

Permalink
Merge branch 'master' of github.com:LilyKensa/Wurst into autoplace-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
LilyKensa committed Oct 20, 2024
2 parents d4b624e + 1f7d318 commit 41ab6d2
Show file tree
Hide file tree
Showing 119 changed files with 2,848 additions and 1,202 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Set up Java 21
uses: actions/setup-java@v4
with:
Expand All @@ -40,22 +37,18 @@ jobs:
run: chmod +x gradlew

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Generate and submit dependency graph
if: ${{ github.event_name == 'push' }}
uses: gradle/actions/dependency-submission@v3
uses: gradle/actions/setup-gradle@v4
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use"
build-scan-terms-of-use-agree: "yes"

- name: Check code style with Spotless
id: spotless_check
run: ./gradlew spotlessCheck
- name: Generate and submit dependency graph
if: ${{ github.event_name == 'push' }}
uses: gradle/actions/dependency-submission@v4

- name: Execute Gradle build
run: ./gradlew build --stacktrace --warning-mode=fail
run: ./gradlew spotlessCheck build --stacktrace --warning-mode=fail

- name: VirusTotal scan
if: ${{ github.event_name == 'push' }}
Expand Down
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
dependencies {
classpath "org.kohsuke:github-api:1.323"
classpath "org.kohsuke:github-api:1.326"
}
}

Expand Down Expand Up @@ -31,6 +31,7 @@ dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
testImplementation "net.fabricmc:fabric-loader-junit:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
Expand Down Expand Up @@ -91,6 +92,10 @@ spotless {
}
}

test {
useJUnitPlatform()
}

task moveDevLibs(dependsOn: [remapJar, remapSourcesJar]) {
doLast {
def archivesName = project.base.archivesName.get() as String
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ org.gradle.parallel=true
# https://modrinth.com/mod/fabric-api/versions
minecraft_version=1.21
yarn_mappings=1.21+build.9
loader_version=0.15.11
loader_version=0.16.5

# Fabric API
fabric_version=0.102.0+1.21

# Mod Properties
mod_version = v7.45-MC1.21
mod_version = v7.46.1-MC1.21
maven_group = net.wurstclient
archives_base_name = Wurst-Client

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/wurstclient/WurstClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public enum WurstClient
public static MinecraftClient MC;
public static IMinecraftClient IMC;

public static final String VERSION = "7.45";
public static final String VERSION = "7.46.1";
public static final String MC_VERSION = "1.21";

private WurstAnalytics analytics;
Expand Down
25 changes: 21 additions & 4 deletions src/main/java/net/wurstclient/WurstTranslator.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.IllegalFormatException;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;

import com.google.common.collect.Lists;
Expand All @@ -31,21 +33,25 @@ public class WurstTranslator implements SynchronousResourceReloader
private final WurstClient wurst = WurstClient.INSTANCE;
private TranslationStorage mcEnglish;

private final HashMap<String, String> englishOnlyStrings = new HashMap<>();
private final HashMap<String, String> currentLangStrings = new HashMap<>();
private Map<String, String> currentLangStrings = Map.of();
private Map<String, String> englishOnlyStrings = Map.of();

@Override
public void reload(ResourceManager manager)
{
mcEnglish = TranslationStorage.load(manager,
Lists.newArrayList("en_us"), false);

currentLangStrings.clear();
HashMap<String, String> currentLangStrings = new HashMap<>();
loadTranslations(manager, getCurrentLangCodes(),
currentLangStrings::put);
this.currentLangStrings =
Collections.unmodifiableMap(currentLangStrings);

englishOnlyStrings.clear();
HashMap<String, String> englishOnlyStrings = new HashMap<>();
loadTranslations(manager, List.of("en_us"), englishOnlyStrings::put);
this.englishOnlyStrings =
Collections.unmodifiableMap(englishOnlyStrings);
}

/**
Expand Down Expand Up @@ -146,6 +152,17 @@ public TranslationStorage getMcEnglish()
return mcEnglish;
}

public Map<String, String> getMinecraftsCurrentLanguage()
{
return currentLangStrings;
}

public Map<String, String> getWurstsCurrentLanguage()
{
return isForcedEnglish() ? englishOnlyStrings
: getMinecraftsCurrentLanguage();
}

private ArrayList<String> getCurrentLangCodes()
{
// Weird bug: Some users have their language set to "en_US" instead of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static void login(String email, String password)

Session session = new Session(mcProfile.getName(), mcProfile.getUUID(),
mcProfile.getAccessToken(), Optional.empty(), Optional.empty(),
Session.AccountType.MOJANG);
Session.AccountType.MSA);

WurstClient.IMC.setSession(session);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public AddAltScreen(Screen prevScreen, AltManager altManager)
@Override
protected String getDoneButtonText()
{
return "Add";
return getPassword().isEmpty() ? "Add Cracked Alt" : "Add Premium Alt";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,25 @@ public AltEditorScreen(Screen prevScreen, Text title)
@Override
public final void init()
{
nameOrEmailBox = new TextFieldWidget(textRenderer, width / 2 - 100, 60,
200, 20, Text.literal(""));
nameOrEmailBox.setMaxLength(48);
nameOrEmailBox.setFocused(true);
nameOrEmailBox.setText(getDefaultNameOrEmail());
addSelectableChild(nameOrEmailBox);

passwordBox = new TextFieldWidget(textRenderer, width / 2 - 100, 100,
200, 20, Text.literal(""));
passwordBox.setText(getDefaultPassword());
passwordBox.setRenderTextProvider((text, int_1) -> {
String stars = "";
for(int i = 0; i < text.length(); i++)
stars += "*";
return OrderedText.styledForwardsVisitedString(stars, Style.EMPTY);
});
passwordBox.setMaxLength(256);
addSelectableChild(passwordBox);

addDrawableChild(doneButton = ButtonWidget
.builder(Text.literal(getDoneButtonText()), b -> pressDoneButton())
.dimensions(width / 2 - 100, height / 4 + 72 + 12, 200, 20)
Expand Down Expand Up @@ -101,25 +120,6 @@ public final void init()
.dimensions((width / 2 - 100) / 2 - 64, height - 32, 128, 20)
.build());

nameOrEmailBox = new TextFieldWidget(textRenderer, width / 2 - 100, 60,
200, 20, Text.literal(""));
nameOrEmailBox.setMaxLength(48);
nameOrEmailBox.setFocused(true);
nameOrEmailBox.setText(getDefaultNameOrEmail());
addSelectableChild(nameOrEmailBox);

passwordBox = new TextFieldWidget(textRenderer, width / 2 - 100, 100,
200, 20, Text.literal(""));
passwordBox.setText(getDefaultPassword());
passwordBox.setRenderTextProvider((text, int_1) -> {
String stars = "";
for(int i = 0; i < text.length(); i++)
stars += "*";
return OrderedText.styledForwardsVisitedString(stars, Style.EMPTY);
});
passwordBox.setMaxLength(256);
addSelectableChild(passwordBox);

setFocused(nameOrEmailBox);
}

Expand Down Expand Up @@ -150,6 +150,7 @@ public final void tick()

doneButton.active = !nameOrEmail.isEmpty()
&& !(alex && passwordBox.getText().isEmpty());
doneButton.setMessage(Text.literal(getDoneButtonText()));

stealSkinButton.active = !alex;
}
Expand Down Expand Up @@ -358,14 +359,17 @@ public void render(DrawContext context, int mouseX, int mouseY,
AltRenderer.drawAltBody(context, nameOrEmailBox.getText(),
width - (width / 2 - 100) / 2 - 64, height / 2 - 128, 128, 256);

String accountType = getPassword().isEmpty() ? "cracked" : "premium";

// text
context.drawTextWithShadow(textRenderer, "Name (for cracked alts), or",
width / 2 - 100, 37, 10526880);
context.drawTextWithShadow(textRenderer, "E-Mail (for premium alts)",
width / 2 - 100, 47, 10526880);
context.drawTextWithShadow(textRenderer,
"Password (leave blank for cracked alts)", width / 2 - 100, 87,
10526880);
context.drawTextWithShadow(textRenderer, "Password (for premium alts)",
width / 2 - 100, 87, 10526880);
context.drawTextWithShadow(textRenderer, "Account type: " + accountType,
width / 2 - 100, 127, 10526880);

String[] lines = message.split("\n");
for(int i = 0; i < lines.length; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public DirectLoginScreen(Screen prevScreen)
@Override
protected String getDoneButtonText()
{
return "Login";
return getPassword().isEmpty() ? "Change Cracked Name"
: "Login with Password";
}

@Override
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/net/wurstclient/clickgui/ClickGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ public void render(DrawContext context, int mouseX, int mouseY,
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// GL11.glShadeModel(GL11.GL_SMOOTH);
RenderSystem.lineWidth(1);
MatrixStack matrixStack = context.getMatrices();
matrixStack.push();

tooltip = "";
for(Window window : windows)
Expand All @@ -495,12 +497,14 @@ public void render(DrawContext context, int mouseX, int mouseY,
else
window.stopDraggingScrollbar();

matrixStack.translate(0, 0, 300);
renderWindow(context, window, mouseX, mouseY, partialTicks);
}

renderPopups(context, mouseX, mouseY);
renderTooltip(context, mouseX, mouseY);

matrixStack.pop();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
}
Expand Down Expand Up @@ -598,12 +602,18 @@ public void renderPinnedWindows(DrawContext context, float partialTicks)
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderSystem.lineWidth(1);
MatrixStack matrixStack = context.getMatrices();
matrixStack.push();

for(Window window : windows)
if(window.isPinned() && !window.isInvisible())
{
matrixStack.translate(0, 0, 300);
renderWindow(context, window, Integer.MIN_VALUE,
Integer.MIN_VALUE, partialTicks);

}

matrixStack.pop();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected void openScreen()
@Override
protected String getText()
{
return setting.getName() + ": " + setting.getBlockNames().size();
return setting.getName() + ": " + setting.size();
}

@Override
Expand Down
Loading

0 comments on commit 41ab6d2

Please sign in to comment.