diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 607060a1..4ec1111d 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,3 @@ # These are supported funding model platforms - +ko_fi: wurst custom: https://www.wurstclient.net/donate/?utm_source=GitHub&utm_medium=Wurst7&utm_campaign=GitHub+Sponsors&utm_content=Sponsor+this+project diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md deleted file mode 100644 index e4274411..00000000 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -name: Bug Report -about: Report a bug -title: '' -labels: bug -assignees: '' ---- -Before posting, please make sure that this hasn't already been reported by someone else. - -## Description -What's wrong? - -## Steps To Reproduce -Please make a list of steps to reproduce the problem (ideally from a fresh Wurst installation): -1. -2. -3. - -## Screenshots / Videos (Optional) -If applicable, add screenshots, videos or other files to help explain the problem. - -## Crash Report -Please find your crash report file at "%appdata%/.minecraft/crash-reports", open the file in a text editor and copy-paste its content below. - -``` - -(crash report goes here) - -``` - -**Please note:** If the game did not crash, please hold down F3+C for 10 seconds to generate a crash report. Even when a bug doesn't cause the game to crash, this file still contains useful information that can help us to find and fix the problem. Because of this, please always include a crash report. diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 00000000..31ddf725 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,66 @@ +name: Bug Report +description: Report a bug +labels: ["type:bug", "status:unconfirmed"] +body: +- type: markdown + attributes: + value: | + ## Welcome! + Please fill out the following template to help us understand and reproduce the issue you're experiencing. +- type: checkboxes + id: checklist + attributes: + label: Pre-reporting checklist + description: "Please select all that apply." + options: + - label: "I have searched existing issues and didn't find any previous reports of this bug." + - label: "This bug still happens in the latest version of Wurst. I've made sure my installation is up to date." + - label: "I have tried removing all other mods and the bug still happens." +- type: textarea + id: description + attributes: + label: Description + description: "Please describe the bug in as much detail as possible." + validations: + required: true +- type: textarea + id: repro + attributes: + label: Repro steps + description: "How do you trigger this bug? Please walk us through it step by step." + value: | + 1. + 2. + 3. + validations: + required: true +- type: input + id: wurst-version + attributes: + label: Wurst Client version + placeholder: e.g. 7.15 + validations: + required: true +- type: input + id: minecraft-version + attributes: + label: Minecraft version + placeholder: e.g. 1.16.5 + validations: + required: true +- type: textarea + id: crash + attributes: + label: Crash report (if applicable) + description: "If your game crashed, please paste the entire crash report here." + placeholder: | + ---- Minecraft Crash Report ---- + // Who set us up the TNT? + render: plaintext + validations: + required: false +- type: markdown + attributes: + value: | + ## Thank you! + We appreciate your help in improving Wurst Client by reporting this bug. Please make sure you have filled out all the necessary information before submitting this issue. diff --git a/.github/ISSUE_TEMPLATE/suggestion.md b/.github/ISSUE_TEMPLATE/suggestion.md deleted file mode 100644 index d413af89..00000000 --- a/.github/ISSUE_TEMPLATE/suggestion.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -name: Suggestion -about: Suggest a new hack/command/setting/etc. -title: '' -labels: enhancement -assignees: '' ---- -Before posting, please make sure that this hasn't already been suggested by someone else. - -## Description -What does it do and how is it useful? Please assume that we have never heard of it before. Just mentioning a name won't work. If it's for an older version of Minecraft (like 1.8 or 1.12), please mention that too. - -## Screenshots / Videos (Optional) -If applicable, add screenshots, videos or other files to help explain the suggestion. diff --git a/.github/ISSUE_TEMPLATE/suggestion.yml b/.github/ISSUE_TEMPLATE/suggestion.yml new file mode 100644 index 00000000..8cef94e9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/suggestion.yml @@ -0,0 +1,62 @@ +name: Suggestion +description: "Suggest a change to improve the Wurst Client" +labels: ["type:enhancement", "status:unconfirmed"] +body: +- type: markdown + attributes: + value: | + ## Welcome! + Please fill out the following template to help us understand the improvement you're suggesting. +- type: checkboxes + id: checklist + attributes: + label: Pre-suggestion checklist + description: "Please select all that apply." + options: + - label: "I have searched existing issues and didn't find any previous issues with the same suggestion." + - label: "This is only one suggestion. I understand that GitHub issues don't work well with lists." + - label: "This feature doesn't already exist in the latest version of Wurst. I've made sure my installation is up to date." + - label: "I have looked at the code and am reasonably confident that this suggestion is possible to implement." +- type: dropdown + id: type + attributes: + label: What type of improvement are you suggesting? + multiple: true + options: + - "Adding a new hack." + - "Adding a new chat command." + - "Adding a different kind of feature." + - "Changing the settings of existing features." + - "Porting existing features to a different Minecraft version." + - "Turning a Wurst feature into a standalone mod." + - "Removing an old feature that doesn't work anymore." + - "Other (please explain in description)" + validations: + required: true +- type: dropdown + id: target-audience + attributes: + label: What type of player would find this improvement useful? + multiple: true + options: + - "Builders" + - "Miners" + - "Griefers" + - "PVPers" + - "Redstoners" + - "Anarchy/faction players" + - "Other (please explain in description)" + validations: + required: true +- type: textarea + id: description + attributes: + label: Description + description: "Please describe the improvement in as much detail as possible. What does it do and how is it useful? Assume that we have never heard of it before, even if it exists in other hacked clients." + validations: + required: true +- type: markdown + attributes: + value: | + ## Thank you! + We appreciate your help in improving Wurst Client by suggesting this improvement. Please make sure you have filled out all the necessary information before submitting this issue. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 498460b1..f6749f14 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,7 +1,7 @@ ## Description -What have you added and what does it do? (Alternatively, what have you fixed and how does it work?) +> What have you added and what does it do? (Alternatively, what have you fixed and how does it work?) ## (Optional) screenshots / videos -If applicable, add screenshots or videos to help explain your pull request. +> If applicable, add screenshots or videos to help explain your pull request. diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 62f01a7f..ca9850e8 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -18,16 +18,26 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: gradle/wrapper-validation-action@v1 - - name: Set up JDK 17 + - name: Checkout repository + uses: actions/checkout@v4 + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Set up Java 17 uses: actions/setup-java@v3 with: java-version: '17' - distribution: 'temurin' + distribution: 'microsoft' - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Setup Gradle uses: gradle/gradle-build-action@v2 - name: Execute Gradle build run: ./gradlew build + - name: VirusTotal scan + if: github.event_name == 'push' + uses: crazy-max/ghaction-virustotal@v4 + with: + vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }} + files: | + ./build/libs/*.jar + continue-on-error: true diff --git a/.github/workflows/jsonsyntax.yml b/.github/workflows/jsonsyntax.yml index 2a5f77c7..e6f9a4da 100644 --- a/.github/workflows/jsonsyntax.yml +++ b/.github/workflows/jsonsyntax.yml @@ -12,7 +12,8 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v4 - name: Check JSON syntax uses: limitusus/json-syntax-check@v2 with: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..6373e4bc --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,37 @@ +name: "Close stale issues and pull requests" +on: + schedule: + - cron: "30 1 * * 1-5" + +permissions: + issues: write + pull-requests: write + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@main + with: + stale-issue-message: | + This issue has been open for a while with no recent activity. If this issue is still important to you, please add a comment within the next 7 days to keep it open. Otherwise, the issue will be automatically closed to free up time for other tasks. + + Issues should be closed if: + - They are duplicates of other issues + - There is not enough demand + - They are no longer relevant + - There are not enough details + stale-pr-message: | + This pull request has been open for a while with no recent activity. If you're still working on this or waiting for a review, please add a comment or commit within the next 7 days to keep it open. Otherwise, the pull request will be automatically closed to free up time for other tasks. + + Pull requests should be closed if: + - They have been superseded by another pull request + - They are out of scope or don't align with the project + - They have become obsolete due to other changes + - They have bugs or conflicts that won't be resolved + days-before-stale: 60 + days-before-close: 7 + stale-issue-label: "status:stale" + stale-pr-label: "status:stale" + operations-per-run: 50 + enable-statistics: true diff --git a/build.gradle b/build.gradle index 532612de..f9c14b90 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { } plugins { - id 'fabric-loom' version '1.3-SNAPSHOT' + id 'fabric-loom' version '1.4-SNAPSHOT' id 'maven-publish' } diff --git a/gradle.properties b/gradle.properties index 3e7ea898..c247934e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,15 +5,15 @@ org.gradle.parallel=true # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.20.1 -yarn_mappings=1.20.1+build.10 -loader_version=0.14.22 +minecraft_version=1.20.2 +yarn_mappings=1.20.2+build.4 +loader_version=0.14.24 #Fabric api -fabric_version=0.87.0+1.20.1 +fabric_version=0.90.7+1.20.2 # Mod Properties -mod_version = v7.37-MC1.20.1 +mod_version = v7.39-MC1.20.2 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832..7f93135c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fae08049..ac72c34e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a69d9cb6..0adc8e1a 100644 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# 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 # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,6 +198,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/gradlew.bat b/gradlew.bat index 53a6b238..6689b85b 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/src/main/java/net/wurstclient/SearchTags.java b/src/main/java/net/wurstclient/SearchTags.java index b385ffc1..ae5b7f07 100644 --- a/src/main/java/net/wurstclient/SearchTags.java +++ b/src/main/java/net/wurstclient/SearchTags.java @@ -12,6 +12,28 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Adds search tags to a Wurst feature so that it can be found through the + * search bar in the Navigator GUI. + * + *

+ * Navigator can already find features by their name and description, so + * repeating that information in the search tags is pointless. However, names + * and descriptions of settings are not used by Navigator, so repeating those + * can make sense if people are likely to search for them. + * + *

+ * Navigator is not case-sensitive, so for example "NukerLegit" and "nukerlegit" + * are treated the same. However, Navigator struggles with spaces and the order + * of words, for example "NukerLegit", "Nuker Legit" and "Legit Nuker" are all + * treated differently. + * + *

+ * By convention, search tags with spaces should be written in lower case and + * search tags without spaces should be written in camel case. For example, + * "NukerLegit" and "nuker legit". This is not enforced, but it makes the + * code easier to read. + */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface SearchTags diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 9e4d261c..e401b851 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -40,6 +40,7 @@ import net.wurstclient.hack.HackList; import net.wurstclient.hud.IngameHUD; import net.wurstclient.keybinds.KeybindList; import net.wurstclient.keybinds.KeybindProcessor; +import net.wurstclient.mixinterface.ILanguageManager; import net.wurstclient.mixinterface.IMinecraftClient; import net.wurstclient.navigator.Navigator; import net.wurstclient.other_feature.OtfList; @@ -56,8 +57,8 @@ public enum WurstClient public static MinecraftClient MC; public static IMinecraftClient IMC; - public static final String VERSION = "7.37"; - public static final String MC_VERSION = "1.20.1"; + public static final String VERSION = "7.39"; + public static final String MC_VERSION = "1.20.2"; private WurstAnalytics analytics; private EventManager eventManager; @@ -149,7 +150,7 @@ public enum WurstClient altManager = new AltManager(altsFile, encFolder); zoomKey = new KeyBinding("key.wurst.zoom", InputUtil.Type.KEYSYM, - GLFW.GLFW_KEY_V, "Zoom"); + GLFW.GLFW_KEY_V, KeyBinding.MISC_CATEGORY); KeyBindingHelper.registerKeyBinding(zoomKey); analytics.trackPageView("/mc" + MC_VERSION + "/v" + VERSION, @@ -177,7 +178,7 @@ public enum WurstClient public String translate(String key) { if(otfs.translationsOtf.getForceEnglish().isChecked()) - return IMC.getLanguageManager().getEnglish().get(key); + return ILanguageManager.getEnglish().get(key); // This extra check is necessary because I18n.translate() doesn't // always return the key when the translation is missing. If the key diff --git a/src/main/java/net/wurstclient/ai/FlyPathProcessor.java b/src/main/java/net/wurstclient/ai/FlyPathProcessor.java index 9fb306ef..d9c6cfb0 100644 --- a/src/main/java/net/wurstclient/ai/FlyPathProcessor.java +++ b/src/main/java/net/wurstclient/ai/FlyPathProcessor.java @@ -151,4 +151,10 @@ public class FlyPathProcessor extends PathProcessor } } } + + @Override + public boolean canBreakBlocks() + { + return true; + } } diff --git a/src/main/java/net/wurstclient/ai/PathProcessor.java b/src/main/java/net/wurstclient/ai/PathProcessor.java index e468ee48..e71a0522 100644 --- a/src/main/java/net/wurstclient/ai/PathProcessor.java +++ b/src/main/java/net/wurstclient/ai/PathProcessor.java @@ -40,6 +40,8 @@ public abstract class PathProcessor public abstract void process(); + public abstract boolean canBreakBlocks(); + public final int getIndex() { return index; diff --git a/src/main/java/net/wurstclient/ai/WalkPathProcessor.java b/src/main/java/net/wurstclient/ai/WalkPathProcessor.java index aac7cd14..01d1e8e1 100644 --- a/src/main/java/net/wurstclient/ai/WalkPathProcessor.java +++ b/src/main/java/net/wurstclient/ai/WalkPathProcessor.java @@ -138,4 +138,10 @@ public class WalkPathProcessor extends PathProcessor MC.options.forwardKey.setPressed(true); } } + + @Override + public boolean canBreakBlocks() + { + return MC.player.isOnGround(); + } } diff --git a/src/main/java/net/wurstclient/altmanager/AltRenderer.java b/src/main/java/net/wurstclient/altmanager/AltRenderer.java index 5d83d0ad..05bb514c 100644 --- a/src/main/java/net/wurstclient/altmanager/AltRenderer.java +++ b/src/main/java/net/wurstclient/altmanager/AltRenderer.java @@ -25,6 +25,7 @@ import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; import net.minecraft.client.util.DefaultSkinHelper; +import net.minecraft.client.util.SkinTextures; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; import net.minecraft.util.Uuids; @@ -41,13 +42,12 @@ public final class AltRenderer if(loadedSkins.get(name) == null) { - UUID uuid = - Uuids.getUuidFromProfile(new GameProfile((UUID)null, name)); + UUID uuid = Uuids.getOfflinePlayerUuid(name); PlayerListEntry entry = new PlayerListEntry(new GameProfile(uuid, name), false); - loadedSkins.put(name, entry.getSkinTexture()); + loadedSkins.put(name, entry.getSkinTextures().texture()); } RenderSystem.setShaderTexture(0, loadedSkins.get(name)); @@ -124,7 +124,8 @@ public final class AltRenderer bindSkinTexture(name); boolean slim = DefaultSkinHelper - .getModel(Uuids.getOfflinePlayerUuid(name)).equals("slim"); + .getSkinTextures(Uuids.getOfflinePlayerUuid(name)) + .model() == SkinTextures.Model.SLIM; GL11.glEnable(GL11.GL_BLEND); RenderSystem.setShaderColor(1, 1, 1, 1); @@ -255,7 +256,8 @@ public final class AltRenderer bindSkinTexture(name); boolean slim = DefaultSkinHelper - .getModel(Uuids.getOfflinePlayerUuid(name)).equals("slim"); + .getSkinTextures(Uuids.getOfflinePlayerUuid(name)) + .model() == SkinTextures.Model.SLIM; GL11.glEnable(GL11.GL_BLEND); RenderSystem.setShaderColor(1, 1, 1, 1); diff --git a/src/main/java/net/wurstclient/altmanager/LoginManager.java b/src/main/java/net/wurstclient/altmanager/LoginManager.java index 34d9c2e6..12b91df0 100644 --- a/src/main/java/net/wurstclient/altmanager/LoginManager.java +++ b/src/main/java/net/wurstclient/altmanager/LoginManager.java @@ -7,84 +7,21 @@ */ package net.wurstclient.altmanager; -import java.net.Proxy; import java.util.Optional; -import com.mojang.authlib.Agent; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.exceptions.AuthenticationException; -import com.mojang.authlib.exceptions.AuthenticationUnavailableException; -import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; - -import net.minecraft.client.util.Session; +import net.minecraft.client.session.Session; +import net.minecraft.util.Uuids; import net.wurstclient.WurstClient; public enum LoginManager { ; - public static void login(String email, String password) - throws LoginException - { - YggdrasilUserAuthentication auth = - (YggdrasilUserAuthentication)new YggdrasilAuthenticationService( - Proxy.NO_PROXY, "").createUserAuthentication(Agent.MINECRAFT); - - auth.setUsername(email); - auth.setPassword(password); - - try - { - auth.logIn(); - - GameProfile profile = auth.getSelectedProfile(); - String username = profile.getName(); - String uuid = profile.getId().toString(); - String accessToken = auth.getAuthenticatedToken(); - - Session session = new Session(username, uuid, accessToken, - Optional.empty(), Optional.empty(), Session.AccountType.MOJANG); - - WurstClient.IMC.setSession(session); - - }catch(AuthenticationUnavailableException e) - { - throw new LoginException("Cannot contact authentication server!", - e); - - }catch(AuthenticationException e) - { - e.printStackTrace(); - String msg = e.getMessage().toLowerCase(); - - if(msg.contains("invalid username or password.")) - throw new LoginException("Wrong password! (or shadowbanned)", - e); - - if(msg.contains("account migrated")) - throw new LoginException("Account migrated to Mojang account.", - e); - - if(msg.contains("migrated")) - throw new LoginException( - "Account migrated to Microsoft account.", e); - - throw new LoginException("Cannot contact authentication server!", - e); - - }catch(NullPointerException e) - { - e.printStackTrace(); - - throw new LoginException("Wrong password! (or shadowbanned)", e); - } - } - public static void changeCrackedName(String newName) { - Session session = new Session(newName, "", "", Optional.empty(), - Optional.empty(), Session.AccountType.MOJANG); + Session session = + new Session(newName, Uuids.getOfflinePlayerUuid(newName), "", + Optional.empty(), Optional.empty(), Session.AccountType.MOJANG); WurstClient.IMC.setSession(session); } diff --git a/src/main/java/net/wurstclient/altmanager/MicrosoftLoginManager.java b/src/main/java/net/wurstclient/altmanager/MicrosoftLoginManager.java index 211b5c9e..d031bc86 100644 --- a/src/main/java/net/wurstclient/altmanager/MicrosoftLoginManager.java +++ b/src/main/java/net/wurstclient/altmanager/MicrosoftLoginManager.java @@ -30,7 +30,7 @@ import java.util.stream.Collectors; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import net.minecraft.client.util.Session; +import net.minecraft.client.session.Session; import net.wurstclient.WurstClient; import net.wurstclient.util.json.JsonException; import net.wurstclient.util.json.JsonUtils; diff --git a/src/main/java/net/wurstclient/altmanager/MinecraftProfile.java b/src/main/java/net/wurstclient/altmanager/MinecraftProfile.java index ed36efbd..9fb47249 100644 --- a/src/main/java/net/wurstclient/altmanager/MinecraftProfile.java +++ b/src/main/java/net/wurstclient/altmanager/MinecraftProfile.java @@ -22,9 +22,9 @@ public final class MinecraftProfile this.mcAccessToken = mcAccessToken; } - public String getUUID() + public UUID getUUID() { - return "" + uuid; + return uuid; } public String getName() diff --git a/src/main/java/net/wurstclient/altmanager/MojangAlt.java b/src/main/java/net/wurstclient/altmanager/MojangAlt.java index 79602973..86383497 100644 --- a/src/main/java/net/wurstclient/altmanager/MojangAlt.java +++ b/src/main/java/net/wurstclient/altmanager/MojangAlt.java @@ -61,13 +61,7 @@ public final class MojangAlt extends Alt @Override public void login() throws LoginException { - try - { - MicrosoftLoginManager.login(email, password); - }catch(Exception e) - { - LoginManager.login(email, password); - } + MicrosoftLoginManager.login(email, password); name = getNameFromSession(); } diff --git a/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java b/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java index 1a0d3bb7..17d833bf 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java @@ -29,6 +29,7 @@ import com.google.gson.JsonObject; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -143,9 +144,6 @@ public abstract class AltEditorScreen extends Screen @Override public final void tick() { - nameOrEmailBox.tick(); - passwordBox.tick(); - String nameOrEmail = nameOrEmailBox.getText().trim(); boolean alex = nameOrEmail.equalsIgnoreCase("Alexander01998"); @@ -346,7 +344,7 @@ public abstract class AltEditorScreen extends Screen public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); MatrixStack matrixStack = context.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); @@ -399,7 +397,8 @@ public abstract class AltEditorScreen extends Screen errorTimer--; } - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java b/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java index 12656b70..7449dd31 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java @@ -28,6 +28,7 @@ import com.google.gson.JsonObject; import com.mojang.blaze3d.systems.RenderSystem; import it.unimi.dsi.fastutil.booleans.BooleanConsumer; +import net.fabricmc.fabric.api.client.screen.v1.Screens; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; @@ -49,7 +50,6 @@ import net.minecraft.util.Util; import net.minecraft.util.math.MathHelper; import net.wurstclient.WurstClient; import net.wurstclient.altmanager.*; -import net.wurstclient.mixinterface.IScreen; import net.wurstclient.util.ListWidget; import net.wurstclient.util.MultiProcessingUtils; import net.wurstclient.util.json.JsonException; @@ -181,10 +181,12 @@ public final class AltManagerScreen extends Screen } @Override - public boolean mouseScrolled(double d, double e, double amount) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(d, e, amount); - return super.mouseScrolled(d, e, amount); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -412,7 +414,7 @@ public final class AltManagerScreen extends Screen public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); listGui.render(context, mouseX, mouseY, partialTicks); MatrixStack matrixStack = context.getMatrices(); @@ -468,7 +470,9 @@ public final class AltManagerScreen extends Screen errorTimer--; } - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); + renderButtonTooltip(context, mouseX, mouseY); renderAltTooltip(context, mouseX, mouseY); } @@ -521,13 +525,8 @@ public final class AltManagerScreen extends Screen private void renderButtonTooltip(DrawContext context, int mouseX, int mouseY) { - for(Drawable d : ((IScreen)(Object)this).getButtons()) + for(ClickableWidget button : Screens.getButtons(this)) { - if(!(d instanceof ClickableWidget)) - continue; - - ClickableWidget button = (ClickableWidget)d; - if(!button.isSelected()) continue; diff --git a/src/main/java/net/wurstclient/altmanager/screens/DirectLoginScreen.java b/src/main/java/net/wurstclient/altmanager/screens/DirectLoginScreen.java index 24c3f783..6408b3c4 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/DirectLoginScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/DirectLoginScreen.java @@ -42,18 +42,8 @@ public final class DirectLoginScreen extends AltEditorScreen }catch(LoginException e) { - try - { - LoginManager.login(nameOrEmail, password); - - }catch(LoginException e2) - { - message = "\u00a7c\u00a7lMicrosoft:\u00a7c " - + e.getMessage() + "\n\u00a7c\u00a7lMojang:\u00a7c " - + e2.getMessage(); - - doErrorEffect(); - } + message = "\u00a7c\u00a7lMicrosoft:\u00a7c " + e.getMessage(); + doErrorEffect(); return; } diff --git a/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java b/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java index b822164d..f8ebb65c 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java @@ -15,6 +15,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -237,10 +238,12 @@ public final class AddBookOfferScreen extends Screen } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double amount) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(mouseX, mouseY, amount); - return super.mouseScrolled(mouseX, mouseY, amount); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -281,9 +284,6 @@ public final class AddBookOfferScreen extends Screen pricePlusButton.active = offerToAdd != null && offerToAdd.price() < 64; priceMinusButton.active = offerToAdd != null && offerToAdd.price() > 1; - - levelField.tick(); - priceField.tick(); } @Override @@ -303,7 +303,9 @@ public final class AddBookOfferScreen extends Screen levelField.render(context, mouseX, mouseY, partialTicks); priceField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); matrixStack.translate(width / 2 - 100, 0, 0); diff --git a/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java b/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java index 67dffd84..925a5049 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java @@ -8,6 +8,7 @@ package net.wurstclient.clickgui.screens; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.text.Text; import net.wurstclient.clickgui.ClickGui; @@ -43,17 +44,21 @@ public final class ClickGuiScreen extends Screen } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double delta) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - gui.handleMouseScroll(mouseX, mouseY, delta); - return super.mouseScrolled(mouseX, mouseY, delta); + gui.handleMouseScroll(mouseX, mouseY, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); + gui.render(context, mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java index b3408132..f82c5554 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java @@ -15,6 +15,7 @@ import net.minecraft.block.Block; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -53,7 +54,7 @@ public final class EditBlockListScreen extends Screen listGui = new ListGui(client, this, blockList.getBlockNames()); blockNameField = new TextFieldWidget(client.textRenderer, - width / 2 - 152, height - 55, 150, 18, Text.literal("")); + width / 2 - 152, height - 56, 150, 20, Text.literal("")); addSelectableChild(blockNameField); blockNameField.setMaxLength(256); @@ -114,11 +115,12 @@ public final class EditBlockListScreen extends Screen } @Override - public boolean mouseScrolled(double double_1, double double_2, - double double_3) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(double_1, double_2, double_3); - return super.mouseScrolled(double_1, double_2, double_3); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -150,8 +152,6 @@ public final class EditBlockListScreen extends Screen @Override public void tick() { - blockNameField.tick(); - String nameOrId = blockNameField.getText(); blockToAdd = BlockUtils.getBlockFromNameOrID(nameOrId); addButton.active = blockToAdd != null; @@ -175,7 +175,9 @@ public final class EditBlockListScreen extends Screen matrixStack.translate(0, 0, 300); blockNameField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); matrixStack.push(); matrixStack.translate(-64 + width / 2 - 152, 0, 0); @@ -188,13 +190,13 @@ public final class EditBlockListScreen extends Screen int black = 0xff000000; context.fill(48, height - 56, 64, height - 36, border); - context.fill(49, height - 55, 64, height - 37, black); + context.fill(49, height - 55, 65, height - 37, black); context.fill(214, height - 56, 244, height - 55, border); context.fill(214, height - 37, 244, height - 36, border); context.fill(244, height - 56, 246, height - 36, border); - context.fill(214, height - 55, 243, height - 52, black); - context.fill(214, height - 40, 243, height - 37, black); - context.fill(214, height - 55, 216, height - 37, black); + context.fill(213, height - 55, 243, height - 52, black); + context.fill(213, height - 40, 243, height - 37, black); + context.fill(213, height - 55, 216, height - 37, black); context.fill(242, height - 55, 245, height - 37, black); matrixStack.pop(); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java index f5e223df..ae45bea8 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java @@ -13,6 +13,7 @@ import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -42,13 +43,13 @@ public final class EditBlockScreen extends Screen public void init() { int x1 = width / 2 - 100; - int y1 = 60; + int y1 = 59; int y2 = height / 3 * 2; TextRenderer tr = client.textRenderer; String valueString = setting.getBlockName(); - blockField = new TextFieldWidget(tr, x1, y1, 178, 18, Text.literal("")); + blockField = new TextFieldWidget(tr, x1, y1, 178, 20, Text.literal("")); blockField.setText(valueString); blockField.setSelectionStart(0); blockField.setMaxLength(256); @@ -90,12 +91,6 @@ public final class EditBlockScreen extends Screen return super.keyPressed(keyCode, scanCode, int_3); } - @Override - public void tick() - { - blockField.tick(); - } - @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) @@ -103,12 +98,14 @@ public final class EditBlockScreen extends Screen MatrixStack matrixStack = context.getMatrices(); TextRenderer tr = client.textRenderer; - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(tr, setting.getName(), width / 2, 20, 0xFFFFFF); blockField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); matrixStack.push(); matrixStack.translate(-64 + width / 2 - 100, 115, 0); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java index e3f66b5c..90301b5e 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java @@ -11,6 +11,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -246,9 +247,6 @@ public final class EditBookOfferScreen extends Screen offerToSave != null && offerToSave.price() < 64; priceMinusButton.active = offerToSave != null && offerToSave.price() > 1; - - levelField.tick(); - priceField.tick(); } @Override @@ -296,7 +294,9 @@ public final class EditBookOfferScreen extends Screen levelField.render(context, mouseX, mouseY, partialTicks); priceField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); matrixStack.translate(width / 2 - 100, 112, 0); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java index f65894db..31fb5a17 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java @@ -14,6 +14,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -125,11 +126,12 @@ public final class EditBookOffersScreen extends Screen } @Override - public boolean mouseScrolled(double double_1, double double_2, - double double_3) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(double_1, double_2, double_3); - return super.mouseScrolled(double_1, double_2, double_3); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -190,7 +192,8 @@ public final class EditBookOffersScreen extends Screen bookOffers.getName() + " (" + listGui.getItemCount() + ")", width / 2, 12, 0xffffff); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); matrixStack.pop(); } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java index 787cc1bf..5533fde4 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java @@ -19,6 +19,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -155,22 +156,13 @@ public final class EditColorScreen extends Screen client.setScreen(prevScreen); } - @Override - public void tick() - { - hexValueField.tick(); - redValueField.tick(); - greenValueField.tick(); - blueValueField.tick(); - } - @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { TextRenderer tr = client.textRenderer; - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(client.textRenderer, colorSetting.getName(), width / 2, 16, 0xF0F0F0); @@ -217,7 +209,8 @@ public final class EditColorScreen extends Screen context.fill(boxX, boxY, boxX + boxWidth, boxY + boxHeight, color.getRGB()); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java index f49027dd..1680ca99 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java @@ -14,6 +14,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -55,7 +56,7 @@ public final class EditItemListScreen extends Screen listGui = new ListGui(client, this, itemList.getItemNames()); itemNameField = new TextFieldWidget(client.textRenderer, - width / 2 - 152, height - 55, 150, 18, Text.literal("")); + width / 2 - 152, height - 56, 150, 20, Text.literal("")); addSelectableChild(itemNameField); itemNameField.setMaxLength(256); @@ -116,11 +117,12 @@ public final class EditItemListScreen extends Screen } @Override - public boolean mouseScrolled(double double_1, double double_2, - double double_3) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(double_1, double_2, double_3); - return super.mouseScrolled(double_1, double_2, double_3); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -152,8 +154,6 @@ public final class EditItemListScreen extends Screen @Override public void tick() { - itemNameField.tick(); - itemToAdd = ItemUtils .getItemFromNameOrID(itemNameField.getText().toLowerCase()); addButton.active = itemToAdd != null; @@ -177,7 +177,9 @@ public final class EditItemListScreen extends Screen matrixStack.translate(0, 0, 300); itemNameField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); matrixStack.push(); matrixStack.translate(-64 + width / 2 - 152, 0, 0); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java index 29e70034..baeaae36 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java @@ -11,6 +11,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -85,22 +86,18 @@ public final class EditSliderScreen extends Screen return super.keyPressed(keyCode, scanCode, int_3); } - @Override - public void tick() - { - valueField.tick(); - } - @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(client.textRenderer, slider.getName(), width / 2, 20, 0xFFFFFF); valueField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditTextFieldScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditTextFieldScreen.java index 3dfa0fd9..22259042 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditTextFieldScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditTextFieldScreen.java @@ -11,6 +11,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -80,22 +81,18 @@ public final class EditTextFieldScreen extends Screen return super.keyPressed(keyCode, scanCode, int_3); } - @Override - public void tick() - { - valueField.tick(); - } - @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(client.textRenderer, setting.getName(), width / 2, 20, 0xFFFFFF); valueField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java b/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java index 231dfd5c..c3618095 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java @@ -17,6 +17,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -136,11 +137,12 @@ public final class SelectFileScreen extends Screen } @Override - public boolean mouseScrolled(double double_1, double double_2, - double double_3) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(double_1, double_2, double_3); - return super.mouseScrolled(double_1, double_2, double_3); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -165,13 +167,14 @@ public final class SelectFileScreen extends Screen public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); listGui.render(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(client.textRenderer, setting.getName(), width / 2, 12, 0xffffff); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); if(doneButton.isSelected() && !doneButton.active) context.drawTooltip(textRenderer, diff --git a/src/main/java/net/wurstclient/commands/AddAltCmd.java b/src/main/java/net/wurstclient/commands/AddAltCmd.java index 5dd92ea4..1f90a308 100644 --- a/src/main/java/net/wurstclient/commands/AddAltCmd.java +++ b/src/main/java/net/wurstclient/commands/AddAltCmd.java @@ -57,7 +57,7 @@ public final class AddAltCmd extends Command { int alts = 0; AltManager altManager = WURST.getAltManager(); - String playerName = MC.getSession().getProfile().getName(); + String playerName = MC.getSession().getUsername(); for(PlayerListEntry entry : MC.player.networkHandler.getPlayerList()) { diff --git a/src/main/java/net/wurstclient/commands/EnchantCmd.java b/src/main/java/net/wurstclient/commands/EnchantCmd.java index 05f44bc6..c7ad3da4 100644 --- a/src/main/java/net/wurstclient/commands/EnchantCmd.java +++ b/src/main/java/net/wurstclient/commands/EnchantCmd.java @@ -16,6 +16,7 @@ import net.wurstclient.command.CmdException; import net.wurstclient.command.CmdSyntaxError; import net.wurstclient.command.Command; import net.wurstclient.util.ChatUtils; +import net.wurstclient.util.ItemUtils; public final class EnchantCmd extends Command { @@ -34,15 +35,16 @@ public final class EnchantCmd extends Command if(args.length > 1) throw new CmdSyntaxError(); - ItemStack stack = getHeldItem(); - enchant(stack); - + enchant(getHeldItem(), 127); ChatUtils.message("Item enchanted."); } private ItemStack getHeldItem() throws CmdError { - ItemStack stack = MC.player.getInventory().getMainHandStack(); + ItemStack stack = MC.player.getMainHandStack(); + + if(stack.isEmpty()) + stack = MC.player.getOffHandStack(); if(stack.isEmpty()) throw new CmdError("There is no item in your hand."); @@ -50,23 +52,26 @@ public final class EnchantCmd extends Command return stack; } - private void enchant(ItemStack stack) + private void enchant(ItemStack stack, int level) { for(Enchantment enchantment : Registries.ENCHANTMENT) { - if(enchantment == Enchantments.SILK_TOUCH) - continue; - + // Skip curses if(enchantment.isCursed()) continue; + // Skip Silk Touch so it doesn't remove Fortune + if(enchantment == Enchantments.SILK_TOUCH) + continue; + + // Limit Quick Charge to level 5 so it doesn't break if(enchantment == Enchantments.QUICK_CHARGE) { - stack.addEnchantment(enchantment, 5); + stack.addEnchantment(enchantment, Math.min(level, 5)); continue; } - stack.addEnchantment(enchantment, 127); + ItemUtils.addEnchantment(stack, enchantment, level); } } diff --git a/src/main/java/net/wurstclient/commands/FollowCmd.java b/src/main/java/net/wurstclient/commands/FollowCmd.java index 77c25c76..428bec89 100644 --- a/src/main/java/net/wurstclient/commands/FollowCmd.java +++ b/src/main/java/net/wurstclient/commands/FollowCmd.java @@ -39,7 +39,7 @@ public final class FollowCmd extends Command Entity entity = StreamSupport .stream(MC.world.getEntities().spliterator(), true) - .filter(e -> e instanceof LivingEntity) + .filter(LivingEntity.class::isInstance) .filter(e -> !e.isRemoved() && ((LivingEntity)e).getHealth() > 0) .filter(e -> e != MC.player) .filter(e -> !(e instanceof FakePlayerEntity)) diff --git a/src/main/java/net/wurstclient/commands/GoToCmd.java b/src/main/java/net/wurstclient/commands/GoToCmd.java index f42501a4..0dedc5cc 100644 --- a/src/main/java/net/wurstclient/commands/GoToCmd.java +++ b/src/main/java/net/wurstclient/commands/GoToCmd.java @@ -89,7 +89,7 @@ public final class GoToCmd extends Command { LivingEntity entity = StreamSupport .stream(MC.world.getEntities().spliterator(), true) - .filter(e -> e instanceof LivingEntity).map(e -> (LivingEntity)e) + .filter(LivingEntity.class::isInstance).map(e -> (LivingEntity)e) .filter(e -> !e.isRemoved() && e.getHealth() > 0) .filter(e -> e != MC.player) .filter(e -> !(e instanceof FakePlayerEntity)) diff --git a/src/main/java/net/wurstclient/commands/PathCmd.java b/src/main/java/net/wurstclient/commands/PathCmd.java index 71b5d5d4..98a2570a 100644 --- a/src/main/java/net/wurstclient/commands/PathCmd.java +++ b/src/main/java/net/wurstclient/commands/PathCmd.java @@ -129,7 +129,7 @@ public final class PathCmd extends Command { LivingEntity entity = StreamSupport .stream(MC.world.getEntities().spliterator(), true) - .filter(e -> e instanceof LivingEntity).map(e -> (LivingEntity)e) + .filter(LivingEntity.class::isInstance).map(e -> (LivingEntity)e) .filter(e -> !e.isRemoved() && e.getHealth() > 0) .filter(e -> e != MC.player) .filter(e -> !(e instanceof FakePlayerEntity)) diff --git a/src/main/java/net/wurstclient/commands/PotionCmd.java b/src/main/java/net/wurstclient/commands/PotionCmd.java index edabef67..66b20635 100644 --- a/src/main/java/net/wurstclient/commands/PotionCmd.java +++ b/src/main/java/net/wurstclient/commands/PotionCmd.java @@ -80,15 +80,15 @@ public final class PotionCmd extends Command { NbtCompound effect = new NbtCompound(); - effect.putInt("Id", parseEffectId(args[1 + i * 3])); - effect.putInt("Amplifier", parseInt(args[2 + i * 3]) - 1); - effect.putInt("Duration", parseInt(args[3 + i * 3]) * 20); + effect.putInt("id", parseEffectId(args[1 + i * 3])); + effect.putInt("amplifier", parseInt(args[2 + i * 3]) - 1); + effect.putInt("duration", parseInt(args[3 + i * 3]) * 20); effects.add(effect); } NbtCompound nbt = new NbtCompound(); - nbt.put("CustomPotionEffects", effects); + nbt.put("custom_potion_effects", effects); stack.setNbt(nbt); ChatUtils.message("Potion modified."); } @@ -103,10 +103,10 @@ public final class PotionCmd extends Command { NbtCompound tag = new NbtCompound(); - int id = StatusEffect.getRawId(effect.getEffectType()); - tag.putInt("Id", id); - tag.putInt("Amplifier", effect.getAmplifier()); - tag.putInt("Duration", effect.getDuration()); + int id = Registries.STATUS_EFFECT.getRawId(effect.getEffectType()); + tag.putInt("id", id); + tag.putInt("amplifier", effect.getAmplifier()); + tag.putInt("duration", effect.getDuration()); nbt.add(tag); } @@ -127,20 +127,21 @@ public final class PotionCmd extends Command NbtList newEffects = new NbtList(); for(StatusEffectInstance oldEffect : oldEffects) { - int oldId = StatusEffect.getRawId(oldEffect.getEffectType()); + int oldId = + Registries.STATUS_EFFECT.getRawId(oldEffect.getEffectType()); if(oldId == id) continue; NbtCompound effect = new NbtCompound(); - effect.putInt("Id", oldId); - effect.putInt("Amplifier", oldEffect.getAmplifier()); - effect.putInt("Duration", oldEffect.getDuration()); + effect.putInt("id", oldId); + effect.putInt("amplifier", oldEffect.getAmplifier()); + effect.putInt("duration", oldEffect.getDuration()); newEffects.add(effect); } NbtCompound nbt = new NbtCompound(); - nbt.put("CustomPotionEffects", newEffects); + nbt.put("custom_potion_effects", newEffects); stack.setNbt(nbt); ChatUtils.message("Effect removed."); } @@ -157,7 +158,7 @@ public final class PotionCmd extends Command Identifier identifier = new Identifier(input); StatusEffect effect = Registries.STATUS_EFFECT.get(identifier); - id = StatusEffect.getRawId(effect); + id = Registries.STATUS_EFFECT.getRawId(effect); }catch(InvalidIdentifierException e) { diff --git a/src/main/java/net/wurstclient/commands/ProtectCmd.java b/src/main/java/net/wurstclient/commands/ProtectCmd.java index 6a292b7c..67e716cf 100644 --- a/src/main/java/net/wurstclient/commands/ProtectCmd.java +++ b/src/main/java/net/wurstclient/commands/ProtectCmd.java @@ -40,7 +40,7 @@ public final class ProtectCmd extends Command Entity entity = StreamSupport .stream(MC.world.getEntities().spliterator(), true) - .filter(e -> e instanceof LivingEntity) + .filter(LivingEntity.class::isInstance) .filter(e -> !e.isRemoved() && ((LivingEntity)e).getHealth() > 0) .filter(e -> e != MC.player) .filter(e -> !(e instanceof FakePlayerEntity)) diff --git a/src/main/java/net/wurstclient/commands/TpCmd.java b/src/main/java/net/wurstclient/commands/TpCmd.java index a99e7a72..d45a3fd4 100644 --- a/src/main/java/net/wurstclient/commands/TpCmd.java +++ b/src/main/java/net/wurstclient/commands/TpCmd.java @@ -67,7 +67,7 @@ public final class TpCmd extends Command { LivingEntity entity = StreamSupport .stream(MC.world.getEntities().spliterator(), true) - .filter(e -> e instanceof LivingEntity).map(e -> (LivingEntity)e) + .filter(LivingEntity.class::isInstance).map(e -> (LivingEntity)e) .filter(e -> !e.isRemoved() && e.getHealth() > 0) .filter(e -> e != MC.player) .filter(e -> !(e instanceof FakePlayerEntity)) diff --git a/src/main/java/net/wurstclient/commands/VClipCmd.java b/src/main/java/net/wurstclient/commands/VClipCmd.java index 0651ccbb..23045ac1 100644 --- a/src/main/java/net/wurstclient/commands/VClipCmd.java +++ b/src/main/java/net/wurstclient/commands/VClipCmd.java @@ -10,11 +10,11 @@ package net.wurstclient.commands; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; import net.wurstclient.command.CmdError; import net.wurstclient.command.CmdException; import net.wurstclient.command.CmdSyntaxError; import net.wurstclient.command.Command; +import net.wurstclient.util.BlockUtils; import net.wurstclient.util.MathUtils; public final class VClipCmd extends Command @@ -92,15 +92,12 @@ public final class VClipCmd extends Command private boolean hasCollisions(Box box) { - Iterable collisions = - MC.world.getBlockCollisions(MC.player, box); - - return collisions.iterator().hasNext(); + return BlockUtils.getBlockCollisions(box).findAny().isPresent(); } private double getSubBlockOffset(Box offsetBox) { - return IMC.getWorld().getCollidingBoxes(MC.player, offsetBox) + return BlockUtils.getBlockCollisions(offsetBox) .mapToDouble(box -> box.maxY).max().getAsDouble() - offsetBox.minY; } diff --git a/src/main/java/net/wurstclient/events/HitResultRayTraceListener.java b/src/main/java/net/wurstclient/events/HitResultRayTraceListener.java index e843acc0..84f55dd5 100644 --- a/src/main/java/net/wurstclient/events/HitResultRayTraceListener.java +++ b/src/main/java/net/wurstclient/events/HitResultRayTraceListener.java @@ -14,23 +14,23 @@ import net.wurstclient.event.Listener; public interface HitResultRayTraceListener extends Listener { - public void onHitResultRayTrace(float float_1); + public void onHitResultRayTrace(float partialTicks); public static class HitResultRayTraceEvent extends Event { - private float float_1; + private float partialTicks; - public HitResultRayTraceEvent(float float_1) + public HitResultRayTraceEvent(float partialTicks) { - this.float_1 = float_1; + this.partialTicks = partialTicks; } @Override public void fire(ArrayList listeners) { for(HitResultRayTraceListener listener : listeners) - listener.onHitResultRayTrace(float_1); + listener.onHitResultRayTrace(partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/events/PlayerMoveListener.java b/src/main/java/net/wurstclient/events/PlayerMoveListener.java index 366d4a43..8b79bb2f 100644 --- a/src/main/java/net/wurstclient/events/PlayerMoveListener.java +++ b/src/main/java/net/wurstclient/events/PlayerMoveListener.java @@ -11,26 +11,20 @@ import java.util.ArrayList; import net.wurstclient.event.Event; import net.wurstclient.event.Listener; -import net.wurstclient.mixinterface.IClientPlayerEntity; public interface PlayerMoveListener extends Listener { - public void onPlayerMove(IClientPlayerEntity player); + public void onPlayerMove(); public static class PlayerMoveEvent extends Event { - private final IClientPlayerEntity player; - - public PlayerMoveEvent(IClientPlayerEntity player) - { - this.player = player; - } + public static final PlayerMoveEvent INSTANCE = new PlayerMoveEvent(); @Override public void fire(ArrayList listeners) { for(PlayerMoveListener listener : listeners) - listener.onPlayerMove(player); + listener.onPlayerMove(); } @Override diff --git a/src/main/java/net/wurstclient/events/RightClickListener.java b/src/main/java/net/wurstclient/events/RightClickListener.java index c43e9ac4..4c1fdad7 100644 --- a/src/main/java/net/wurstclient/events/RightClickListener.java +++ b/src/main/java/net/wurstclient/events/RightClickListener.java @@ -9,11 +9,17 @@ package net.wurstclient.events; import java.util.ArrayList; +import net.minecraft.client.MinecraftClient; import net.wurstclient.event.CancellableEvent; import net.wurstclient.event.Listener; public interface RightClickListener extends Listener { + /** + * Fired in {@link MinecraftClient#doItemUse()} after the + * {@code interactionManager.isBreakingBlock()} check, but before the + * item use cooldown is increased. + */ public void onRightClick(RightClickEvent event); public static class RightClickEvent diff --git a/src/main/java/net/wurstclient/events/ShouldDrawSideListener.java b/src/main/java/net/wurstclient/events/ShouldDrawSideListener.java index c99b2d44..bd0744a2 100644 --- a/src/main/java/net/wurstclient/events/ShouldDrawSideListener.java +++ b/src/main/java/net/wurstclient/events/ShouldDrawSideListener.java @@ -8,6 +8,7 @@ package net.wurstclient.events; import java.util.ArrayList; +import java.util.Objects; import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockPos; @@ -27,7 +28,7 @@ public interface ShouldDrawSideListener extends Listener public ShouldDrawSideEvent(BlockState state, BlockPos pos) { - this.state = state; + this.state = Objects.requireNonNull(state); this.pos = pos; } diff --git a/src/main/java/net/wurstclient/events/TesselateBlockListener.java b/src/main/java/net/wurstclient/events/TesselateBlockListener.java deleted file mode 100644 index 1873402f..00000000 --- a/src/main/java/net/wurstclient/events/TesselateBlockListener.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.events; - -import java.util.ArrayList; - -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.wurstclient.event.CancellableEvent; -import net.wurstclient.event.Listener; - -public interface TesselateBlockListener extends Listener -{ - public void onTesselateBlock(TesselateBlockEvent event); - - public static class TesselateBlockEvent - extends CancellableEvent - { - private final BlockState state; - private final BlockPos pos; - - public TesselateBlockEvent(BlockState state, BlockPos pos) - { - this.state = state; - this.pos = pos; - } - - public BlockState getState() - { - return state; - } - - public BlockPos getPos() - { - return pos; - } - - @Override - public void fire(ArrayList listeners) - { - for(TesselateBlockListener listener : listeners) - { - listener.onTesselateBlock(this); - - if(isCancelled()) - break; - } - } - - @Override - public Class getListenerType() - { - return TesselateBlockListener.class; - } - } -} diff --git a/src/main/java/net/wurstclient/hack/HackList.java b/src/main/java/net/wurstclient/hack/HackList.java index 2fa4598f..43ca80a8 100644 --- a/src/main/java/net/wurstclient/hack/HackList.java +++ b/src/main/java/net/wurstclient/hack/HackList.java @@ -65,6 +65,7 @@ public final class HackList implements UpdateListener public final AutoToolHack autoToolHack = new AutoToolHack(); public final AutoTotemHack autoTotemHack = new AutoTotemHack(); public final AutoWalkHack autoWalkHack = new AutoWalkHack(); + public final BarrierEspHack barrierEspHack = new BarrierEspHack(); public final BaseFinderHack baseFinderHack = new BaseFinderHack(); public final BlinkHack blinkHack = new BlinkHack(); public final BoatFlyHack boatFlyHack = new BoatFlyHack(); diff --git a/src/main/java/net/wurstclient/hacks/AimAssistHack.java b/src/main/java/net/wurstclient/hacks/AimAssistHack.java index 3a60c7b1..d8ab2f05 100644 --- a/src/main/java/net/wurstclient/hacks/AimAssistHack.java +++ b/src/main/java/net/wurstclient/hacks/AimAssistHack.java @@ -15,14 +15,17 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.util.math.Box; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; import net.wurstclient.Category; import net.wurstclient.events.RenderListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; +import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.settings.filterlists.EntityFilterList; import net.wurstclient.settings.filters.*; +import net.wurstclient.util.BlockUtils; import net.wurstclient.util.EntityUtils; import net.wurstclient.util.RotationUtils; import net.wurstclient.util.RotationUtils.Rotation; @@ -42,18 +45,32 @@ public final class AimAssistHack extends Hack + "360\u00b0 = aims at entities all around you.", 120, 30, 360, 10, ValueDisplay.DEGREES); + private final CheckboxSetting checkLOS = new CheckboxSetting( + "Check line of sight", "Won't aim at entities behind blocks.", true); + private final EntityFilterList entityFilters = new EntityFilterList(FilterPlayersSetting.genericCombat(false), FilterSleepingSetting.genericCombat(false), FilterFlyingSetting.genericCombat(0), - FilterMonstersSetting.genericCombat(false), - FilterPigmenSetting.genericCombat(false), - FilterEndermenSetting.genericCombat(false), - FilterAnimalsSetting.genericCombat(true), + FilterHostileSetting.genericCombat(false), + FilterNeutralSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterPassiveSetting.genericCombat(true), + FilterPassiveWaterSetting.genericCombat(true), FilterBabiesSetting.genericCombat(true), + FilterBatsSetting.genericCombat(true), + FilterSlimesSetting.genericCombat(true), FilterPetsSetting.genericCombat(true), - FilterTradersSetting.genericCombat(true), + FilterVillagersSetting.genericCombat(true), + FilterZombieVillagersSetting.genericCombat(true), FilterGolemsSetting.genericCombat(false), + FilterPiglinsSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterZombiePiglinsSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterEndermenSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterShulkersSetting.genericCombat(false), FilterInvisibleSetting.genericCombat(true), FilterNamedSetting.genericCombat(false), FilterShulkerBulletSetting.genericCombat(false), @@ -72,6 +89,7 @@ public final class AimAssistHack extends Hack addSetting(range); addSetting(rotationSpeed); addSetting(fov); + addSetting(checkLOS); entityFilters.forEach(this::addSetting); } @@ -87,7 +105,6 @@ public final class AimAssistHack extends Hack WURST.getHax().killauraLegitHack.setEnabled(false); WURST.getHax().multiAuraHack.setEnabled(false); WURST.getHax().protectHack.setEnabled(false); - WURST.getHax().triggerBotHack.setEnabled(false); WURST.getHax().tpAuraHack.setEnabled(false); EVENTS.add(UpdateListener.class, this); @@ -126,6 +143,13 @@ public final class AimAssistHack extends Hack if(target == null) return; + Vec3d hitVec = target.getBoundingBox().getCenter(); + if(checkLOS.isChecked() && !BlockUtils.hasLineOfSight(hitVec)) + { + target = null; + return; + } + WURST.getHax().autoSwordHack.setSlot(); faceEntityClient(target); } diff --git a/src/main/java/net/wurstclient/hacks/AirPlaceHack.java b/src/main/java/net/wurstclient/hacks/AirPlaceHack.java index 48665962..08b952e0 100644 --- a/src/main/java/net/wurstclient/hacks/AirPlaceHack.java +++ b/src/main/java/net/wurstclient/hacks/AirPlaceHack.java @@ -15,6 +15,7 @@ import net.wurstclient.events.RightClickListener; import net.wurstclient.hack.Hack; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; +import net.wurstclient.util.InteractionSimulator; @SearchTags({"air place"}) public final class AirPlaceHack extends Hack implements RightClickListener @@ -32,8 +33,6 @@ public final class AirPlaceHack extends Hack implements RightClickListener @Override public void onEnable() { - WURST.getHax().autoFishHack.setEnabled(false); - EVENTS.add(RightClickListener.class, this); } @@ -47,11 +46,17 @@ public final class AirPlaceHack extends Hack implements RightClickListener public void onRightClick(RightClickEvent event) { HitResult hitResult = MC.player.raycast(range.getValue(), 0, false); + if(hitResult.getType() != HitResult.Type.MISS) + return; + if(!(hitResult instanceof BlockHitResult blockHitResult)) return; - IMC.getInteractionManager().rightClickBlock( - blockHitResult.getBlockPos(), blockHitResult.getSide(), - blockHitResult.getPos()); + MC.itemUseCooldown = 4; + if(MC.player.isRiding()) + return; + + InteractionSimulator.rightClickBlock(blockHitResult); + event.cancel(); } } diff --git a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java index 5eca0dc6..824fa692 100644 --- a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java @@ -20,13 +20,11 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.item.Items; import net.minecraft.util.Hand; -import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.RaycastContext; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.UpdateListener; @@ -240,11 +238,8 @@ public final class AnchorAuraHack extends Hack implements UpdateListener if(distanceSqHitVec >= distanceSqPosVec) continue; - if(checkLOS.isChecked() && MC.world - .raycast(new RaycastContext(eyesPos, hitVec, - RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, MC.player)) - .getType() != HitResult.Type.MISS) + if(checkLOS.isChecked() + && !BlockUtils.hasLineOfSight(eyesPos, hitVec)) continue; faceBlocks.getSelected().face(hitVec); @@ -284,11 +279,8 @@ public final class AnchorAuraHack extends Hack implements UpdateListener if(distanceSqPosVec > eyesPos.squaredDistanceTo(posVec.add(dirVec))) continue; - if(checkLOS.isChecked() && MC.world - .raycast(new RaycastContext(eyesPos, hitVec, - RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, MC.player)) - .getType() != HitResult.Type.MISS) + if(checkLOS.isChecked() + && !BlockUtils.hasLineOfSight(eyesPos, hitVec)) continue; InventoryUtils.selectItem(Items.RESPAWN_ANCHOR, diff --git a/src/main/java/net/wurstclient/hacks/AntiBlindHack.java b/src/main/java/net/wurstclient/hacks/AntiBlindHack.java index dc9ea404..fc76a3a2 100644 --- a/src/main/java/net/wurstclient/hacks/AntiBlindHack.java +++ b/src/main/java/net/wurstclient/hacks/AntiBlindHack.java @@ -23,5 +23,6 @@ public final class AntiBlindHack extends Hack setCategory(Category.RENDER); } - // See BackgroundRendererMixin, LightTextureManagerMixin, WorldRendererMixin + // See BackgroundRendererMixin, WorldRendererMixin, + // ClientPlayerEntityMixin.hasStatusEffect() } diff --git a/src/main/java/net/wurstclient/hacks/AutoArmorHack.java b/src/main/java/net/wurstclient/hacks/AutoArmorHack.java index 23832a70..e230ef52 100644 --- a/src/main/java/net/wurstclient/hacks/AutoArmorHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoArmorHack.java @@ -28,7 +28,6 @@ import net.wurstclient.SearchTags; import net.wurstclient.events.PacketOutputListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; -import net.wurstclient.mixinterface.IArmorItem; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; @@ -176,7 +175,7 @@ public final class AutoArmorHack extends Hack { int armorPoints = item.getProtection(); int prtPoints = 0; - int armorToughness = (int)((IArmorItem)item).getToughness(); + int armorToughness = (int)item.toughness; int armorType = item.getMaterial().getProtection(Type.LEGGINGS); if(useEnchantments.isChecked()) diff --git a/src/main/java/net/wurstclient/hacks/AutoBuildHack.java b/src/main/java/net/wurstclient/hacks/AutoBuildHack.java index e9f53776..021d196c 100644 --- a/src/main/java/net/wurstclient/hacks/AutoBuildHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoBuildHack.java @@ -26,7 +26,6 @@ import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.RaycastContext; import net.wurstclient.Category; import net.wurstclient.events.RenderListener; import net.wurstclient.events.RightClickListener; @@ -199,7 +198,7 @@ public final class AutoBuildHack extends Hack return; } - if(!fastPlace.isChecked() && IMC.getItemUseCooldown() > 0) + if(!fastPlace.isChecked() && MC.itemUseCooldown > 0) return; placeNextBlock(); @@ -253,11 +252,8 @@ public final class AutoBuildHack extends Hack continue; // check line of sight - if(checkLOS.isChecked() && MC.world - .raycast(new RaycastContext(eyesPos, hitVec, - RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, MC.player)) - .getType() != HitResult.Type.MISS) + if(checkLOS.isChecked() + && !BlockUtils.hasLineOfSight(eyesPos, hitVec)) continue; // face block @@ -271,7 +267,7 @@ public final class AutoBuildHack extends Hack IMC.getInteractionManager().rightClickBlock(neighbor, side.getOpposite(), hitVec); MC.player.swingHand(Hand.MAIN_HAND); - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; return true; } diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index 6de6c021..94062549 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -95,7 +95,7 @@ public final class AutoFarmHack extends Hack if(currentlyHarvesting != null) { - IMC.getInteractionManager().setBreakingBlock(true); + MC.interactionManager.breakingBlock = true; MC.interactionManager.cancelBlockBreaking(); currentlyHarvesting = null; } @@ -266,7 +266,7 @@ public final class AutoFarmHack extends Hack private boolean replant(List blocksToReplant) { // check cooldown - if(IMC.getItemUseCooldown() > 0) + if(MC.itemUseCooldown > 0) return false; // check if already holding one of the seeds needed for blocksToReplant @@ -307,7 +307,7 @@ public final class AutoFarmHack extends Hack .sendPacket(new HandSwingC2SPacket(hand)); // reset cooldown - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; return true; } } diff --git a/src/main/java/net/wurstclient/hacks/AutoFishHack.java b/src/main/java/net/wurstclient/hacks/AutoFishHack.java index 6e4fe102..41ec13a5 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFishHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFishHack.java @@ -41,12 +41,13 @@ public final class AutoFishHack extends Hack private final SliderSetting catchDelay = new SliderSetting("Catch delay", "How long AutoFish will wait after a bite before reeling in.", 0, 0, 60, - 1, ValueDisplay.INTEGER.withSuffix(" ticks")); + 1, ValueDisplay.INTEGER.withSuffix(" ticks").withLabel(1, "1 tick")); private final SliderSetting retryDelay = new SliderSetting("Retry delay", "If casting or reeling in the fishing rod fails, this is how long" + " AutoFish will wait before trying again.", - 15, 0, 100, 1, ValueDisplay.INTEGER.withSuffix(" ticks")); + 15, 0, 100, 1, + ValueDisplay.INTEGER.withSuffix(" ticks").withLabel(1, "1 tick")); private final SliderSetting patience = new SliderSetting("Patience", "How long AutoFish will wait if it doesn't get a bite before reeling in.", @@ -95,8 +96,6 @@ public final class AutoFishHack extends Hack @Override public void onEnable() { - WURST.getHax().airPlaceHack.setEnabled(false); - castRodTimer = 0; reelInTimer = 0; rodSelector.reset(); @@ -148,7 +147,7 @@ public final class AutoFishHack extends Hack if(castRodTimer > 0) return; - IMC.rightClick(); + MC.doItemUse(); castRodTimer = retryDelay.getValueI(); reelInTimer = 20 * patience.getValueI(); return; @@ -157,7 +156,7 @@ public final class AutoFishHack extends Hack // otherwise, reel in when it's time if(reelInTimer == 0) { - IMC.rightClick(); + MC.doItemUse(); reelInTimer = retryDelay.getValueI(); castRodTimer = retryDelay.getValueI(); } diff --git a/src/main/java/net/wurstclient/hacks/AutoLeaveHack.java b/src/main/java/net/wurstclient/hacks/AutoLeaveHack.java index 3bbf60b4..6b4bfb25 100644 --- a/src/main/java/net/wurstclient/hacks/AutoLeaveHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoLeaveHack.java @@ -13,6 +13,7 @@ import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; +import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.EnumSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; @@ -36,13 +37,18 @@ public final class AutoLeaveHack extends Hack implements UpdateListener + "Bypasses both CombatLog and NoCheat+.", Mode.values(), Mode.QUIT); + private final CheckboxSetting disableAutoReconnect = new CheckboxSetting( + "Disable AutoReconnect", "Automatically turns off AutoReconnect when" + + " AutoLeave makes you leave the server.", + true); + public AutoLeaveHack() { super("AutoLeave"); - setCategory(Category.COMBAT); addSetting(health); addSetting(mode); + addSetting(disableAutoReconnect); } @Override @@ -76,7 +82,8 @@ public final class AutoLeaveHack extends Hack implements UpdateListener return; // check health - if(MC.player.getHealth() > health.getValueF() * 2F) + float currentHealth = MC.player.getHealth(); + if(currentHealth <= 0F || currentHealth > health.getValueF() * 2F) return; // leave server @@ -104,6 +111,9 @@ public final class AutoLeaveHack extends Hack implements UpdateListener // disable setEnabled(false); + + if(disableAutoReconnect.isChecked()) + WURST.getHax().autoReconnectHack.setEnabled(false); } public static enum Mode diff --git a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java index b5c381fa..028452b4 100644 --- a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java @@ -154,7 +154,7 @@ public final class AutoLibrarianHack extends Hack if(breakingJobSite) { - IMC.getInteractionManager().setBreakingBlock(true); + MC.interactionManager.breakingBlock = true; MC.interactionManager.cancelBlockBreaking(); breakingJobSite = false; } @@ -367,7 +367,7 @@ public final class AutoLibrarianHack extends Hack private void openTradeScreen() { - if(IMC.getItemUseCooldown() > 0) + if(MC.itemUseCooldown > 0) return; ClientPlayerInteractionManager im = MC.interactionManager; @@ -404,13 +404,13 @@ public final class AutoLibrarianHack extends Hack swingHand.getSelected().swing(hand); // set cooldown - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; } private void closeTradeScreen() { MC.player.closeHandledScreen(); - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; } private BookOffer findEnchantedBookOffer(TradeOfferList tradeOffers) @@ -452,7 +452,7 @@ public final class AutoLibrarianHack extends Hack Stream stream = StreamSupport.stream(MC.world.getEntities().spliterator(), true) .filter(e -> !e.isRemoved()) - .filter(e -> e instanceof VillagerEntity) + .filter(VillagerEntity.class::isInstance) .map(e -> (VillagerEntity)e).filter(e -> e.getHealth() > 0) .filter(e -> player.squaredDistanceTo(e) <= rangeSq) .filter(e -> e.getVillagerData() diff --git a/src/main/java/net/wurstclient/hacks/AutoMineHack.java b/src/main/java/net/wurstclient/hacks/AutoMineHack.java index 51590c44..4e8c1b8c 100644 --- a/src/main/java/net/wurstclient/hacks/AutoMineHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoMineHack.java @@ -83,7 +83,7 @@ public final class AutoMineHack extends Hack implements UpdateListener if(currentBlock == null) return; - IMC.getInteractionManager().setBreakingBlock(true); + MC.interactionManager.breakingBlock = true; MC.interactionManager.cancelBlockBreaking(); currentBlock = null; } diff --git a/src/main/java/net/wurstclient/hacks/AutoRespawnHack.java b/src/main/java/net/wurstclient/hacks/AutoRespawnHack.java index d4dcc636..55b4efac 100644 --- a/src/main/java/net/wurstclient/hacks/AutoRespawnHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoRespawnHack.java @@ -9,16 +9,23 @@ package net.wurstclient.hacks; import net.wurstclient.Category; import net.wurstclient.SearchTags; +import net.wurstclient.WurstClient; import net.wurstclient.events.DeathListener; import net.wurstclient.hack.Hack; +import net.wurstclient.settings.CheckboxSetting; @SearchTags({"auto respawn", "AutoRevive", "auto revive"}) public final class AutoRespawnHack extends Hack implements DeathListener { + private final CheckboxSetting button = + new CheckboxSetting("Death screen button", "Shows a button on the death" + + " screen that lets you quickly enable AutoRespawn.", true); + public AutoRespawnHack() { super("AutoRespawn"); setCategory(Category.COMBAT); + addSetting(button); } @Override @@ -39,4 +46,10 @@ public final class AutoRespawnHack extends Hack implements DeathListener MC.player.requestRespawn(); MC.setScreen(null); } + + public boolean shouldShowButton() + { + return WurstClient.INSTANCE.isEnabled() && !isEnabled() + && button.isChecked(); + } } diff --git a/src/main/java/net/wurstclient/hacks/AutoSwordHack.java b/src/main/java/net/wurstclient/hacks/AutoSwordHack.java index 93a75b5e..6e76c545 100644 --- a/src/main/java/net/wurstclient/hacks/AutoSwordHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoSwordHack.java @@ -12,18 +12,19 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.item.Item; import net.minecraft.item.MiningToolItem; import net.minecraft.item.SwordItem; +import net.minecraft.item.ToolItem; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; -import net.wurstclient.mixinterface.IMiningToolItem; -import net.wurstclient.mixinterface.ISwordItem; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.EnumSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; +import net.wurstclient.util.EntityUtils; +import net.wurstclient.util.ItemUtils; @SearchTags({"auto sword"}) public final class AutoSwordHack extends Hack implements UpdateListener @@ -39,7 +40,8 @@ public final class AutoSwordHack extends Hack implements UpdateListener private final SliderSetting releaseTime = new SliderSetting("Release time", "Time until AutoSword will switch back from the weapon to the previously selected slot.\n\n" + "Only works when \u00a7lSwitch back\u00a7r is checked.", - 10, 1, 200, 1, ValueDisplay.INTEGER.withSuffix(" ticks")); + 10, 1, 200, 1, + ValueDisplay.INTEGER.withSuffix(" ticks").withLabel(1, "1 tick")); private int oldSlot; private int timer; @@ -47,7 +49,6 @@ public final class AutoSwordHack extends Hack implements UpdateListener public AutoSwordHack() { super("AutoSword"); - setCategory(Category.COMBAT); addSetting(priority); @@ -78,7 +79,7 @@ public final class AutoSwordHack extends Hack implements UpdateListener Entity entity = ((EntityHitResult)MC.crosshairTarget).getEntity(); if(entity instanceof LivingEntity - && ((LivingEntity)entity).getHealth() > 0) + && EntityUtils.IS_ATTACKABLE.test(entity)) setSlot(); } @@ -144,17 +145,15 @@ public final class AutoSwordHack extends Hack implements UpdateListener switch(priority.getSelected()) { case SPEED: - if(item instanceof SwordItem) - return ((ISwordItem)item).fuckMcAfee(); - if(item instanceof MiningToolItem) - return ((IMiningToolItem)item).fuckMcAfee2(); + if(item instanceof ToolItem tool) + return ItemUtils.getAttackSpeed(tool); break; case DAMAGE: - if(item instanceof SwordItem) - return ((SwordItem)item).getAttackDamage(); - if(item instanceof MiningToolItem) - return ((IMiningToolItem)item).fuckMcAfee1(); + if(item instanceof SwordItem sword) + return sword.getAttackDamage(); + if(item instanceof MiningToolItem miningTool) + return miningTool.getAttackDamage(); break; } diff --git a/src/main/java/net/wurstclient/hacks/BarrierEspHack.java b/src/main/java/net/wurstclient/hacks/BarrierEspHack.java new file mode 100644 index 00000000..184626e7 --- /dev/null +++ b/src/main/java/net/wurstclient/hacks/BarrierEspHack.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.hacks; + +import net.wurstclient.Category; +import net.wurstclient.SearchTags; +import net.wurstclient.hack.Hack; + +@SearchTags({"barrier esp"}) +public class BarrierEspHack extends Hack +{ + public BarrierEspHack() + { + super("BarrierESP"); + setCategory(Category.RENDER); + } + + // See ClientWorldMixin +} diff --git a/src/main/java/net/wurstclient/hacks/BonemealAuraHack.java b/src/main/java/net/wurstclient/hacks/BonemealAuraHack.java index 7c6c6657..abf5e593 100644 --- a/src/main/java/net/wurstclient/hacks/BonemealAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/BonemealAuraHack.java @@ -18,11 +18,9 @@ import net.minecraft.client.world.ClientWorld; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.Hand; -import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.RaycastContext; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.UpdateListener; @@ -94,7 +92,7 @@ public final class BonemealAuraHack extends Hack implements UpdateListener public void onUpdate() { // wait for right click timer - if(IMC.getItemUseCooldown() > 0) + if(MC.itemUseCooldown > 0) return; // get valid blocks @@ -210,16 +208,16 @@ public final class BonemealAuraHack extends Hack implements UpdateListener return false; if(block instanceof SaplingBlock - && ((SaplingBlock)block).isFertilizable(world, pos, state, true)) + && ((SaplingBlock)block).isFertilizable(world, pos, state)) return saplings.isChecked(); if(block instanceof CropBlock - && ((CropBlock)block).isFertilizable(world, pos, state, true)) + && ((CropBlock)block).isFertilizable(world, pos, state)) return crops.isChecked(); if(block instanceof StemBlock - && ((StemBlock)block).isFertilizable(world, pos, state, true)) + && ((StemBlock)block).isFertilizable(world, pos, state)) return stems.isChecked(); if(block instanceof CocoaBlock - && ((CocoaBlock)block).isFertilizable(world, pos, state, true)) + && ((CocoaBlock)block).isFertilizable(world, pos, state)) return cocoa.isChecked(); return other.isChecked(); } @@ -244,11 +242,7 @@ public final class BonemealAuraHack extends Hack implements UpdateListener continue; // check line of sight - if(MC.world - .raycast(new RaycastContext(eyesPos, hitVec, - RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, MC.player)) - .getType() != HitResult.Type.MISS) + if(!BlockUtils.hasLineOfSight(eyesPos, hitVec)) continue; // face block @@ -257,7 +251,7 @@ public final class BonemealAuraHack extends Hack implements UpdateListener // place block IMC.getInteractionManager().rightClickBlock(pos, side, hitVec); MC.player.swingHand(Hand.MAIN_HAND); - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; return true; } diff --git a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java index b78e7a4c..8016c755 100644 --- a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java +++ b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java @@ -16,8 +16,6 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.BlockItem; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.wurstclient.Category; import net.wurstclient.SearchTags; @@ -32,6 +30,7 @@ import net.wurstclient.settings.SwingHandSetting; import net.wurstclient.util.BlockPlacer; import net.wurstclient.util.BlockPlacer.BlockPlacingParams; import net.wurstclient.util.BlockUtils; +import net.wurstclient.util.InteractionSimulator; import net.wurstclient.util.RegionPos; import net.wurstclient.util.RenderUtils; import net.wurstclient.util.RotationUtils; @@ -145,7 +144,7 @@ public final class BuildRandomHack extends Hack if(WURST.getHax().freecamHack.isEnabled()) return; - if(!fastPlace.isChecked() && IMC.getItemUseCooldown() > 0) + if(!fastPlace.isChecked() && MC.itemUseCooldown > 0) return; if(checkItem.isChecked() && !MC.player.isHolding( @@ -188,38 +187,12 @@ public final class BuildRandomHack extends Hack if(checkLOS.isChecked() && !params.lineOfSight()) return false; - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; facing.getSelected().face(params.hitVec()); lastPos = pos; - // right-click the block in the same way vanilla Minecraft would - for(Hand hand : Hand.values()) - { - // place block and return true if successful - ActionResult blockResult = MC.interactionManager - .interactBlock(MC.player, hand, params.toHitResult()); - if(blockResult.isAccepted()) - { - if(blockResult.shouldSwingHand()) - swingHand.getSelected().swing(hand); - - return true; - } - - // return on ActionResult.FAIL without trying the other hand - if(blockResult == ActionResult.FAIL) - return true; - - // if ActionResult.PASS and hand is not empty, call interactItem() - if(!MC.player.getStackInHand(hand).isEmpty()) - { - ActionResult itemResult = - MC.interactionManager.interactItem(MC.player, hand); - if(itemResult.isAccepted() && itemResult.shouldSwingHand()) - swingHand.getSelected().swing(hand); - } - } - + InteractionSimulator.rightClickBlock(params.toHitResult(), + swingHand.getSelected()); return true; } diff --git a/src/main/java/net/wurstclient/hacks/ChatTranslatorHack.java b/src/main/java/net/wurstclient/hacks/ChatTranslatorHack.java index 7dc8e112..bea50443 100644 --- a/src/main/java/net/wurstclient/hacks/ChatTranslatorHack.java +++ b/src/main/java/net/wurstclient/hacks/ChatTranslatorHack.java @@ -23,9 +23,6 @@ import net.wurstclient.util.GoogleTranslate; "google translator", "GoogleTranslation", "google translation"}) public final class ChatTranslatorHack extends Hack implements ChatInputListener { - private static final GoogleTranslate googleTranslate = - new GoogleTranslate(); - private final EnumSetting langFrom = new EnumSetting<>( "Translate from", FromLanguage.values(), FromLanguage.AUTO_DETECT); @@ -79,7 +76,7 @@ public final class ChatTranslatorHack extends Hack implements ChatInputListener || incomingMsg.startsWith(translatorPrefix)) return; - String translated = googleTranslate.translate(incomingMsg, + String translated = GoogleTranslate.translate(incomingMsg, langFrom.getSelected().value, langTo.getSelected().value); if(translated == null) diff --git a/src/main/java/net/wurstclient/hacks/ChestEspHack.java b/src/main/java/net/wurstclient/hacks/ChestEspHack.java index cc2ec14d..18b23871 100644 --- a/src/main/java/net/wurstclient/hacks/ChestEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ChestEspHack.java @@ -192,7 +192,7 @@ public class ChestEspHack extends Hack implements UpdateListener, public void onCameraTransformViewBobbing( CameraTransformViewBobbingEvent event) { - if(style.getSelected().hasLines()) + if(style.hasLines()) event.cancel(); } @@ -211,16 +211,17 @@ public class ChestEspHack extends Hack implements UpdateListener, entityGroups.stream().filter(ChestEspGroup::isEnabled) .forEach(g -> g.updateBoxes(partialTicks)); - ChestEspRenderer espRenderer = new ChestEspRenderer(matrixStack); + ChestEspRenderer espRenderer = + new ChestEspRenderer(matrixStack, partialTicks); - if(style.getSelected().hasBoxes()) + if(style.hasBoxes()) { RenderSystem.setShader(GameRenderer::getPositionProgram); groups.stream().filter(ChestEspGroup::isEnabled) .forEach(espRenderer::renderBoxes); } - if(style.getSelected().hasLines()) + if(style.hasLines()) { RenderSystem.setShader(GameRenderer::getPositionProgram); groups.stream().filter(ChestEspGroup::isEnabled) diff --git a/src/main/java/net/wurstclient/hacks/CreativeFlightHack.java b/src/main/java/net/wurstclient/hacks/CreativeFlightHack.java index 3e445f63..003e2f1b 100644 --- a/src/main/java/net/wurstclient/hacks/CreativeFlightHack.java +++ b/src/main/java/net/wurstclient/hacks/CreativeFlightHack.java @@ -31,8 +31,8 @@ public final class CreativeFlightHack extends Hack implements UpdateListener new SliderSetting("Anti-Kick Interval", "How often Anti-Kick should prevent you from getting kicked.\n" + "Most servers will kick you after 80 ticks.", - 30, 5, 80, 1, - SliderSetting.ValueDisplay.INTEGER.withSuffix(" ticks")); + 30, 5, 80, 1, SliderSetting.ValueDisplay.INTEGER + .withSuffix(" ticks").withLabel(1, "1 tick")); private final SliderSetting antiKickDistance = new SliderSetting( "Anti-Kick Distance", diff --git a/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java b/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java index 5c96eefa..28cb9353 100644 --- a/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java @@ -21,12 +21,10 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.decoration.EndCrystalEntity; import net.minecraft.item.Items; import net.minecraft.util.Hand; -import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.RaycastContext; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.UpdateListener; @@ -200,11 +198,8 @@ public final class CrystalAuraHack extends Hack implements UpdateListener if(distanceSqPosVec > eyesPos.squaredDistanceTo(posVec.add(dirVec))) continue; - if(checkLOS.isChecked() && MC.world - .raycast(new RaycastContext(eyesPos, hitVec, - RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, MC.player)) - .getType() != HitResult.Type.MISS) + if(checkLOS.isChecked() + && !BlockUtils.hasLineOfSight(eyesPos, hitVec)) continue; InventoryUtils.selectItem(Items.END_CRYSTAL, @@ -234,7 +229,7 @@ public final class CrystalAuraHack extends Hack implements UpdateListener .reversed(); return StreamSupport.stream(MC.world.getEntities().spliterator(), true) - .filter(e -> e instanceof EndCrystalEntity) + .filter(EndCrystalEntity.class::isInstance) .filter(e -> !e.isRemoved()) .filter(e -> player.squaredDistanceTo(e) <= rangeSq) .sorted(furthestFromPlayer) diff --git a/src/main/java/net/wurstclient/hacks/DolphinHack.java b/src/main/java/net/wurstclient/hacks/DolphinHack.java index 66c0f617..d1dcf45d 100644 --- a/src/main/java/net/wurstclient/hacks/DolphinHack.java +++ b/src/main/java/net/wurstclient/hacks/DolphinHack.java @@ -40,7 +40,7 @@ public final class DolphinHack extends Hack implements UpdateListener public void onUpdate() { ClientPlayerEntity player = MC.player; - if(!player.isWet() || player.isSneaking()) + if(!player.isTouchingWater() || player.isSneaking()) return; Vec3d velocity = player.getVelocity(); diff --git a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java index 734b7827..73e8f332 100644 --- a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java +++ b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java @@ -295,8 +295,7 @@ public final class ExcavatorHack extends Hack // get progress float progress; if(BlockUtils.getHardness(currentBlock) < 1) - progress = - IMC.getInteractionManager().getCurrentBreakingProgress(); + progress = MC.interactionManager.currentBreakingProgress; else progress = 1; diff --git a/src/main/java/net/wurstclient/hacks/FastBreakHack.java b/src/main/java/net/wurstclient/hacks/FastBreakHack.java index 862a0fbf..1f5f2e3f 100644 --- a/src/main/java/net/wurstclient/hacks/FastBreakHack.java +++ b/src/main/java/net/wurstclient/hacks/FastBreakHack.java @@ -18,7 +18,6 @@ import net.wurstclient.SearchTags; import net.wurstclient.events.BlockBreakingProgressListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; -import net.wurstclient.mixinterface.IClientPlayerInteractionManager; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; @@ -82,7 +81,7 @@ public final class FastBreakHack extends Hack @Override public void onUpdate() { - IMC.getInteractionManager().setBlockHitDelay(0); + MC.interactionManager.blockBreakingCooldown = 0; } @Override @@ -91,9 +90,7 @@ public final class FastBreakHack extends Hack if(legitMode.isChecked()) return; - IClientPlayerInteractionManager im = IMC.getInteractionManager(); - - if(im.getCurrentBreakingProgress() >= 1) + if(MC.interactionManager.currentBreakingProgress >= 1) return; BlockPos blockPos = event.getBlockPos(); @@ -108,6 +105,7 @@ public final class FastBreakHack extends Hack Action action = PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK; Direction direction = event.getDirection(); - im.sendPlayerActionC2SPacket(action, blockPos, direction); + IMC.getInteractionManager().sendPlayerActionC2SPacket(action, blockPos, + direction); } } diff --git a/src/main/java/net/wurstclient/hacks/FastPlaceHack.java b/src/main/java/net/wurstclient/hacks/FastPlaceHack.java index 2738b317..9620c03c 100644 --- a/src/main/java/net/wurstclient/hacks/FastPlaceHack.java +++ b/src/main/java/net/wurstclient/hacks/FastPlaceHack.java @@ -36,6 +36,6 @@ public final class FastPlaceHack extends Hack implements UpdateListener @Override public void onUpdate() { - IMC.setItemUseCooldown(0); + MC.itemUseCooldown = 0; } } diff --git a/src/main/java/net/wurstclient/hacks/FishHack.java b/src/main/java/net/wurstclient/hacks/FishHack.java index ffc3ab42..07e8b0d6 100644 --- a/src/main/java/net/wurstclient/hacks/FishHack.java +++ b/src/main/java/net/wurstclient/hacks/FishHack.java @@ -40,7 +40,7 @@ public final class FishHack extends Hack implements UpdateListener public void onUpdate() { ClientPlayerEntity player = MC.player; - if(!player.isWet() || player.isSneaking()) + if(!player.isTouchingWater() || player.isSneaking()) return; Vec3d velocity = player.getVelocity(); diff --git a/src/main/java/net/wurstclient/hacks/FlightHack.java b/src/main/java/net/wurstclient/hacks/FlightHack.java index c4dfc311..6c346daf 100644 --- a/src/main/java/net/wurstclient/hacks/FlightHack.java +++ b/src/main/java/net/wurstclient/hacks/FlightHack.java @@ -44,7 +44,8 @@ public final class FlightHack extends Hack new SliderSetting("Anti-Kick Interval", "How often Anti-Kick should prevent you from getting kicked.\n" + "Most servers will kick you after 80 ticks.", - 30, 5, 80, 1, ValueDisplay.INTEGER.withSuffix(" ticks")); + 30, 5, 80, 1, + ValueDisplay.INTEGER.withSuffix(" ticks").withLabel(1, "1 tick")); private final SliderSetting antiKickDistance = new SliderSetting( "Anti-Kick Distance", diff --git a/src/main/java/net/wurstclient/hacks/FollowHack.java b/src/main/java/net/wurstclient/hacks/FollowHack.java index 3f58b33a..6a7ad57b 100644 --- a/src/main/java/net/wurstclient/hacks/FollowHack.java +++ b/src/main/java/net/wurstclient/hacks/FollowHack.java @@ -150,7 +150,7 @@ public final class FollowHack extends Hack { entity = StreamSupport .stream(MC.world.getEntities().spliterator(), true) - .filter(e -> e instanceof LivingEntity) + .filter(LivingEntity.class::isInstance) .filter( e -> !e.isRemoved() && ((LivingEntity)e).getHealth() > 0) .filter(e -> e != MC.player) diff --git a/src/main/java/net/wurstclient/hacks/FreecamHack.java b/src/main/java/net/wurstclient/hacks/FreecamHack.java index b16cc968..dc3cd87e 100644 --- a/src/main/java/net/wurstclient/hacks/FreecamHack.java +++ b/src/main/java/net/wurstclient/hacks/FreecamHack.java @@ -206,7 +206,7 @@ public final class FreecamHack extends Hack implements UpdateListener, // line Vec3d regionVec = region.toVec3d(); - Vec3d start = RotationUtils.getClientLookVec() + Vec3d start = RotationUtils.getClientLookVec(partialTicks) .add(RenderUtils.getCameraPos()).subtract(regionVec); Vec3d end = fakePlayer.getBoundingBox().getCenter().subtract(regionVec); diff --git a/src/main/java/net/wurstclient/hacks/GlideHack.java b/src/main/java/net/wurstclient/hacks/GlideHack.java index 702bc641..8d797e90 100644 --- a/src/main/java/net/wurstclient/hacks/GlideHack.java +++ b/src/main/java/net/wurstclient/hacks/GlideHack.java @@ -85,7 +85,7 @@ public final class GlideHack extends Hack // manual collision check, since liquids don't have bounding boxes if(stream.map(BlockUtils::getBlock) - .anyMatch(b -> b instanceof FluidBlock)) + .anyMatch(FluidBlock.class::isInstance)) return; } diff --git a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java index 14165f46..eced4596 100644 --- a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java +++ b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java @@ -100,7 +100,7 @@ public final class InstantBunkerHack extends Hack // initialize building process blockIndex = 0; building = true; - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; } startTimer = 2; @@ -240,7 +240,7 @@ public final class InstantBunkerHack extends Hack .sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); // reset timer - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; } @Override diff --git a/src/main/java/net/wurstclient/hacks/InvWalkHack.java b/src/main/java/net/wurstclient/hacks/InvWalkHack.java index ebbafe43..5598b51f 100644 --- a/src/main/java/net/wurstclient/hacks/InvWalkHack.java +++ b/src/main/java/net/wurstclient/hacks/InvWalkHack.java @@ -124,6 +124,6 @@ public final class InvWalkHack extends Hack implements UpdateListener private boolean hasTextBox(Screen screen) { return screen.children().stream() - .anyMatch(e -> e instanceof TextFieldWidget); + .anyMatch(TextFieldWidget.class::isInstance); } } diff --git a/src/main/java/net/wurstclient/hacks/ItemEspHack.java b/src/main/java/net/wurstclient/hacks/ItemEspHack.java index b02bb3de..92a4abff 100644 --- a/src/main/java/net/wurstclient/hacks/ItemEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ItemEspHack.java @@ -32,7 +32,7 @@ import net.wurstclient.events.RenderListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; import net.wurstclient.settings.ColorSetting; -import net.wurstclient.settings.EnumSetting; +import net.wurstclient.settings.EspBoxSizeSetting; import net.wurstclient.settings.EspStyleSetting; import net.wurstclient.util.EntityUtils; import net.wurstclient.util.RegionPos; @@ -45,10 +45,9 @@ public final class ItemEspHack extends Hack implements UpdateListener, { private final EspStyleSetting style = new EspStyleSetting(); - private final EnumSetting boxSize = new EnumSetting<>("Box size", + private final EspBoxSizeSetting boxSize = new EspBoxSizeSetting( "\u00a7lAccurate\u00a7r mode shows the exact hitbox of each item.\n" - + "\u00a7lFancy\u00a7r mode shows larger boxes that look better.", - BoxSize.values(), BoxSize.FANCY); + + "\u00a7lFancy\u00a7r mode shows larger boxes that look better."); private final ColorSetting color = new ColorSetting("Color", "Items will be highlighted in this color.", Color.YELLOW); @@ -94,7 +93,7 @@ public final class ItemEspHack extends Hack implements UpdateListener, public void onCameraTransformViewBobbing( CameraTransformViewBobbingEvent event) { - if(style.getSelected().hasLines()) + if(style.hasLines()) event.cancel(); } @@ -111,7 +110,7 @@ public final class ItemEspHack extends Hack implements UpdateListener, renderBoxes(matrixStack, partialTicks, region); - if(style.getSelected().hasLines()) + if(style.hasLines()) renderTracers(matrixStack, partialTicks, region); matrixStack.pop(); @@ -125,7 +124,7 @@ public final class ItemEspHack extends Hack implements UpdateListener, private void renderBoxes(MatrixStack matrixStack, float partialTicks, RegionPos region) { - float extraSize = boxSize.getSelected().extraSize; + float extraSize = boxSize.getExtraSize(); for(ItemEntity e : items) { @@ -135,7 +134,7 @@ public final class ItemEspHack extends Hack implements UpdateListener, .subtract(region.toVec3d()); matrixStack.translate(lerpedPos.x, lerpedPos.y, lerpedPos.z); - if(style.getSelected().hasBoxes()) + if(style.hasBoxes()) { matrixStack.push(); matrixStack.scale(e.getWidth() + extraSize, @@ -170,7 +169,7 @@ public final class ItemEspHack extends Hack implements UpdateListener, RenderSystem.setShader(GameRenderer::getPositionProgram); Vec3d regionVec = region.toVec3d(); - Vec3d start = RotationUtils.getClientLookVec() + Vec3d start = RotationUtils.getClientLookVec(partialTicks) .add(RenderUtils.getCameraPos()).subtract(regionVec); bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, @@ -189,25 +188,4 @@ public final class ItemEspHack extends Hack implements UpdateListener, } tessellator.draw(); } - - private enum BoxSize - { - ACCURATE("Accurate", 0), - FANCY("Fancy", 0.1F); - - private final String name; - private final float extraSize; - - private BoxSize(String name, float extraSize) - { - this.name = name; - this.extraSize = extraSize; - } - - @Override - public String toString() - { - return name; - } - } } diff --git a/src/main/java/net/wurstclient/hacks/JesusHack.java b/src/main/java/net/wurstclient/hacks/JesusHack.java index 69da3872..371bae43 100644 --- a/src/main/java/net/wurstclient/hacks/JesusHack.java +++ b/src/main/java/net/wurstclient/hacks/JesusHack.java @@ -19,7 +19,6 @@ import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.shape.VoxelShape; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.PacketOutputListener; @@ -157,25 +156,19 @@ public final class JesusHack extends Hack { boolean foundLiquid = false; boolean foundSolid = false; + Box box = MC.player.getBoundingBox().offset(0, -0.5, 0); // check collision boxes below player - ArrayList blockCollisions = IMC.getWorld() - .getBlockCollisionsStream(MC.player, - MC.player.getBoundingBox().offset(0, -0.5, 0)) - .map(VoxelShape::getBoundingBox) + ArrayList blockCollisions = BlockUtils.getBlockCollisions(box) + .map(bb -> BlockUtils.getBlock(BlockPos.ofFloored(bb.getCenter()))) .collect(Collectors.toCollection(ArrayList::new)); - for(Box bb : blockCollisions) - { - BlockPos pos = BlockPos.ofFloored(bb.getCenter()); - Block block = BlockUtils.getBlock(pos); - + for(Block block : blockCollisions) if(block instanceof FluidBlock) foundLiquid = true; else if(!(block instanceof AirBlock)) foundSolid = true; - } - + return foundLiquid && !foundSolid; } diff --git a/src/main/java/net/wurstclient/hacks/KillPotionHack.java b/src/main/java/net/wurstclient/hacks/KillPotionHack.java index 0d320edf..8c1328a9 100644 --- a/src/main/java/net/wurstclient/hacks/KillPotionHack.java +++ b/src/main/java/net/wurstclient/hacks/KillPotionHack.java @@ -107,15 +107,15 @@ public final class KillPotionHack extends Hack ItemStack stack = new ItemStack(item); NbtCompound effect = new NbtCompound(); - effect.putInt("Amplifier", 125); - effect.putInt("Duration", 2000); - effect.putInt("Id", 6); + effect.putInt("amplifier", 125); + effect.putInt("duration", 2000); + effect.putString("id", "instant_health"); NbtList effects = new NbtList(); effects.add(effect); NbtCompound nbt = new NbtCompound(); - nbt.put("CustomPotionEffects", effects); + nbt.put("custom_potion_effects", effects); stack.setNbt(nbt); String name = diff --git a/src/main/java/net/wurstclient/hacks/KillauraHack.java b/src/main/java/net/wurstclient/hacks/KillauraHack.java index 3bb4ebab..b330c1c1 100644 --- a/src/main/java/net/wurstclient/hacks/KillauraHack.java +++ b/src/main/java/net/wurstclient/hacks/KillauraHack.java @@ -21,11 +21,9 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Hand; -import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.RaycastContext; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.PostMotionListener; @@ -39,6 +37,7 @@ import net.wurstclient.settings.PauseAttackOnContainersSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.settings.filterlists.EntityFilterList; +import net.wurstclient.util.BlockUtils; import net.wurstclient.util.EntityUtils; import net.wurstclient.util.RegionPos; import net.wurstclient.util.RenderUtils; @@ -161,13 +160,8 @@ public final class KillauraHack extends Hack WURST.getHax().autoSwordHack.setSlot(); - Vec3d eyesPos = RotationUtils.getEyesPos(); Vec3d hitVec = target.getBoundingBox().getCenter(); - if(checkLOS.isChecked() && MC.world - .raycast(new RaycastContext(eyesPos, hitVec, - RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, MC.player)) - .getType() != HitResult.Type.MISS) + if(checkLOS.isChecked() && !BlockUtils.hasLineOfSight(hitVec)) { target = null; return; diff --git a/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java b/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java index ca9ef208..7572fefb 100644 --- a/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java +++ b/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java @@ -37,6 +37,7 @@ import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.settings.filterlists.EntityFilterList; import net.wurstclient.settings.filters.*; +import net.wurstclient.util.BlockUtils; import net.wurstclient.util.EntityUtils; import net.wurstclient.util.RegionPos; import net.wurstclient.util.RenderUtils; @@ -78,14 +79,25 @@ public final class KillauraLegitHack extends Hack new EntityFilterList(FilterPlayersSetting.genericCombat(false), FilterSleepingSetting.genericCombat(true), FilterFlyingSetting.genericCombat(0.5), - FilterMonstersSetting.genericCombat(false), - FilterPigmenSetting.genericCombat(false), - FilterEndermenSetting.genericCombat(false), - FilterAnimalsSetting.genericCombat(false), + FilterHostileSetting.genericCombat(false), + FilterNeutralSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterPassiveSetting.genericCombat(false), + FilterPassiveWaterSetting.genericCombat(false), FilterBabiesSetting.genericCombat(false), + FilterBatsSetting.genericCombat(false), + FilterSlimesSetting.genericCombat(false), FilterPetsSetting.genericCombat(false), - FilterTradersSetting.genericCombat(false), + FilterVillagersSetting.genericCombat(false), + FilterZombieVillagersSetting.genericCombat(false), FilterGolemsSetting.genericCombat(false), + FilterPiglinsSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterZombiePiglinsSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterEndermenSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterShulkersSetting.genericCombat(false), FilterAllaysSetting.genericCombat(false), FilterInvisibleSetting.genericCombat(true), FilterNamedSetting.genericCombat(false), @@ -168,6 +180,13 @@ public final class KillauraLegitHack extends Hack WURST.getHax().autoSwordHack.setSlot(); + // check line of sight + if(!BlockUtils.hasLineOfSight(target.getBoundingBox().getCenter())) + { + target = null; + return; + } + // face entity if(!faceEntityClient(target)) return; diff --git a/src/main/java/net/wurstclient/hacks/LiquidsHack.java b/src/main/java/net/wurstclient/hacks/LiquidsHack.java index 1accaf6b..97752717 100644 --- a/src/main/java/net/wurstclient/hacks/LiquidsHack.java +++ b/src/main/java/net/wurstclient/hacks/LiquidsHack.java @@ -32,9 +32,10 @@ public final class LiquidsHack extends Hack implements HitResultRayTraceListener } @Override - public void onHitResultRayTrace(float float_1) + public void onHitResultRayTrace(float partialTicks) { - MC.crosshairTarget = MC.getCameraEntity() - .raycast(MC.interactionManager.getReachDistance(), float_1, true); + float reach = MC.interactionManager.getReachDistance(); + MC.crosshairTarget = + MC.getCameraEntity().raycast(reach, partialTicks, true); } } diff --git a/src/main/java/net/wurstclient/hacks/LsdHack.java b/src/main/java/net/wurstclient/hacks/LsdHack.java index d5e6d96f..f3c0d9ae 100644 --- a/src/main/java/net/wurstclient/hacks/LsdHack.java +++ b/src/main/java/net/wurstclient/hacks/LsdHack.java @@ -12,7 +12,6 @@ import net.minecraft.util.Identifier; import net.wurstclient.Category; import net.wurstclient.hack.DontSaveState; import net.wurstclient.hack.Hack; -import net.wurstclient.mixinterface.IGameRenderer; @DontSaveState public final class LsdHack extends Hack @@ -35,8 +34,8 @@ public final class LsdHack extends Hack if(MC.gameRenderer.getPostProcessor() != null) MC.gameRenderer.disablePostProcessor(); - ((IGameRenderer)MC.gameRenderer) - .loadWurstShader(new Identifier("shaders/post/wobble.json")); + MC.gameRenderer + .loadPostProcessor(new Identifier("shaders/post/wobble.json")); } @Override diff --git a/src/main/java/net/wurstclient/hacks/MassTpaHack.java b/src/main/java/net/wurstclient/hacks/MassTpaHack.java index 5d2f6a61..8d8a0b02 100644 --- a/src/main/java/net/wurstclient/hacks/MassTpaHack.java +++ b/src/main/java/net/wurstclient/hacks/MassTpaHack.java @@ -10,6 +10,7 @@ package net.wurstclient.hacks; import java.util.ArrayList; import java.util.Collections; import java.util.Random; +import java.util.regex.Pattern; import net.minecraft.client.network.PlayerListEntry; import net.minecraft.util.StringHelper; @@ -19,6 +20,10 @@ import net.wurstclient.events.ChatInputListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.DontSaveState; import net.wurstclient.hack.Hack; +import net.wurstclient.settings.CheckboxSetting; +import net.wurstclient.settings.SliderSetting; +import net.wurstclient.settings.SliderSetting.ValueDisplay; +import net.wurstclient.settings.TextFieldSetting; import net.wurstclient.util.ChatUtils; @SearchTags({"mass tpa"}) @@ -26,9 +31,36 @@ import net.wurstclient.util.ChatUtils; public final class MassTpaHack extends Hack implements UpdateListener, ChatInputListener { + private static final Pattern ALLOWED_COMMANDS = + Pattern.compile("^/+[a-zA-Z0-9_\\-]+$"); + + private final TextFieldSetting commandSetting = + new TextFieldSetting("Command", + "The command to use for teleporting.\n" + + "Examples: /tp, /tpa, /tpahere, /tpo", + "/tpa", + s -> s.length() < 64 && ALLOWED_COMMANDS.matcher(s).matches()); + + private final SliderSetting delay = new SliderSetting("Delay", + "The delay between each teleportation request.", 20, 1, 200, 1, + ValueDisplay.INTEGER.withSuffix(" ticks").withLabel(1, "1 tick")); + + private final CheckboxSetting ignoreErrors = + new CheckboxSetting("Ignore errors", + "Whether to ignore messages from the server telling you that the" + + " teleportation command isn't valid or that you don't have" + + " permission to use it.", + false); + + private final CheckboxSetting stopWhenAccepted = new CheckboxSetting( + "Stop when accepted", "Whether to stop sending more teleportation" + + " requests when someone accepts one of them.", + true); + private final Random random = new Random(); private final ArrayList players = new ArrayList<>(); + private String command; private int index; private int timer; @@ -36,17 +68,25 @@ public final class MassTpaHack extends Hack { super("MassTPA"); setCategory(Category.CHAT); + addSetting(commandSetting); + addSetting(delay); + addSetting(ignoreErrors); + addSetting(stopWhenAccepted); } @Override public void onEnable() { - index = 0; - timer = -1; - + // reset state players.clear(); - String playerName = MC.getSession().getProfile().getName(); + index = 0; + timer = 0; + // cache command in case the setting is changed mid-run + command = commandSetting.getValue().substring(1); + + // collect player names + String playerName = MC.getSession().getUsername(); for(PlayerListEntry info : MC.player.networkHandler.getPlayerList()) { String name = info.getProfile().getName(); @@ -80,7 +120,7 @@ public final class MassTpaHack extends Hack @Override public void onUpdate() { - if(timer > -1) + if(timer > 0) { timer--; return; @@ -92,9 +132,11 @@ public final class MassTpaHack extends Hack return; } - MC.getNetworkHandler().sendChatCommand("tpa " + players.get(index)); + MC.getNetworkHandler() + .sendChatCommand(command + " " + players.get(index)); + index++; - timer = 20; + timer = delay.getValueI() - 1; } @Override @@ -106,15 +148,23 @@ public final class MassTpaHack extends Hack if(message.contains("/help") || message.contains("permission")) { + if(ignoreErrors.isChecked()) + return; + event.cancel(); - ChatUtils.error("This server doesn't have TPA."); + ChatUtils.error("This server doesn't have a " + + command.toUpperCase() + " command."); setEnabled(false); }else if(message.contains("accepted") && message.contains("request") || message.contains("akzeptiert") && message.contains("anfrage")) { + if(!stopWhenAccepted.isChecked()) + return; + event.cancel(); - ChatUtils.message("Someone accepted your TPA request. Stopping."); + ChatUtils.message("Someone accepted your " + command.toUpperCase() + + " request. Stopping."); setEnabled(false); } } diff --git a/src/main/java/net/wurstclient/hacks/MobEspHack.java b/src/main/java/net/wurstclient/hacks/MobEspHack.java index 83bd1aff..3a2ad241 100644 --- a/src/main/java/net/wurstclient/hacks/MobEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobEspHack.java @@ -25,7 +25,8 @@ import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.mob.MobEntity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.Box; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; @@ -35,9 +36,10 @@ import net.wurstclient.events.CameraTransformViewBobbingListener; import net.wurstclient.events.RenderListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; -import net.wurstclient.settings.EnumSetting; +import net.wurstclient.settings.EspBoxSizeSetting; import net.wurstclient.settings.EspStyleSetting; -import net.wurstclient.settings.filters.FilterInvisibleSetting; +import net.wurstclient.settings.filterlists.EntityFilterList; +import net.wurstclient.settings.filters.*; import net.wurstclient.util.EntityUtils; import net.wurstclient.util.RegionPos; import net.wurstclient.util.RenderUtils; @@ -49,15 +51,35 @@ public final class MobEspHack extends Hack implements UpdateListener, { private final EspStyleSetting style = new EspStyleSetting(); - private final EnumSetting boxSize = new EnumSetting<>("Box size", + private final EspBoxSizeSetting boxSize = new EspBoxSizeSetting( "\u00a7lAccurate\u00a7r mode shows the exact hitbox of each mob.\n" - + "\u00a7lFancy\u00a7r mode shows slightly larger boxes that look better.", - BoxSize.values(), BoxSize.FANCY); + + "\u00a7lFancy\u00a7r mode shows slightly larger boxes that look better."); - private final FilterInvisibleSetting filterInvisible = - new FilterInvisibleSetting("Won't show invisible mobs.", false); + private final EntityFilterList entityFilters = + new EntityFilterList(FilterHostileSetting.genericVision(false), + FilterNeutralSetting + .genericVision(AttackDetectingEntityFilter.Mode.OFF), + FilterPassiveSetting.genericVision(false), + FilterPassiveWaterSetting.genericVision(false), + FilterBatsSetting.genericVision(false), + FilterSlimesSetting.genericVision(false), + FilterPetsSetting.genericVision(false), + FilterVillagersSetting.genericVision(false), + FilterZombieVillagersSetting.genericVision(false), + FilterGolemsSetting.genericVision(false), + FilterPiglinsSetting + .genericVision(AttackDetectingEntityFilter.Mode.OFF), + FilterZombiePiglinsSetting + .genericVision(AttackDetectingEntityFilter.Mode.OFF), + FilterEndermenSetting + .genericVision(AttackDetectingEntityFilter.Mode.OFF), + FilterShulkersSetting.genericVision(false), + FilterAllaysSetting.genericVision(false), + FilterInvisibleSetting.genericVision(false), + FilterNamedSetting.genericVision(false), + FilterArmorStandsSetting.genericVision(true)); - private final ArrayList mobs = new ArrayList<>(); + private final ArrayList mobs = new ArrayList<>(); private VertexBuffer mobBox; public MobEspHack() @@ -66,7 +88,7 @@ public final class MobEspHack extends Hack implements UpdateListener, setCategory(Category.RENDER); addSetting(style); addSetting(boxSize); - addSetting(filterInvisible); + entityFilters.forEach(this::addSetting); } @Override @@ -97,13 +119,13 @@ public final class MobEspHack extends Hack implements UpdateListener, { mobs.clear(); - Stream stream = - StreamSupport.stream(MC.world.getEntities().spliterator(), false) - .filter(e -> e instanceof MobEntity).map(e -> (MobEntity)e) - .filter(e -> !e.isRemoved() && e.getHealth() > 0); + Stream stream = StreamSupport + .stream(MC.world.getEntities().spliterator(), false) + .filter(LivingEntity.class::isInstance).map(e -> (LivingEntity)e) + .filter(e -> !(e instanceof PlayerEntity)) + .filter(e -> !e.isRemoved() && e.getHealth() > 0); - if(filterInvisible.isChecked()) - stream = stream.filter(filterInvisible); + stream = entityFilters.applyTo(stream); mobs.addAll(stream.collect(Collectors.toList())); } @@ -112,7 +134,7 @@ public final class MobEspHack extends Hack implements UpdateListener, public void onCameraTransformViewBobbing( CameraTransformViewBobbingEvent event) { - if(style.getSelected().hasLines()) + if(style.hasLines()) event.cancel(); } @@ -129,10 +151,10 @@ public final class MobEspHack extends Hack implements UpdateListener, RegionPos region = RenderUtils.getCameraRegion(); RenderUtils.applyRegionalRenderOffset(matrixStack, region); - if(style.getSelected().hasBoxes()) + if(style.hasBoxes()) renderBoxes(matrixStack, partialTicks, region); - if(style.getSelected().hasLines()) + if(style.hasLines()) renderTracers(matrixStack, partialTicks, region); matrixStack.pop(); @@ -146,10 +168,10 @@ public final class MobEspHack extends Hack implements UpdateListener, private void renderBoxes(MatrixStack matrixStack, float partialTicks, RegionPos region) { - float extraSize = boxSize.getSelected().extraSize; + float extraSize = boxSize.getExtraSize(); RenderSystem.setShader(GameRenderer::getPositionProgram); - for(MobEntity e : mobs) + for(LivingEntity e : mobs) { matrixStack.push(); @@ -163,11 +185,11 @@ public final class MobEspHack extends Hack implements UpdateListener, float f = MC.player.distanceTo(e) / 20F; RenderSystem.setShaderColor(2 - f, f, 0, 0.5F); + Matrix4f viewMatrix = matrixStack.peek().getPositionMatrix(); + Matrix4f projMatrix = RenderSystem.getProjectionMatrix(); ShaderProgram shader = RenderSystem.getShader(); - Matrix4f matrix4f = RenderSystem.getProjectionMatrix(); mobBox.bind(); - mobBox.draw(matrixStack.peek().getPositionMatrix(), matrix4f, - shader); + mobBox.draw(viewMatrix, projMatrix, shader); VertexBuffer.unbind(); matrixStack.pop(); @@ -188,10 +210,10 @@ public final class MobEspHack extends Hack implements UpdateListener, VertexFormats.POSITION_COLOR); Vec3d regionVec = region.toVec3d(); - Vec3d start = RotationUtils.getClientLookVec() + Vec3d start = RotationUtils.getClientLookVec(partialTicks) .add(RenderUtils.getCameraPos()).subtract(regionVec); - for(MobEntity e : mobs) + for(LivingEntity e : mobs) { Vec3d end = EntityUtils.getLerpedBox(e, partialTicks).getCenter() .subtract(regionVec); @@ -210,27 +232,5 @@ public final class MobEspHack extends Hack implements UpdateListener, } tessellator.draw(); - - } - - private enum BoxSize - { - ACCURATE("Accurate", 0), - FANCY("Fancy", 0.1F); - - private final String name; - private final float extraSize; - - private BoxSize(String name, float extraSize) - { - this.name = name; - this.extraSize = extraSize; - } - - @Override - public String toString() - { - return name; - } } } diff --git a/src/main/java/net/wurstclient/hacks/NoClipHack.java b/src/main/java/net/wurstclient/hacks/NoClipHack.java index af294908..dd73450d 100644 --- a/src/main/java/net/wurstclient/hacks/NoClipHack.java +++ b/src/main/java/net/wurstclient/hacks/NoClipHack.java @@ -16,7 +16,6 @@ import net.wurstclient.events.PlayerMoveListener; import net.wurstclient.events.SetOpaqueCubeListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; -import net.wurstclient.mixinterface.IClientPlayerEntity; @SearchTags({"no clip"}) public final class NoClipHack extends Hack @@ -77,9 +76,9 @@ public final class NoClipHack extends Hack } @Override - public void onPlayerMove(IClientPlayerEntity player) + public void onPlayerMove() { - player.setNoClip(true); + MC.player.noClip = true; } @Override diff --git a/src/main/java/net/wurstclient/hacks/NoWebHack.java b/src/main/java/net/wurstclient/hacks/NoWebHack.java index 15431743..4f633066 100644 --- a/src/main/java/net/wurstclient/hacks/NoWebHack.java +++ b/src/main/java/net/wurstclient/hacks/NoWebHack.java @@ -35,6 +35,6 @@ public final class NoWebHack extends Hack implements UpdateListener @Override public void onUpdate() { - IMC.getPlayer().setMovementMultiplier(Vec3d.ZERO); + MC.player.movementMultiplier = Vec3d.ZERO; } } diff --git a/src/main/java/net/wurstclient/hacks/NukerHack.java b/src/main/java/net/wurstclient/hacks/NukerHack.java index ce5a246d..d8f08b77 100644 --- a/src/main/java/net/wurstclient/hacks/NukerHack.java +++ b/src/main/java/net/wurstclient/hacks/NukerHack.java @@ -123,7 +123,7 @@ public final class NukerHack extends Hack if(currentBlock != null) { - IMC.getInteractionManager().setBreakingBlock(true); + MC.interactionManager.breakingBlock = true; MC.interactionManager.cancelBlockBreaking(); currentBlock = null; } diff --git a/src/main/java/net/wurstclient/hacks/OpenWaterEspHack.java b/src/main/java/net/wurstclient/hacks/OpenWaterEspHack.java index f300868d..a469c95e 100644 --- a/src/main/java/net/wurstclient/hacks/OpenWaterEspHack.java +++ b/src/main/java/net/wurstclient/hacks/OpenWaterEspHack.java @@ -19,7 +19,6 @@ import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.RenderListener; import net.wurstclient.hack.Hack; -import net.wurstclient.mixinterface.IFishingBobberEntity; import net.wurstclient.util.RegionPos; import net.wurstclient.util.RenderUtils; @@ -37,13 +36,10 @@ public final class OpenWaterEspHack extends Hack implements RenderListener public String getRenderName() { FishingBobberEntity bobber = MC.player.fishHook; - if(bobber == null) return getName(); - if(isInOpenWater(bobber)) - return getName() + " [open]"; - return getName() + " [shallow]"; + return getName() + (isInOpenWater(bobber) ? " [open]" : " [shallow]"); } @Override @@ -107,7 +103,6 @@ public final class OpenWaterEspHack extends Hack implements RenderListener private boolean isInOpenWater(FishingBobberEntity bobber) { - return ((IFishingBobberEntity)bobber) - .checkOpenWaterAround(bobber.getBlockPos()); + return bobber.isOpenOrWaterAround(bobber.getBlockPos()); } } diff --git a/src/main/java/net/wurstclient/hacks/PlayerEspHack.java b/src/main/java/net/wurstclient/hacks/PlayerEspHack.java index 9d5d4f24..a44a5d2e 100644 --- a/src/main/java/net/wurstclient/hacks/PlayerEspHack.java +++ b/src/main/java/net/wurstclient/hacks/PlayerEspHack.java @@ -34,7 +34,7 @@ import net.wurstclient.events.CameraTransformViewBobbingListener; import net.wurstclient.events.RenderListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; -import net.wurstclient.settings.EnumSetting; +import net.wurstclient.settings.EspBoxSizeSetting; import net.wurstclient.settings.EspStyleSetting; import net.wurstclient.settings.EspStyleSetting.EspStyle; import net.wurstclient.settings.filterlists.EntityFilterList; @@ -53,10 +53,9 @@ public final class PlayerEspHack extends Hack implements UpdateListener, private final EspStyleSetting style = new EspStyleSetting(EspStyle.LINES_AND_BOXES); - private final EnumSetting boxSize = new EnumSetting<>("Box size", + private final EspBoxSizeSetting boxSize = new EspBoxSizeSetting( "\u00a7lAccurate\u00a7r mode shows the exact hitbox of each player.\n" - + "\u00a7lFancy\u00a7r mode shows slightly larger boxes that look better.", - BoxSize.values(), BoxSize.FANCY); + + "\u00a7lFancy\u00a7r mode shows slightly larger boxes that look better."); private final EntityFilterList entityFilters = new EntityFilterList( new FilterSleepingSetting("Won't show sleeping players.", false), @@ -112,7 +111,7 @@ public final class PlayerEspHack extends Hack implements UpdateListener, public void onCameraTransformViewBobbing( CameraTransformViewBobbingEvent event) { - if(style.getSelected().hasLines()) + if(style.hasLines()) event.cancel(); } @@ -130,10 +129,10 @@ public final class PlayerEspHack extends Hack implements UpdateListener, RenderUtils.applyRegionalRenderOffset(matrixStack, region); // draw boxes - if(style.getSelected().hasBoxes()) + if(style.hasBoxes()) renderBoxes(matrixStack, partialTicks, region); - if(style.getSelected().hasLines()) + if(style.hasLines()) renderTracers(matrixStack, partialTicks, region); matrixStack.pop(); @@ -147,7 +146,7 @@ public final class PlayerEspHack extends Hack implements UpdateListener, private void renderBoxes(MatrixStack matrixStack, float partialTicks, RegionPos region) { - float extraSize = boxSize.getSelected().extraSize; + float extraSize = boxSize.getExtraSize(); for(PlayerEntity e : players) { @@ -190,7 +189,7 @@ public final class PlayerEspHack extends Hack implements UpdateListener, VertexFormats.POSITION_COLOR); Vec3d regionVec = region.toVec3d(); - Vec3d start = RotationUtils.getClientLookVec() + Vec3d start = RotationUtils.getClientLookVec(partialTicks) .add(RenderUtils.getCameraPos()).subtract(regionVec); for(PlayerEntity e : players) @@ -225,25 +224,4 @@ public final class PlayerEspHack extends Hack implements UpdateListener, tessellator.draw(); } - - private enum BoxSize - { - ACCURATE("Accurate", 0), - FANCY("Fancy", 0.1F); - - private final String name; - private final float extraSize; - - private BoxSize(String name, float extraSize) - { - this.name = name; - this.extraSize = extraSize; - } - - @Override - public String toString() - { - return name; - } - } } diff --git a/src/main/java/net/wurstclient/hacks/ProtectHack.java b/src/main/java/net/wurstclient/hacks/ProtectHack.java index b65df1ee..0d79a46a 100644 --- a/src/main/java/net/wurstclient/hacks/ProtectHack.java +++ b/src/main/java/net/wurstclient/hacks/ProtectHack.java @@ -52,14 +52,25 @@ public final class ProtectHack extends Hack new EntityFilterList(FilterPlayersSetting.genericCombat(false), FilterSleepingSetting.genericCombat(false), FilterFlyingSetting.genericCombat(0), - FilterMonstersSetting.genericCombat(false), - FilterPigmenSetting.genericCombat(false), - FilterEndermenSetting.genericCombat(false), - FilterAnimalsSetting.genericCombat(false), + FilterHostileSetting.genericCombat(false), + FilterNeutralSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterPassiveSetting.genericCombat(false), + FilterPassiveWaterSetting.genericCombat(false), FilterBabiesSetting.genericCombat(false), + FilterBatsSetting.genericCombat(false), + FilterSlimesSetting.genericCombat(false), FilterPetsSetting.genericCombat(false), - FilterTradersSetting.genericCombat(false), + FilterVillagersSetting.genericCombat(false), + FilterZombieVillagersSetting.genericCombat(false), FilterGolemsSetting.genericCombat(false), + FilterPiglinsSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterZombiePiglinsSetting + .genericCombat(FilterZombiePiglinsSetting.Mode.OFF), + FilterEndermenSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterShulkersSetting.genericCombat(false), FilterAllaysSetting.genericCombat(false), FilterInvisibleSetting.genericCombat(false), FilterNamedSetting.genericCombat(false), @@ -119,7 +130,7 @@ public final class ProtectHack extends Hack { Stream stream = StreamSupport .stream(MC.world.getEntities().spliterator(), true) - .filter(e -> e instanceof LivingEntity) + .filter(LivingEntity.class::isInstance) .filter( e -> !e.isRemoved() && ((LivingEntity)e).getHealth() > 0) .filter(e -> e != MC.player) diff --git a/src/main/java/net/wurstclient/hacks/RadarHack.java b/src/main/java/net/wurstclient/hacks/RadarHack.java index cbaa4772..e08270fb 100644 --- a/src/main/java/net/wurstclient/hacks/RadarHack.java +++ b/src/main/java/net/wurstclient/hacks/RadarHack.java @@ -27,11 +27,7 @@ import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.settings.filterlists.EntityFilterList; -import net.wurstclient.settings.filters.FilterAnimalsSetting; -import net.wurstclient.settings.filters.FilterInvisibleSetting; -import net.wurstclient.settings.filters.FilterMonstersSetting; -import net.wurstclient.settings.filters.FilterPlayersSetting; -import net.wurstclient.settings.filters.FilterSleepingSetting; +import net.wurstclient.settings.filters.*; import net.wurstclient.util.FakePlayerEntity; @SearchTags({"MiniMap", "mini map"}) @@ -45,12 +41,15 @@ public final class RadarHack extends Hack implements UpdateListener private final CheckboxSetting rotate = new CheckboxSetting("Rotate with player", true); - private final EntityFilterList entityFilters = new EntityFilterList( - new FilterPlayersSetting("Won't show other players.", false), - new FilterSleepingSetting("Won't show sleeping players.", false), - new FilterMonstersSetting("Won't show zombies, creepers, etc.", false), - new FilterAnimalsSetting("Won't show pigs, cows, etc.", false), - new FilterInvisibleSetting("Won't show invisible entities.", false)); + private final EntityFilterList entityFilters = + new EntityFilterList(FilterPlayersSetting.genericVision(false), + FilterSleepingSetting.genericVision(false), + FilterHostileSetting.genericVision(false), + FilterPassiveSetting.genericVision(false), + FilterPassiveWaterSetting.genericVision(false), + FilterBatsSetting.genericVision(true), + FilterSlimesSetting.genericVision(false), + FilterInvisibleSetting.genericVision(false)); public RadarHack() { @@ -92,7 +91,7 @@ public final class RadarHack extends Hack implements UpdateListener StreamSupport.stream(world.getEntities().spliterator(), true) .filter(e -> !e.isRemoved() && e != player) .filter(e -> !(e instanceof FakePlayerEntity)) - .filter(e -> e instanceof LivingEntity) + .filter(LivingEntity.class::isInstance) .filter(e -> ((LivingEntity)e).getHealth() > 0); stream = entityFilters.applyTo(stream); diff --git a/src/main/java/net/wurstclient/hacks/RemoteViewHack.java b/src/main/java/net/wurstclient/hacks/RemoteViewHack.java index bf0154bb..820638fa 100644 --- a/src/main/java/net/wurstclient/hacks/RemoteViewHack.java +++ b/src/main/java/net/wurstclient/hacks/RemoteViewHack.java @@ -54,7 +54,7 @@ public final class RemoteViewHack extends Hack { Stream stream = StreamSupport .stream(MC.world.getEntities().spliterator(), true) - .filter(e -> e instanceof LivingEntity) + .filter(LivingEntity.class::isInstance) .filter( e -> !e.isRemoved() && ((LivingEntity)e).getHealth() > 0) .filter(e -> e != MC.player) @@ -77,7 +77,7 @@ public final class RemoteViewHack extends Hack } // save old data - wasInvisible = entity.isInvisibleTo(MC.player); + wasInvisible = entity.isInvisible(); // enable NoClip MC.player.noClip = true; @@ -127,7 +127,7 @@ public final class RemoteViewHack extends Hack { entity = StreamSupport .stream(MC.world.getEntities().spliterator(), false) - .filter(e -> e instanceof LivingEntity) + .filter(LivingEntity.class::isInstance) .filter( e -> !e.isRemoved() && ((LivingEntity)e).getHealth() > 0) .filter(e -> e != MC.player) diff --git a/src/main/java/net/wurstclient/hacks/ScaffoldWalkHack.java b/src/main/java/net/wurstclient/hacks/ScaffoldWalkHack.java index 098bbd34..ecb935dc 100644 --- a/src/main/java/net/wurstclient/hacks/ScaffoldWalkHack.java +++ b/src/main/java/net/wurstclient/hacks/ScaffoldWalkHack.java @@ -163,7 +163,7 @@ public final class ScaffoldWalkHack extends Hack implements UpdateListener IMC.getInteractionManager().rightClickBlock(neighbor, side2, hitVec); MC.player.swingHand(Hand.MAIN_HAND); - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; return true; } diff --git a/src/main/java/net/wurstclient/hacks/StepHack.java b/src/main/java/net/wurstclient/hacks/StepHack.java index 0a50087c..689cfcdc 100644 --- a/src/main/java/net/wurstclient/hacks/StepHack.java +++ b/src/main/java/net/wurstclient/hacks/StepHack.java @@ -7,20 +7,17 @@ */ package net.wurstclient.hacks; -import java.util.ArrayList; -import java.util.stream.Collectors; - import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.util.math.Box; -import net.minecraft.util.shape.VoxelShape; import net.wurstclient.Category; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; import net.wurstclient.settings.EnumSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; +import net.wurstclient.util.BlockUtils; public final class StepHack extends Hack implements UpdateListener { @@ -87,18 +84,10 @@ public final class StepHack extends Hack implements UpdateListener if(!MC.world.isSpaceEmpty(player, box.offset(0, 1, 0))) return; - double stepHeight = Double.NEGATIVE_INFINITY; + double stepHeight = BlockUtils.getBlockCollisions(box) + .mapToDouble(bb -> bb.maxY).max().orElse(Double.NEGATIVE_INFINITY); - ArrayList blockCollisions = - IMC.getWorld().getBlockCollisionsStream(player, box) - .map(VoxelShape::getBoundingBox) - .collect(Collectors.toCollection(ArrayList::new)); - - for(Box bb : blockCollisions) - if(bb.maxY > stepHeight) - stepHeight = bb.maxY; - - stepHeight = stepHeight - player.getY(); + stepHeight -= player.getY(); if(stepHeight < 0 || stepHeight > 1) return; @@ -113,7 +102,7 @@ public final class StepHack extends Hack implements UpdateListener player.getX(), player.getY() + 0.753 * stepHeight, player.getZ(), player.isOnGround())); - player.setPosition(player.getX(), player.getY() + 1 * stepHeight, + player.setPosition(player.getX(), player.getY() + stepHeight, player.getZ()); } diff --git a/src/main/java/net/wurstclient/hacks/ThrowHack.java b/src/main/java/net/wurstclient/hacks/ThrowHack.java index 1cc5242f..61e5f9e7 100644 --- a/src/main/java/net/wurstclient/hacks/ThrowHack.java +++ b/src/main/java/net/wurstclient/hacks/ThrowHack.java @@ -49,7 +49,7 @@ public final class ThrowHack extends Hack implements RightClickListener @Override public void onRightClick(RightClickEvent event) { - if(IMC.getItemUseCooldown() > 0) + if(MC.itemUseCooldown > 0) return; if(!MC.options.useKey.isPressed()) diff --git a/src/main/java/net/wurstclient/hacks/TillauraHack.java b/src/main/java/net/wurstclient/hacks/TillauraHack.java index a0802d3b..8650dfcb 100644 --- a/src/main/java/net/wurstclient/hacks/TillauraHack.java +++ b/src/main/java/net/wurstclient/hacks/TillauraHack.java @@ -19,13 +19,9 @@ import net.minecraft.block.Blocks; import net.minecraft.item.HoeItem; import net.minecraft.item.ItemStack; import net.minecraft.util.Hand; -import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.RaycastContext; -import net.minecraft.world.RaycastContext.FluidHandling; -import net.minecraft.world.RaycastContext.ShapeType; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.UpdateListener; @@ -84,7 +80,7 @@ public final class TillauraHack extends Hack implements UpdateListener public void onUpdate() { // wait for right click timer - if(IMC.getItemUseCooldown() > 0) + if(MC.itemUseCooldown > 0) return; // check held item @@ -165,7 +161,8 @@ public final class TillauraHack extends Hack implements UpdateListener if(distanceSqHitVec >= distanceSqPosVec) continue; - if(checkLOS.isChecked() && !hasLineOfSight(eyesPos, hitVec)) + if(checkLOS.isChecked() + && !BlockUtils.hasLineOfSight(eyesPos, hitVec)) continue; // face block @@ -174,7 +171,7 @@ public final class TillauraHack extends Hack implements UpdateListener // right click block IMC.getInteractionManager().rightClickBlock(pos, side, hitVec); MC.player.swingHand(Hand.MAIN_HAND); - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; return true; } @@ -201,7 +198,8 @@ public final class TillauraHack extends Hack implements UpdateListener if(distanceSqHitVec >= distanceSqPosVec) continue; - if(checkLOS.isChecked() && !hasLineOfSight(eyesPos, hitVec)) + if(checkLOS.isChecked() + && !BlockUtils.hasLineOfSight(eyesPos, hitVec)) continue; IMC.getInteractionManager().rightClickBlock(pos, side, hitVec); @@ -210,15 +208,4 @@ public final class TillauraHack extends Hack implements UpdateListener return false; } - - private boolean hasLineOfSight(Vec3d from, Vec3d to) - { - ShapeType type = RaycastContext.ShapeType.COLLIDER; - FluidHandling fluid = RaycastContext.FluidHandling.NONE; - - RaycastContext context = - new RaycastContext(from, to, type, fluid, MC.player); - - return MC.world.raycast(context).getType() == HitResult.Type.MISS; - } } diff --git a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java index b9b821e0..4d910d93 100644 --- a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java +++ b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java @@ -33,12 +33,12 @@ import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.RaycastContext; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.RenderListener; import net.wurstclient.hack.Hack; import net.wurstclient.settings.ColorSetting; +import net.wurstclient.util.BlockUtils; import net.wurstclient.util.EntityUtils; import net.wurstclient.util.RenderUtils; import net.wurstclient.util.RotationUtils; @@ -216,10 +216,7 @@ public final class TrajectoriesHack extends Hack implements RenderListener : RotationUtils.getEyesPos(); // check for block collision - BlockHitResult bResult = - MC.world.raycast(new RaycastContext(lastPos, arrowPos, - RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, MC.player)); + BlockHitResult bResult = BlockUtils.raycast(lastPos, arrowPos); if(bResult.getType() != HitResult.Type.MISS) { // replace last pos with the collision point diff --git a/src/main/java/net/wurstclient/hacks/TreeBotHack.java b/src/main/java/net/wurstclient/hacks/TreeBotHack.java index 7219d755..d36a55b2 100644 --- a/src/main/java/net/wurstclient/hacks/TreeBotHack.java +++ b/src/main/java/net/wurstclient/hacks/TreeBotHack.java @@ -15,23 +15,14 @@ import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.joml.Matrix4f; -import org.lwjgl.opengl.GL11; - import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.gl.ShaderProgram; -import net.minecraft.client.gl.VertexBuffer; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3i; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.WurstClient; @@ -43,14 +34,16 @@ import net.wurstclient.events.RenderListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.DontSaveState; import net.wurstclient.hack.Hack; +import net.wurstclient.hacks.treebot.Tree; +import net.wurstclient.hacks.treebot.TreeBotUtils; +import net.wurstclient.settings.FacingSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; -import net.wurstclient.treebot.Tree; -import net.wurstclient.treebot.TreeBotUtils; +import net.wurstclient.settings.SwingHandSetting; +import net.wurstclient.util.BlockBreaker; +import net.wurstclient.util.BlockBreaker.BlockBreakingParams; import net.wurstclient.util.BlockUtils; -import net.wurstclient.util.RegionPos; -import net.wurstclient.util.RenderUtils; -import net.wurstclient.util.RotationUtils; +import net.wurstclient.util.OverlayRenderer; @SearchTags({"tree bot"}) @DontSaveState @@ -61,20 +54,41 @@ public final class TreeBotHack extends Hack "How far TreeBot will reach to break blocks.", 4.5, 1, 6, 0.05, ValueDisplay.DECIMAL); + private final FacingSetting facing = FacingSetting.withoutPacketSpam( + "How to face the logs and leaves when breaking them.\n\n" + + "\u00a7lOff\u00a7r - Don't face the blocks at all. Will be" + + " detected by anti-cheat plugins.\n\n" + + "\u00a7lServer-side\u00a7r - Face the blocks on the" + + " server-side, while still letting you move the camera freely on" + + " the client-side.\n\n" + + "\u00a7lClient-side\u00a7r - Face the blocks by moving your" + + " camera on the client-side. This is the most legit option, but" + + " can be disorienting to look at."); + + private final SwingHandSetting swingHand = new SwingHandSetting( + "How TreeBot should swing your hand when breaking logs and leaves.\n\n" + + "\u00a7lOff\u00a7r - Don't swing your hand at all. Will be detected" + + " by anti-cheat plugins.\n\n" + + "\u00a7lServer-side\u00a7r - Swing your hand on the server-side," + + " without playing the animation on the client-side.\n\n" + + "\u00a7lClient-side\u00a7r - Swing your hand on the client-side." + + " This is the most legit option."); + private TreeFinder treeFinder; private AngleFinder angleFinder; private TreeBotPathProcessor processor; private Tree tree; private BlockPos currentBlock; - private float progress; - private float prevProgress; + private final OverlayRenderer overlay = new OverlayRenderer(); public TreeBotHack() { super("TreeBot"); setCategory(Category.BLOCKS); addSetting(range); + addSetting(facing); + addSetting(swingHand); } @Override @@ -120,10 +134,12 @@ public final class TreeBotHack extends Hack if(currentBlock != null) { - IMC.getInteractionManager().setBreakingBlock(true); + MC.interactionManager.breakingBlock = true; MC.interactionManager.cancelBlockBreaking(); currentBlock = null; } + + overlay.resetProgress(); } @Override @@ -157,13 +173,8 @@ public final class TreeBotHack extends Hack return; } - ArrayList logsInRange = getLogsInRange(); - - if(!logsInRange.isEmpty()) - { - breakBlocks(logsInRange); + if(breakBlocks(tree.getLogs())) return; - } if(angleFinder == null) angleFinder = new AngleFinder(); @@ -211,69 +222,38 @@ public final class TreeBotHack extends Hack angleFinder = null; } - private ArrayList getLogsInRange() + private boolean breakBlocks(ArrayList blocks) { - Vec3d eyesVec = RotationUtils.getEyesPos().subtract(0.5, 0.5, 0.5); - double rangeSq = Math.pow(range.getValue(), 2); - - return tree.getLogs().stream() - .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) - .filter(TreeBotUtils::hasLineOfSight) - .collect(Collectors.toCollection(ArrayList::new)); - } - - private void breakBlocks(ArrayList blocksInRange) - { - for(BlockPos pos : blocksInRange) + for(BlockPos pos : blocks) if(breakBlock(pos)) { - WURST.getHax().autoToolHack.equipBestTool(pos, false, true, 0); currentBlock = pos; - break; + return true; } - if(currentBlock == null) - MC.interactionManager.cancelBlockBreaking(); - - if(currentBlock != null && BlockUtils.getHardness(currentBlock) < 1) - { - prevProgress = progress; - progress = IMC.getInteractionManager().getCurrentBreakingProgress(); - - if(progress < prevProgress) - prevProgress = progress; - - }else - { - progress = 1; - prevProgress = 1; - } + return false; } private boolean breakBlock(BlockPos pos) { - Direction side = - TreeBotUtils.getLineOfSightSide(RotationUtils.getEyesPos(), pos); - - Vec3d relCenter = BlockUtils.getBoundingBox(pos) - .offset(-pos.getX(), -pos.getY(), -pos.getZ()).getCenter(); - Vec3d center = Vec3d.of(pos).add(relCenter); - - Vec3i dirVec = side.getVector(); - Vec3d relHitVec = new Vec3d(relCenter.x * dirVec.getX(), - relCenter.y * dirVec.getY(), relCenter.z * dirVec.getZ()); - Vec3d hitVec = center.add(relHitVec); - - // face block - WURST.getRotationFaker().faceVectorPacket(hitVec); - - // damage block - if(!MC.interactionManager.updateBlockBreakingProgress(pos, side)) + BlockBreakingParams params = BlockBreaker.getBlockBreakingParams(pos); + if(params == null || !params.lineOfSight() + || params.distanceSq() > range.getValueSq()) return false; - // swing arm - MC.player.networkHandler - .sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); + // select tool + WURST.getHax().autoToolHack.equipBestTool(pos, false, true, 0); + + // face block + facing.getSelected().face(params.hitVec()); + + // damage block and swing hand + if(MC.interactionManager.updateBlockBreakingProgress(pos, + params.side())) + swingHand.getSelected().swing(Hand.MAIN_HAND); + + // update progress + overlay.updateProgress(); return true; } @@ -292,71 +272,10 @@ public final class TreeBotHack extends Hack angleFinder.renderPath(matrixStack, pathCmd.isDebugMode(), pathCmd.isDepthTest()); - // GL settings - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_DEPTH_TEST); - if(tree != null) - drawTree(matrixStack); + tree.draw(matrixStack); - if(currentBlock != null) - drawCurrentBlock(matrixStack, partialTicks); - - // GL resets - RenderSystem.setShaderColor(1, 1, 1, 1); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_BLEND); - } - - private void drawTree(MatrixStack matrixStack) - { - RenderSystem.setShaderColor(0, 1, 0, 0.5F); - - matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack, - MC.world.getChunk(tree.getStump())); - - Matrix4f viewMatrix = matrixStack.peek().getPositionMatrix(); - Matrix4f projMatrix = RenderSystem.getProjectionMatrix(); - ShaderProgram shader = RenderSystem.getShader(); - - tree.getVertexBuffer().bind(); - tree.getVertexBuffer().draw(viewMatrix, projMatrix, shader); - VertexBuffer.unbind(); - - matrixStack.pop(); - } - - private void drawCurrentBlock(MatrixStack matrixStack, float partialTicks) - { - matrixStack.push(); - - RegionPos region = RenderUtils.getCameraRegion(); - RenderUtils.applyRegionalRenderOffset(matrixStack, region); - - Box box = new Box(BlockPos.ORIGIN); - float p = prevProgress + (progress - prevProgress) * partialTicks; - float red = p * 2F; - float green = 2 - red; - - matrixStack.translate(currentBlock.getX() - region.x(), - currentBlock.getY(), currentBlock.getZ() - region.z()); - if(p < 1) - { - matrixStack.translate(0.5, 0.5, 0.5); - matrixStack.scale(p, p, p); - matrixStack.translate(-0.5, -0.5, -0.5); - } - - RenderSystem.setShaderColor(red, green, 0, 0.25F); - RenderUtils.drawSolidBox(box, matrixStack); - - RenderSystem.setShaderColor(red, green, 0, 0.5F); - RenderUtils.drawOutlinedBox(box, matrixStack); - - matrixStack.pop(); + overlay.render(matrixStack, partialTicks, currentBlock); } private ArrayList getNeighbors(BlockPos pos) @@ -419,28 +338,19 @@ public final class TreeBotHack extends Hack return; } - ArrayList leaves = getLeavesInRange(pathFinder.getPath()); - if(!leaves.isEmpty()) - { - breakBlocks(leaves); + if(processor.canBreakBlocks() && breakBlocks(getLeavesOnPath())) return; - } processor.process(); } - private ArrayList getLeavesInRange(List path) + private ArrayList getLeavesOnPath() { - Vec3d eyesVec = RotationUtils.getEyesPos().subtract(0.5, 0.5, 0.5); - double rangeSq = Math.pow(range.getValue(), 2); - + List path = pathFinder.getPath(); path = path.subList(processor.getIndex(), path.size()); return path.stream().flatMap(pos -> Stream.of(pos, pos.up())) .distinct().filter(TreeBotUtils::isLeaves) - .filter( - pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) - .filter(TreeBotUtils::hasLineOfSight) .collect(Collectors.toCollection(ArrayList::new)); } @@ -557,19 +467,18 @@ public final class TreeBotHack extends Hack private boolean hasAngle(PathPos pos) { + double rangeSq = range.getValueSq(); ClientPlayerEntity player = WurstClient.MC.player; Vec3d eyes = Vec3d.ofBottomCenter(pos).add(0, player.getEyeHeight(player.getPose()), 0); - Vec3d eyesVec = eyes.subtract(0.5, 0.5, 0.5); - double rangeSq = Math.pow(range.getValue(), 2); - for(BlockPos log : tree.getLogs()) { - if(eyesVec.squaredDistanceTo(Vec3d.of(log)) > rangeSq) - continue; + BlockBreakingParams params = + BlockBreaker.getBlockBreakingParams(eyes, log); - if(TreeBotUtils.getLineOfSightSide(eyes, log) != null) + if(params != null && params.lineOfSight() + && params.distanceSq() <= rangeSq) return true; } diff --git a/src/main/java/net/wurstclient/hacks/TriggerBotHack.java b/src/main/java/net/wurstclient/hacks/TriggerBotHack.java index 593bf149..c41ad527 100644 --- a/src/main/java/net/wurstclient/hacks/TriggerBotHack.java +++ b/src/main/java/net/wurstclient/hacks/TriggerBotHack.java @@ -7,8 +7,6 @@ */ package net.wurstclient.hacks; -import java.util.stream.Stream; - import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.entity.Entity; @@ -110,14 +108,12 @@ public final class TriggerBotHack extends Hack implements UpdateListener private boolean isCorrectEntity(Entity entity) { - Stream stream = Stream.of(entity); - stream = stream.filter(EntityUtils.IS_ATTACKABLE); + if(!EntityUtils.IS_ATTACKABLE.test(entity)) + return false; - double rangeSq = Math.pow(range.getValue(), 2); - stream = stream.filter(e -> MC.player.squaredDistanceTo(e) <= rangeSq); + if(MC.player.squaredDistanceTo(entity) > range.getValueSq()) + return false; - stream = entityFilters.applyTo(stream); - - return stream.findFirst().isPresent(); + return entityFilters.testOne(entity); } } diff --git a/src/main/java/net/wurstclient/hacks/TrollPotionHack.java b/src/main/java/net/wurstclient/hacks/TrollPotionHack.java index 0d97fab9..4a4b67f4 100644 --- a/src/main/java/net/wurstclient/hacks/TrollPotionHack.java +++ b/src/main/java/net/wurstclient/hacks/TrollPotionHack.java @@ -13,6 +13,7 @@ import net.minecraft.item.Items; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtList; import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket; +import net.minecraft.registry.Registries; import net.minecraft.text.Text; import net.wurstclient.Category; import net.wurstclient.SearchTags; @@ -106,15 +107,18 @@ public final class TrollPotionHack extends Hack NbtList effects = new NbtList(); for(int i = 1; i <= 23; i++) { + String id = Registries.STATUS_EFFECT.getEntry(i).get().getKey() + .get().getValue().toString(); + NbtCompound effect = new NbtCompound(); - effect.putInt("Amplifier", Integer.MAX_VALUE); - effect.putInt("Duration", Integer.MAX_VALUE); - effect.putInt("Id", i); + effect.putInt("amplifier", Integer.MAX_VALUE); + effect.putInt("duration", Integer.MAX_VALUE); + effect.putString("id", id); effects.add(effect); } NbtCompound nbt = new NbtCompound(); - nbt.put("CustomPotionEffects", effects); + nbt.put("custom_potion_effects", effects); stack.setNbt(nbt); String name = "\u00a7f" + itemName + " of Trolling"; diff --git a/src/main/java/net/wurstclient/hacks/TrueSightHack.java b/src/main/java/net/wurstclient/hacks/TrueSightHack.java index e0cb6407..ecca3ddd 100644 --- a/src/main/java/net/wurstclient/hacks/TrueSightHack.java +++ b/src/main/java/net/wurstclient/hacks/TrueSightHack.java @@ -7,18 +7,50 @@ */ package net.wurstclient.hacks; +import net.minecraft.entity.Entity; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.hack.Hack; +import net.wurstclient.settings.filterlists.EntityFilterList; +import net.wurstclient.settings.filters.*; @SearchTags({"true sight"}) public final class TrueSightHack extends Hack { + private final EntityFilterList entityFilters = + new EntityFilterList(FilterHostileSetting.genericVision(false), + FilterNeutralSetting + .genericVision(AttackDetectingEntityFilter.Mode.OFF), + FilterPassiveSetting.genericVision(false), + FilterPassiveWaterSetting.genericVision(false), + FilterBatsSetting.genericVision(false), + FilterSlimesSetting.genericVision(false), + FilterPetsSetting.genericVision(false), + FilterVillagersSetting.genericVision(false), + FilterZombieVillagersSetting.genericVision(false), + FilterGolemsSetting.genericVision(false), + FilterPiglinsSetting + .genericVision(AttackDetectingEntityFilter.Mode.OFF), + FilterZombiePiglinsSetting + .genericVision(AttackDetectingEntityFilter.Mode.OFF), + FilterEndermenSetting + .genericVision(AttackDetectingEntityFilter.Mode.OFF), + FilterShulkersSetting.genericVision(false), + FilterAllaysSetting.genericVision(false), + FilterNamedSetting.genericVision(false), + FilterArmorStandsSetting.genericVision(false)); + public TrueSightHack() { super("TrueSight"); setCategory(Category.RENDER); + entityFilters.forEach(this::addSetting); } - // See LivingEntityRendererMixin + public boolean shouldBeVisible(Entity entity) + { + return isEnabled() && entityFilters.testOne(entity); + } + + // See EntityMixin.onIsInvisibleTo() } diff --git a/src/main/java/net/wurstclient/hacks/TunnellerHack.java b/src/main/java/net/wurstclient/hacks/TunnellerHack.java index 21bf57b6..3e97cbdd 100644 --- a/src/main/java/net/wurstclient/hacks/TunnellerHack.java +++ b/src/main/java/net/wurstclient/hacks/TunnellerHack.java @@ -39,7 +39,6 @@ import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; import net.minecraft.util.Hand; -import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; @@ -47,7 +46,6 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.EmptyBlockView; -import net.minecraft.world.RaycastContext; import net.wurstclient.Category; import net.wurstclient.events.RenderListener; import net.wurstclient.events.UpdateListener; @@ -153,7 +151,7 @@ public final class TunnellerHack extends Hack if(currentBlock != null) { - IMC.getInteractionManager().setBreakingBlock(true); + MC.interactionManager.breakingBlock = true; MC.interactionManager.cancelBlockBreaking(); currentBlock = null; } @@ -452,7 +450,7 @@ public final class TunnellerHack extends Hack } prevProgress = progress; - progress = IMC.getInteractionManager().getCurrentBreakingProgress(); + progress = MC.interactionManager.currentBreakingProgress; if(progress < prevProgress) prevProgress = progress; @@ -807,7 +805,7 @@ public final class TunnellerHack extends Hack // check for nearby falling blocks return StreamSupport .stream(MC.world.getEntities().spliterator(), false) - .filter(e -> e instanceof FallingBlockEntity) + .filter(FallingBlockEntity.class::isInstance) .anyMatch(e -> MC.player.squaredDistanceTo(e) < 36); } @@ -877,7 +875,7 @@ public final class TunnellerHack extends Hack return; // check timer - if(IMC.getItemUseCooldown() > 0) + if(MC.itemUseCooldown > 0) return; // place block @@ -889,7 +887,7 @@ public final class TunnellerHack extends Hack .sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); // reset timer - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; } private boolean breakBlock(BlockPos pos) @@ -923,7 +921,7 @@ public final class TunnellerHack extends Hack if(distancesSq[i] >= distanceSqToCenter) continue; - linesOfSight[i] = hasLineOfSight(eyesPos, hitVecs[i]); + linesOfSight[i] = BlockUtils.hasLineOfSight(eyesPos, hitVecs[i]); } Direction side = sides[0]; @@ -957,15 +955,6 @@ public final class TunnellerHack extends Hack return true; } - private boolean hasLineOfSight(Vec3d from, Vec3d to) - { - RaycastContext context = - new RaycastContext(from, to, RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, MC.player); - - return MC.world.raycast(context).getType() == HitResult.Type.MISS; - } - private enum TunnelSize { SIZE_1X2("1x2", new Vec3i(0, 1, 0), new Vec3i(0, 0, 0), 4, 13), diff --git a/src/main/java/net/wurstclient/hacks/XRayHack.java b/src/main/java/net/wurstclient/hacks/XRayHack.java index d989824d..31c02868 100644 --- a/src/main/java/net/wurstclient/hacks/XRayHack.java +++ b/src/main/java/net/wurstclient/hacks/XRayHack.java @@ -25,7 +25,6 @@ import net.wurstclient.events.GetAmbientOcclusionLightLevelListener; import net.wurstclient.events.RenderBlockEntityListener; import net.wurstclient.events.SetOpaqueCubeListener; import net.wurstclient.events.ShouldDrawSideListener; -import net.wurstclient.events.TesselateBlockListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; import net.wurstclient.mixinterface.ISimpleOption; @@ -37,7 +36,7 @@ import net.wurstclient.util.ChatUtils; @SearchTags({"XRay", "x ray", "OreFinder", "ore finder"}) public final class XRayHack extends Hack implements UpdateListener, SetOpaqueCubeListener, GetAmbientOcclusionLightLevelListener, - ShouldDrawSideListener, TesselateBlockListener, RenderBlockEntityListener + ShouldDrawSideListener, RenderBlockEntityListener { private final BlockListSetting ores = new BlockListSetting("Ores", "A list of blocks that X-Ray will show. They don't have to be just ores" @@ -109,7 +108,6 @@ public final class XRayHack extends Hack implements UpdateListener, EVENTS.add(SetOpaqueCubeListener.class, this); EVENTS.add(GetAmbientOcclusionLightLevelListener.class, this); EVENTS.add(ShouldDrawSideListener.class, this); - EVENTS.add(TesselateBlockListener.class, this); EVENTS.add(RenderBlockEntityListener.class, this); // reload chunks @@ -128,7 +126,6 @@ public final class XRayHack extends Hack implements UpdateListener, EVENTS.remove(SetOpaqueCubeListener.class, this); EVENTS.remove(GetAmbientOcclusionLightLevelListener.class, this); EVENTS.remove(ShouldDrawSideListener.class, this); - EVENTS.remove(TesselateBlockListener.class, this); EVENTS.remove(RenderBlockEntityListener.class, this); // reload chunks @@ -168,13 +165,6 @@ public final class XRayHack extends Hack implements UpdateListener, isVisible(event.getState().getBlock(), event.getPos())); } - @Override - public void onTesselateBlock(TesselateBlockEvent event) - { - if(!isVisible(event.getState().getBlock(), event.getPos())) - event.cancel(); - } - @Override public void onRenderBlockEntity(RenderBlockEntityEvent event) { @@ -189,7 +179,7 @@ public final class XRayHack extends Hack implements UpdateListener, int index = Collections.binarySearch(oreNamesCache, name); boolean visible = index >= 0; - if(visible && onlyExposed.isChecked()) + if(visible && onlyExposed.isChecked() && pos != null) return !BlockUtils.isOpaqueFullCube(pos.up()) || !BlockUtils.isOpaqueFullCube(pos.down()) || !BlockUtils.isOpaqueFullCube(pos.east()) diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java index 7f8c4a84..b7fb3980 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java @@ -38,11 +38,13 @@ public final class ModelSettings public enum OpenAiModel { GPT_3_5_TURBO("gpt-3.5-turbo", true), + GPT_3_5_TURBO_1106("gpt-3.5-turbo-1106", true), GPT_3_5_TURBO_0613("gpt-3.5-turbo-0613", true), GPT_3_5_TURBO_0301("gpt-3.5-turbo-0301", true), GPT_3_5_TURBO_16K("gpt-3.5-turbo-16k", true), GPT_3_5_TURBO_16K_0613("gpt-3.5-turbo-16k-0613", true), GPT_4("gpt-4", true), + GPT_4_1106_PREVIEW("gpt-4-1106-preview", true), GPT_4_0613("gpt-4-0613", true), GPT_4_0314("gpt-4-0314", true), GPT_4_32K("gpt-4-32k", true), diff --git a/src/main/java/net/wurstclient/hacks/autofish/ShallowWaterWarningCheckbox.java b/src/main/java/net/wurstclient/hacks/autofish/ShallowWaterWarningCheckbox.java index 849324d5..2944e4fd 100644 --- a/src/main/java/net/wurstclient/hacks/autofish/ShallowWaterWarningCheckbox.java +++ b/src/main/java/net/wurstclient/hacks/autofish/ShallowWaterWarningCheckbox.java @@ -9,7 +9,6 @@ package net.wurstclient.hacks.autofish; import net.minecraft.entity.projectile.FishingBobberEntity; import net.wurstclient.WurstClient; -import net.wurstclient.mixinterface.IFishingBobberEntity; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.util.ChatUtils; @@ -32,10 +31,7 @@ public class ShallowWaterWarningCheckbox extends CheckboxSetting public void checkWaterAround(FishingBobberEntity bobber) { - boolean isOpenWater = ((IFishingBobberEntity)bobber) - .checkOpenWaterAround(bobber.getBlockPos()); - - if(isOpenWater) + if(bobber.isOpenOrWaterAround(bobber.getBlockPos())) { hasAlreadyWarned = false; return; diff --git a/src/main/java/net/wurstclient/hacks/autolibrarian/BookOffer.java b/src/main/java/net/wurstclient/hacks/autolibrarian/BookOffer.java index c4fe0aad..5ea262b4 100644 --- a/src/main/java/net/wurstclient/hacks/autolibrarian/BookOffer.java +++ b/src/main/java/net/wurstclient/hacks/autolibrarian/BookOffer.java @@ -9,10 +9,10 @@ package net.wurstclient.hacks.autolibrarian; import java.util.Objects; +import net.minecraft.client.resource.language.TranslationStorage; import net.minecraft.enchantment.Enchantment; import net.minecraft.registry.Registries; import net.minecraft.util.Identifier; -import net.wurstclient.WurstClient; import net.wurstclient.mixinterface.ILanguageManager; public record BookOffer(String id, int level, int price) @@ -31,24 +31,19 @@ public record BookOffer(String id, int level, int price) public String getEnchantmentName() { - ILanguageManager languageManager = WurstClient.IMC.getLanguageManager(); + TranslationStorage english = ILanguageManager.getEnglish(); Enchantment enchantment = getEnchantment(); - String trKey = enchantment.getTranslationKey(); - String name = languageManager.getEnglish().get(trKey); - - return name; + return english.get(enchantment.getTranslationKey()); } public String getEnchantmentNameWithLevel() { - ILanguageManager languageManager = WurstClient.IMC.getLanguageManager(); + TranslationStorage english = ILanguageManager.getEnglish(); Enchantment enchantment = getEnchantment(); - String trKey = enchantment.getTranslationKey(); - String name = languageManager.getEnglish().get(trKey); + String name = english.get(enchantment.getTranslationKey()); if(enchantment.getMaxLevel() > 1) - name += " " + languageManager.getEnglish() - .get("enchantment.level." + level); + name += " " + english.get("enchantment.level." + level); return name; } diff --git a/src/main/java/net/wurstclient/hacks/chestesp/ChestEspRenderer.java b/src/main/java/net/wurstclient/hacks/chestesp/ChestEspRenderer.java index b04f568b..ed0ade7a 100644 --- a/src/main/java/net/wurstclient/hacks/chestesp/ChestEspRenderer.java +++ b/src/main/java/net/wurstclient/hacks/chestesp/ChestEspRenderer.java @@ -37,12 +37,12 @@ public final class ChestEspRenderer private final RegionPos region; private final Vec3d start; - public ChestEspRenderer(MatrixStack matrixStack) + public ChestEspRenderer(MatrixStack matrixStack, float partialTicks) { this.matrixStack = matrixStack; region = RenderUtils.getCameraRegion(); - start = RotationUtils.getClientLookVec().add(RenderUtils.getCameraPos()) - .subtract(region.toVec3d()); + start = RotationUtils.getClientLookVec(partialTicks) + .add(RenderUtils.getCameraPos()).subtract(region.toVec3d()); } public void renderBoxes(ChestEspGroup group) diff --git a/src/main/java/net/wurstclient/treebot/Tree.java b/src/main/java/net/wurstclient/hacks/treebot/Tree.java similarity index 64% rename from src/main/java/net/wurstclient/treebot/Tree.java rename to src/main/java/net/wurstclient/hacks/treebot/Tree.java index dbabe107..98d01351 100644 --- a/src/main/java/net/wurstclient/treebot/Tree.java +++ b/src/main/java/net/wurstclient/hacks/treebot/Tree.java @@ -5,18 +5,23 @@ * License, version 3. If a copy of the GPL was not distributed with this * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt */ -package net.wurstclient.treebot; +package net.wurstclient.hacks.treebot; import java.util.ArrayList; +import org.joml.Matrix4f; +import org.lwjgl.opengl.GL11; + import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.gl.ShaderProgram; import net.minecraft.client.gl.VertexBuffer; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.BufferBuilder.BuiltBuffer; import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; @@ -65,10 +70,43 @@ public class Tree implements AutoCloseable VertexBuffer.unbind(); } + public void draw(MatrixStack matrixStack) + { + if(vertexBuffer == null) + return; + + // GL settings + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_DEPTH_TEST); + + RenderSystem.setShaderColor(0, 1, 0, 0.5F); + + matrixStack.push(); + RenderUtils.applyRegionalRenderOffset(matrixStack, RegionPos.of(stump)); + + Matrix4f viewMatrix = matrixStack.peek().getPositionMatrix(); + Matrix4f projMatrix = RenderSystem.getProjectionMatrix(); + ShaderProgram shader = RenderSystem.getShader(); + + vertexBuffer.bind(); + vertexBuffer.draw(viewMatrix, projMatrix, shader); + VertexBuffer.unbind(); + + matrixStack.pop(); + + // GL resets + RenderSystem.setShaderColor(1, 1, 1, 1); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_BLEND); + } + @Override public void close() { vertexBuffer.close(); + vertexBuffer = null; } public BlockPos getStump() @@ -80,9 +118,4 @@ public class Tree implements AutoCloseable { return logs; } - - public VertexBuffer getVertexBuffer() - { - return vertexBuffer; - } } diff --git a/src/main/java/net/wurstclient/hacks/treebot/TreeBotUtils.java b/src/main/java/net/wurstclient/hacks/treebot/TreeBotUtils.java new file mode 100644 index 00000000..fa1cf19f --- /dev/null +++ b/src/main/java/net/wurstclient/hacks/treebot/TreeBotUtils.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.hacks.treebot; + +import net.minecraft.block.BlockState; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.util.math.BlockPos; +import net.wurstclient.util.BlockUtils; + +public enum TreeBotUtils +{ + ; + + public static boolean isLog(BlockPos pos) + { + return BlockUtils.getState(pos).isIn(BlockTags.LOGS); + } + + public static boolean isLeaves(BlockPos pos) + { + BlockState state = BlockUtils.getState(pos); + return state.isIn(BlockTags.LEAVES) + || state.isIn(BlockTags.WART_BLOCKS); + } +} diff --git a/src/main/java/net/wurstclient/mixin/AbstractBlockStateMixin.java b/src/main/java/net/wurstclient/mixin/AbstractBlockStateMixin.java index 9f546060..e786c508 100644 --- a/src/main/java/net/wurstclient/mixin/AbstractBlockStateMixin.java +++ b/src/main/java/net/wurstclient/mixin/AbstractBlockStateMixin.java @@ -45,8 +45,7 @@ public abstract class AbstractBlockStateMixin extends State } @Inject(at = @At("TAIL"), - method = { - "isFullCube(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Z"}, + method = "isFullCube(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Z", cancellable = true) private void onIsFullCube(BlockView world, BlockPos pos, CallbackInfoReturnable cir) @@ -58,8 +57,7 @@ public abstract class AbstractBlockStateMixin extends State } @Inject(at = @At("TAIL"), - method = { - "getAmbientOcclusionLightLevel(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)F"}, + method = "getAmbientOcclusionLightLevel(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)F", cancellable = true) private void onGetAmbientOcclusionLightLevel(BlockView blockView, BlockPos blockPos, CallbackInfoReturnable cir) @@ -73,8 +71,7 @@ public abstract class AbstractBlockStateMixin extends State } @Inject(at = @At("HEAD"), - method = { - "getOutlineShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;"}, + method = "getOutlineShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;", cancellable = true) private void onGetOutlineShape(BlockView view, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) diff --git a/src/main/java/net/wurstclient/mixin/AbstractSignEditScreenMixin.java b/src/main/java/net/wurstclient/mixin/AbstractSignEditScreenMixin.java index c6670c46..4d076237 100644 --- a/src/main/java/net/wurstclient/mixin/AbstractSignEditScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/AbstractSignEditScreenMixin.java @@ -27,12 +27,12 @@ public abstract class AbstractSignEditScreenMixin extends Screen @Final private String[] messages; - private AbstractSignEditScreenMixin(WurstClient wurst, Text text_1) + private AbstractSignEditScreenMixin(WurstClient wurst, Text title) { - super(text_1); + super(title); } - @Inject(at = {@At("HEAD")}, method = {"init()V"}) + @Inject(at = @At("HEAD"), method = "init()V") private void onInit(CallbackInfo ci) { AutoSignHack autoSignHack = WurstClient.INSTANCE.getHax().autoSignHack; @@ -47,7 +47,7 @@ public abstract class AbstractSignEditScreenMixin extends Screen finishEditing(); } - @Inject(at = {@At("HEAD")}, method = {"finishEditing()V"}) + @Inject(at = @At("HEAD"), method = "finishEditing()V") private void onFinishEditing(CallbackInfo ci) { WurstClient.INSTANCE.getHax().autoSignHack.setSignText(messages); diff --git a/src/main/java/net/wurstclient/mixin/ArmorItemMixin.java b/src/main/java/net/wurstclient/mixin/ArmorItemMixin.java deleted file mode 100644 index eda28bc6..00000000 --- a/src/main/java/net/wurstclient/mixin/ArmorItemMixin.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import net.minecraft.item.ArmorItem; -import net.minecraft.item.Item; -import net.wurstclient.WurstClient; -import net.wurstclient.mixinterface.IArmorItem; - -@Mixin(ArmorItem.class) -public class ArmorItemMixin extends Item implements IArmorItem -{ - @Shadow - protected float toughness; - - private ArmorItemMixin(WurstClient wurst, Settings item$Settings_1) - { - super(item$Settings_1); - } - - @Override - public float getToughness() - { - return toughness; - } -} diff --git a/src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java b/src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java index 396b69e4..62e03146 100644 --- a/src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java @@ -20,9 +20,8 @@ import net.wurstclient.WurstClient; @Mixin(BackgroundRenderer.class) public class BackgroundRendererMixin { - @Inject(at = {@At("HEAD")}, - method = { - "getFogModifier(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier;"}, + @Inject(at = @At("HEAD"), + method = "getFogModifier(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier;", cancellable = true) private static void onGetFogModifier(Entity entity, float tickDelta, CallbackInfoReturnable ci) diff --git a/src/main/java/net/wurstclient/mixin/BasicBakedModelMixin.java b/src/main/java/net/wurstclient/mixin/BasicBakedModelMixin.java new file mode 100644 index 00000000..98c372ae --- /dev/null +++ b/src/main/java/net/wurstclient/mixin/BasicBakedModelMixin.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.mixin; + +import java.util.List; + +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import net.minecraft.block.BlockState; +import net.minecraft.client.render.model.BakedQuad; +import net.minecraft.client.render.model.BasicBakedModel; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; +import net.wurstclient.WurstClient; +import net.wurstclient.event.EventManager; +import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent; + +@Mixin(BasicBakedModel.class) +public class BasicBakedModelMixin +{ + /** + * This mixin hides blocks like grass and snow when using X-Ray. It works + * with and without Sodium installed. + */ + @Inject(at = @At("HEAD"), method = "getQuads", cancellable = true) + private void getQuads(@Nullable BlockState state, @Nullable Direction face, + Random random, CallbackInfoReturnable> cir) + { + if(face != null || state == null + || !WurstClient.INSTANCE.getHax().xRayHack.isEnabled()) + return; + + ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, null); + EventManager.fire(event); + + if(Boolean.FALSE.equals(event.isRendered())) + cir.setReturnValue(List.of()); + } +} diff --git a/src/main/java/net/wurstclient/mixin/BlockEntityRenderDispatcherMixin.java b/src/main/java/net/wurstclient/mixin/BlockEntityRenderDispatcherMixin.java index 768ebc4d..b2df3a40 100644 --- a/src/main/java/net/wurstclient/mixin/BlockEntityRenderDispatcherMixin.java +++ b/src/main/java/net/wurstclient/mixin/BlockEntityRenderDispatcherMixin.java @@ -22,16 +22,14 @@ import net.wurstclient.events.RenderBlockEntityListener.RenderBlockEntityEvent; @Mixin(BlockEntityRenderDispatcher.class) public class BlockEntityRenderDispatcherMixin { - @Inject(at = {@At("HEAD")}, - method = { - "render(Lnet/minecraft/block/entity/BlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;)V"}, + @Inject(at = @At("HEAD"), + method = "render(Lnet/minecraft/block/entity/BlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;)V", cancellable = true) - private void onRender(E blockEntity_1, - float float_1, MatrixStack matrixStack_1, - VertexConsumerProvider vertexConsumerProvider_1, CallbackInfo ci) + private void onRender(E blockEntity, + float tickDelta, MatrixStack matrices, + VertexConsumerProvider vertexConsumers, CallbackInfo ci) { - RenderBlockEntityEvent event = - new RenderBlockEntityEvent(blockEntity_1); + RenderBlockEntityEvent event = new RenderBlockEntityEvent(blockEntity); EventManager.fire(event); if(event.isCancelled()) diff --git a/src/main/java/net/wurstclient/mixin/BlockMixin.java b/src/main/java/net/wurstclient/mixin/BlockMixin.java index ca1c5ad9..c5936a18 100644 --- a/src/main/java/net/wurstclient/mixin/BlockMixin.java +++ b/src/main/java/net/wurstclient/mixin/BlockMixin.java @@ -26,6 +26,10 @@ import net.wurstclient.hack.HackList; @Mixin(Block.class) public abstract class BlockMixin implements ItemConvertible { + /** + * This mixin allows X-Ray to show ores that would normally be obstructed by + * other blocks. + */ @Inject(at = @At("HEAD"), method = "shouldDrawSide(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;Lnet/minecraft/util/math/BlockPos;)Z", cancellable = true) diff --git a/src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java b/src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java deleted file mode 100644 index 18ef1daf..00000000 --- a/src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import net.minecraft.block.BlockState; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.block.BlockModelRenderer; -import net.minecraft.client.render.model.BakedModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.BlockRenderView; -import net.wurstclient.event.EventManager; -import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent; -import net.wurstclient.events.TesselateBlockListener.TesselateBlockEvent; - -@Mixin(BlockModelRenderer.class) -public abstract class BlockModelRendererMixin -{ - @Inject(at = @At("HEAD"), - method = { - "renderSmooth(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V", - "renderFlat(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V"}, - cancellable = true) - private void onRenderSmoothOrFlat(BlockRenderView world, BakedModel model, - BlockState state, BlockPos pos, MatrixStack matrices, - VertexConsumer vertexConsumer, boolean cull, Random random, long seed, - int overlay, CallbackInfo ci) - { - TesselateBlockEvent event = new TesselateBlockEvent(state, pos); - EventManager.fire(event); - - if(event.isCancelled()) - { - ci.cancel(); - return; - } - - if(!cull) - return; - - ShouldDrawSideEvent event2 = new ShouldDrawSideEvent(state, pos); - EventManager.fire(event2); - if(!Boolean.TRUE.equals(event2.isRendered())) - return; - - renderSmooth(world, model, state, pos, matrices, vertexConsumer, false, - random, seed, overlay); - } - - @Shadow - public void renderSmooth(BlockRenderView world, BakedModel model, - BlockState state, BlockPos pos, MatrixStack matrices, - VertexConsumer vertexConsumer, boolean cull, Random random, long seed, - int overlay) - { - - } -} diff --git a/src/main/java/net/wurstclient/mixin/CactusBlockMixin.java b/src/main/java/net/wurstclient/mixin/CactusBlockMixin.java index 79da27d8..f161d3f6 100644 --- a/src/main/java/net/wurstclient/mixin/CactusBlockMixin.java +++ b/src/main/java/net/wurstclient/mixin/CactusBlockMixin.java @@ -26,18 +26,17 @@ import net.wurstclient.events.CactusCollisionShapeListener.CactusCollisionShapeE @Mixin(CactusBlock.class) public abstract class CactusBlockMixin extends Block { - private CactusBlockMixin(WurstClient wurst, Settings block$Settings_1) + private CactusBlockMixin(WurstClient wurst, Settings settings) { - super(block$Settings_1); + super(settings); } - @Inject(at = {@At("HEAD")}, - method = { - "getCollisionShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;"}, + @Inject(at = @At("HEAD"), + method = "getCollisionShape(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;", cancellable = true) - private void onGetCollisionShape(BlockState blockState_1, - BlockView blockView_1, BlockPos blockPos_1, - ShapeContext entityContext_1, CallbackInfoReturnable cir) + private void onGetCollisionShape(BlockState state, BlockView world, + BlockPos pos, ShapeContext context, + CallbackInfoReturnable cir) { CactusCollisionShapeEvent event = new CactusCollisionShapeEvent(); EventManager.fire(event); diff --git a/src/main/java/net/wurstclient/mixin/CameraMixin.java b/src/main/java/net/wurstclient/mixin/CameraMixin.java index dcbb2fc7..b6e6d43f 100644 --- a/src/main/java/net/wurstclient/mixin/CameraMixin.java +++ b/src/main/java/net/wurstclient/mixin/CameraMixin.java @@ -26,10 +26,10 @@ public abstract class CameraMixin argsOnly = true) private double changeClipToSpaceDistance(double desiredCameraDistance) { - CameraDistanceHack cameraDistanceHack = + CameraDistanceHack cameraDistance = WurstClient.INSTANCE.getHax().cameraDistanceHack; - if(cameraDistanceHack.isEnabled()) - return cameraDistanceHack.getDistance(); + if(cameraDistance.isEnabled()) + return cameraDistance.getDistance(); return desiredCameraDistance; } diff --git a/src/main/java/net/wurstclient/mixin/ChatHudMixin.java b/src/main/java/net/wurstclient/mixin/ChatHudMixin.java index c67ee259..95f63708 100644 --- a/src/main/java/net/wurstclient/mixin/ChatHudMixin.java +++ b/src/main/java/net/wurstclient/mixin/ChatHudMixin.java @@ -10,6 +10,7 @@ package net.wurstclient.mixin; import java.util.List; import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -30,8 +31,10 @@ import net.wurstclient.events.ChatInputListener.ChatInputEvent; public class ChatHudMixin { @Shadow + @Final private List visibleMessages; @Shadow + @Final private MinecraftClient client; @Inject(at = @At("HEAD"), @@ -53,9 +56,11 @@ public class ChatHudMixin message = event.getComponent(); indicator = WurstClient.INSTANCE.getOtfs().noChatReportsOtf .modifyIndicator(message, signature, indicator); + shadow$logChatMessage(message, indicator); shadow$addMessage(message, signature, client.inGameHud.getTicks(), indicator, false); + ci.cancel(); } diff --git a/src/main/java/net/wurstclient/mixin/ChatInputSuggestorMixin.java b/src/main/java/net/wurstclient/mixin/ChatInputSuggestorMixin.java index 0206a4e1..5192afe7 100644 --- a/src/main/java/net/wurstclient/mixin/ChatInputSuggestorMixin.java +++ b/src/main/java/net/wurstclient/mixin/ChatInputSuggestorMixin.java @@ -9,6 +9,7 @@ package net.wurstclient.mixin; import java.util.concurrent.CompletableFuture; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -26,6 +27,7 @@ import net.wurstclient.hacks.AutoCompleteHack; public abstract class ChatInputSuggestorMixin { @Shadow + @Final private TextFieldWidget textField; @Shadow private CompletableFuture pendingSuggestions; diff --git a/src/main/java/net/wurstclient/mixin/ChatScreenMixin.java b/src/main/java/net/wurstclient/mixin/ChatScreenMixin.java index 22597b31..e813cf41 100644 --- a/src/main/java/net/wurstclient/mixin/ChatScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/ChatScreenMixin.java @@ -23,17 +23,17 @@ import net.wurstclient.event.EventManager; import net.wurstclient.events.ChatOutputListener.ChatOutputEvent; @Mixin(ChatScreen.class) -public class ChatScreenMixin extends Screen +public abstract class ChatScreenMixin extends Screen { @Shadow protected TextFieldWidget chatField; - private ChatScreenMixin(WurstClient wurst, Text text) + private ChatScreenMixin(WurstClient wurst, Text title) { - super(text); + super(title); } - @Inject(at = {@At("TAIL")}, method = {"init()V"}) + @Inject(at = @At("TAIL"), method = "init()V") protected void onInit(CallbackInfo ci) { if(WurstClient.INSTANCE.getHax().infiniChatHack.isEnabled()) @@ -75,8 +75,5 @@ public class ChatScreenMixin extends Screen } @Shadow - public String normalize(String chatText) - { - return null; - } + public abstract String normalize(String chatText); } diff --git a/src/main/java/net/wurstclient/mixin/ChunkOcclusionGraphBuilderMixin.java b/src/main/java/net/wurstclient/mixin/ChunkOcclusionGraphBuilderMixin.java index 24383604..2a8ae36c 100644 --- a/src/main/java/net/wurstclient/mixin/ChunkOcclusionGraphBuilderMixin.java +++ b/src/main/java/net/wurstclient/mixin/ChunkOcclusionGraphBuilderMixin.java @@ -20,8 +20,8 @@ import net.wurstclient.events.SetOpaqueCubeListener.SetOpaqueCubeEvent; @Mixin(ChunkOcclusionDataBuilder.class) public class ChunkOcclusionGraphBuilderMixin { - @Inject(at = {@At("HEAD")}, - method = {"markClosed(Lnet/minecraft/util/math/BlockPos;)V"}, + @Inject(at = @At("HEAD"), + method = "markClosed(Lnet/minecraft/util/math/BlockPos;)V", cancellable = true) private void onMarkClosed(BlockPos pos, CallbackInfo ci) { diff --git a/src/main/java/net/wurstclient/mixin/ClientCommonNetworkHandlerMixin.java b/src/main/java/net/wurstclient/mixin/ClientCommonNetworkHandlerMixin.java new file mode 100644 index 00000000..9c9fe9cf --- /dev/null +++ b/src/main/java/net/wurstclient/mixin/ClientCommonNetworkHandlerMixin.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import net.minecraft.client.network.ClientCommonNetworkHandler; +import net.minecraft.network.listener.ClientCommonPacketListener; +import net.minecraft.network.packet.Packet; +import net.wurstclient.event.EventManager; +import net.wurstclient.events.PacketOutputListener.PacketOutputEvent; + +@Mixin(ClientCommonNetworkHandler.class) +public abstract class ClientCommonNetworkHandlerMixin + implements ClientCommonPacketListener +{ + @Inject(at = @At("HEAD"), + method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V", + cancellable = true) + private void onSendPacket(Packet packet, CallbackInfo ci) + { + PacketOutputEvent event = new PacketOutputEvent(packet); + EventManager.fire(event); + + if(event.isCancelled()) + ci.cancel(); + } +} diff --git a/src/main/java/net/wurstclient/mixin/ClientConnectionMixin.java b/src/main/java/net/wurstclient/mixin/ClientConnectionMixin.java index 4e36df32..c79f59bd 100644 --- a/src/main/java/net/wurstclient/mixin/ClientConnectionMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientConnectionMixin.java @@ -37,8 +37,8 @@ public abstract class ClientConnectionMixin ordinal = 0), method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/packet/Packet;)V", cancellable = true) - private void onChannelRead0(ChannelHandlerContext channelHandlerContext, - Packet packet, CallbackInfo ci) + private void onChannelRead0(ChannelHandlerContext context, Packet packet, + CallbackInfo ci) { PacketInputEvent event = new PacketInputEvent(packet); EventManager.fire(event); diff --git a/src/main/java/net/wurstclient/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/net/wurstclient/mixin/ClientPlayNetworkHandlerMixin.java index 9d246a74..b195f101 100644 --- a/src/main/java/net/wurstclient/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientPlayNetworkHandlerMixin.java @@ -7,18 +7,19 @@ */ package net.wurstclient.mixin; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientCommonNetworkHandler; +import net.minecraft.client.network.ClientConnectionState; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.toast.SystemToast; +import net.minecraft.network.ClientConnection; import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; +import net.minecraft.network.listener.TickablePacketListener; import net.minecraft.network.packet.s2c.play.BlockUpdateS2CPacket; import net.minecraft.network.packet.s2c.play.ChunkData; import net.minecraft.network.packet.s2c.play.ChunkDeltaUpdateS2CPacket; @@ -26,28 +27,18 @@ import net.minecraft.network.packet.s2c.play.ServerMetadataS2CPacket; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.wurstclient.WurstClient; -import net.wurstclient.event.EventManager; -import net.wurstclient.events.PacketOutputListener.PacketOutputEvent; import net.wurstclient.util.ChatUtils; @Mixin(ClientPlayNetworkHandler.class) public abstract class ClientPlayNetworkHandlerMixin - implements ClientPlayPacketListener + extends ClientCommonNetworkHandler + implements TickablePacketListener, ClientPlayPacketListener { - @Shadow - @Final - private MinecraftClient client; - - @Inject(at = @At("HEAD"), - method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V", - cancellable = true) - private void onSendPacket(Packet packet, CallbackInfo ci) + private ClientPlayNetworkHandlerMixin(WurstClient wurst, + MinecraftClient client, ClientConnection connection, + ClientConnectionState connectionState) { - PacketOutputEvent event = new PacketOutputEvent(packet); - EventManager.fire(event); - - if(event.isCancelled()) - ci.cancel(); + super(client, connection, connectionState); } @Inject(at = @At("TAIL"), diff --git a/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java b/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java index ed1e2cd5..55aeac4e 100644 --- a/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java @@ -21,7 +21,6 @@ import com.mojang.authlib.GameProfile; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.MovementType; @@ -45,12 +44,6 @@ import net.wurstclient.mixinterface.IClientPlayerEntity; public class ClientPlayerEntityMixin extends AbstractClientPlayerEntity implements IClientPlayerEntity { - @Shadow - private float lastYaw; - @Shadow - private float lastPitch; - @Shadow - private ClientPlayNetworkHandler networkHandler; @Shadow @Final protected MinecraftClient client; @@ -130,8 +123,7 @@ public class ClientPlayerEntityMixin extends AbstractClientPlayerEntity method = "move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V") private void onMove(MovementType type, Vec3d offset, CallbackInfo ci) { - PlayerMoveEvent event = new PlayerMoveEvent(this); - EventManager.fire(event); + EventManager.fire(PlayerMoveEvent.INSTANCE); } @Inject(at = @At("HEAD"), @@ -278,30 +270,9 @@ public class ClientPlayerEntityMixin extends AbstractClientPlayerEntity && hax.noLevitationHack.isEnabled()) return false; + if(effect == StatusEffects.DARKNESS && hax.antiBlindHack.isEnabled()) + return false; + return super.hasStatusEffect(effect); } - - @Override - public void setNoClip(boolean noClip) - { - this.noClip = noClip; - } - - @Override - public float getLastYaw() - { - return lastYaw; - } - - @Override - public float getLastPitch() - { - return lastPitch; - } - - @Override - public void setMovementMultiplier(Vec3d movementMultiplier) - { - this.movementMultiplier = movementMultiplier; - } } diff --git a/src/main/java/net/wurstclient/mixin/ClientPlayerInteractionManagerMixin.java b/src/main/java/net/wurstclient/mixin/ClientPlayerInteractionManagerMixin.java index 42d8b51a..d99dd469 100644 --- a/src/main/java/net/wurstclient/mixin/ClientPlayerInteractionManagerMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientPlayerInteractionManagerMixin.java @@ -7,6 +7,7 @@ */ package net.wurstclient.mixin; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -35,6 +36,7 @@ import net.wurstclient.event.EventManager; import net.wurstclient.events.BlockBreakingProgressListener.BlockBreakingProgressEvent; import net.wurstclient.events.StopUsingItemListener.StopUsingItemEvent; import net.wurstclient.hack.HackList; +import net.wurstclient.hacks.ReachHack; import net.wurstclient.mixinterface.IClientPlayerInteractionManager; @Mixin(ClientPlayerInteractionManager.class) @@ -42,45 +44,35 @@ public abstract class ClientPlayerInteractionManagerMixin implements IClientPlayerInteractionManager { @Shadow + @Final private MinecraftClient client; - @Shadow - private float currentBreakingProgress; - @Shadow - private boolean breakingBlock; - /** - * blockHitDelay - */ - @Shadow - private int blockBreakingCooldown; - - @Inject(at = {@At(value = "INVOKE", + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getId()I", - ordinal = 0)}, - method = { - "updateBlockBreakingProgress(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)Z"}) - private void onPlayerDamageBlock(BlockPos blockPos_1, Direction direction_1, + ordinal = 0), + method = "updateBlockBreakingProgress(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)Z") + private void onPlayerDamageBlock(BlockPos pos, Direction direction, CallbackInfoReturnable cir) { - BlockBreakingProgressEvent event = - new BlockBreakingProgressEvent(blockPos_1, direction_1); - EventManager.fire(event); + EventManager.fire(new BlockBreakingProgressEvent(pos, direction)); } - @Inject(at = {@At("HEAD")}, - method = {"getReachDistance()F"}, + @Inject(at = @At("HEAD"), + method = "getReachDistance()F", cancellable = true) private void onGetReachDistance(CallbackInfoReturnable ci) { HackList hax = WurstClient.INSTANCE.getHax(); - if(hax == null || !hax.reachHack.isEnabled()) + if(hax == null) return; - ci.setReturnValue(hax.reachHack.getReachDistance()); + ReachHack reach = hax.reachHack; + if(reach.isEnabled()) + ci.setReturnValue(reach.getReachDistance()); } - @Inject(at = {@At("HEAD")}, - method = {"hasExtendedReach()Z"}, + @Inject(at = @At("HEAD"), + method = "hasExtendedReach()Z", cancellable = true) private void hasExtendedReach(CallbackInfoReturnable cir) { @@ -91,25 +83,13 @@ public abstract class ClientPlayerInteractionManagerMixin cir.setReturnValue(true); } - @Inject(at = {@At("HEAD")}, + @Inject(at = @At("HEAD"), method = "stopUsingItem(Lnet/minecraft/entity/player/PlayerEntity;)V") private void onStopUsingItem(PlayerEntity player, CallbackInfo ci) { EventManager.fire(StopUsingItemEvent.INSTANCE); } - @Override - public float getCurrentBreakingProgress() - { - return currentBreakingProgress; - } - - @Override - public void setBreakingBlock(boolean breakingBlock) - { - this.breakingBlock = breakingBlock; - } - @Override public void windowClick_PICKUP(int slot) { @@ -140,19 +120,13 @@ public abstract class ClientPlayerInteractionManagerMixin interactItem(client.player, Hand.MAIN_HAND); } - @Override - public void rightClickBlock(BlockPos pos, Direction side, Vec3d hitVec, - Hand hand) - { - BlockHitResult hitResult = new BlockHitResult(hitVec, side, pos, false); - interactBlock(client.player, hand, hitResult); - interactItem(client.player, hand); - } - @Override public void rightClickBlock(BlockPos pos, Direction side, Vec3d hitVec) { - rightClickBlock(pos, side, hitVec, Hand.MAIN_HAND); + BlockHitResult hitResult = new BlockHitResult(hitVec, side, pos, false); + Hand hand = Hand.MAIN_HAND; + interactBlock(client.player, hand, hitResult); + interactItem(client.player, hand); } @Override @@ -171,12 +145,6 @@ public abstract class ClientPlayerInteractionManagerMixin i -> new PlayerInteractBlockC2SPacket(hand, blockHitResult, i)); } - @Override - public void setBlockHitDelay(int delay) - { - blockBreakingCooldown = delay; - } - @Shadow private void sendSequencedPacket(ClientWorld world, SequencedPacketCreator packetCreator) @@ -185,15 +153,13 @@ public abstract class ClientPlayerInteractionManagerMixin } @Shadow - public abstract ActionResult interactBlock( - ClientPlayerEntity clientPlayerEntity_1, Hand hand_1, - BlockHitResult blockHitResult_1); + public abstract ActionResult interactBlock(ClientPlayerEntity player, + Hand hand, BlockHitResult hitResult); @Shadow - public abstract ActionResult interactItem(PlayerEntity playerEntity_1, - Hand hand_1); + public abstract ActionResult interactItem(PlayerEntity player, Hand hand); @Shadow - public abstract void clickSlot(int syncId, int slotId, int clickData, - SlotActionType actionType, PlayerEntity playerEntity); + public abstract void clickSlot(int syncId, int slotId, int button, + SlotActionType actionType, PlayerEntity player); } diff --git a/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java b/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java new file mode 100644 index 00000000..5a2c5171 --- /dev/null +++ b/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.mixin; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.item.Items; +import net.minecraft.world.GameMode; +import net.wurstclient.WurstClient; + +@Mixin(ClientWorld.class) +public class ClientWorldMixin +{ + @Shadow + @Final + private MinecraftClient client; + + /** + * This is the part that makes BarrierESP work. + */ + @Inject(at = @At("HEAD"), + method = "getBlockParticle()Lnet/minecraft/block/Block;", + cancellable = true) + private void onGetBlockParticle(CallbackInfoReturnable cir) + { + if(!WurstClient.INSTANCE.getHax().barrierEspHack.isEnabled()) + return; + + // Pause BarrierESP when holding a light in Creative Mode, since it + // would otherwise prevent the player from seeing light blocks. + if(client.interactionManager.getCurrentGameMode() == GameMode.CREATIVE + && client.player.getMainHandStack().getItem() == Items.LIGHT) + return; + + cir.setReturnValue(Blocks.BARRIER); + } +} diff --git a/src/main/java/net/wurstclient/mixin/CreativeInventoryScreenMixin.java b/src/main/java/net/wurstclient/mixin/CreativeInventoryScreenMixin.java index eb2718d7..d8326c6c 100644 --- a/src/main/java/net/wurstclient/mixin/CreativeInventoryScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/CreativeInventoryScreenMixin.java @@ -25,10 +25,10 @@ public abstract class CreativeInventoryScreenMixin extends AbstractInventoryScreen { private CreativeInventoryScreenMixin(WurstClient wurst, - CreativeScreenHandler screenHandler, PlayerInventory playerInventory, - Text text) + CreativeScreenHandler screenHandler, PlayerInventory inventory, + Text title) { - super(screenHandler, playerInventory, text); + super(screenHandler, inventory, title); } @Inject(at = @At("HEAD"), diff --git a/src/main/java/net/wurstclient/mixin/CustomPayloadC2SPacketAccessor.java b/src/main/java/net/wurstclient/mixin/CustomPayloadC2SPacketAccessor.java deleted file mode 100644 index e9b6253a..00000000 --- a/src/main/java/net/wurstclient/mixin/CustomPayloadC2SPacketAccessor.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket; -import net.minecraft.util.Identifier; - -/** - * Same as - * {@link net.fabricmc.fabric.mixin.networking.accessor.CustomPayloadC2SPacketAccessor} - * and - * {@link net.fabricmc.fabric.mixin.networking.CustomPayloadC2SPacketAccessor}, - * except that this class doesn't change its package based on what Fabric API - * version you have. - */ -@Mixin(CustomPayloadC2SPacket.class) -public interface CustomPayloadC2SPacketAccessor -{ - @Accessor - Identifier getChannel(); - - @Accessor - PacketByteBuf getData(); -} diff --git a/src/main/java/net/wurstclient/mixin/DeathScreenMixin.java b/src/main/java/net/wurstclient/mixin/DeathScreenMixin.java index 22f8f36d..579ba88b 100644 --- a/src/main/java/net/wurstclient/mixin/DeathScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/DeathScreenMixin.java @@ -14,22 +14,43 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.gui.screen.DeathScreen; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.Text; import net.wurstclient.WurstClient; import net.wurstclient.event.EventManager; import net.wurstclient.events.DeathListener.DeathEvent; +import net.wurstclient.hacks.AutoRespawnHack; @Mixin(DeathScreen.class) public abstract class DeathScreenMixin extends Screen { - private DeathScreenMixin(WurstClient wurst, Text text_1) + private DeathScreenMixin(WurstClient wurst, Text title) { - super(text_1); + super(title); } - @Inject(at = {@At(value = "TAIL")}, method = {"tick()V"}) + @Inject(at = @At("TAIL"), method = "tick()V") private void onTick(CallbackInfo ci) { EventManager.fire(DeathEvent.INSTANCE); } + + @Inject(at = @At("TAIL"), method = "init()V") + private void onInit(CallbackInfo ci) + { + AutoRespawnHack autoRespawn = + WurstClient.INSTANCE.getHax().autoRespawnHack; + + if(!autoRespawn.shouldShowButton()) + return; + + int backButtonX = width / 2 - 100; + int backButtonY = height / 4; + + addDrawableChild( + ButtonWidget.builder(Text.literal("AutoRespawn: OFF"), b -> { + autoRespawn.setEnabled(true); + autoRespawn.onDeath(); + }).dimensions(backButtonX, backButtonY + 48, 200, 20).build()); + } } diff --git a/src/main/java/net/wurstclient/mixin/DirectConnectScreenMixin.java b/src/main/java/net/wurstclient/mixin/DirectConnectScreenMixin.java index 371d0fd1..31a195b8 100644 --- a/src/main/java/net/wurstclient/mixin/DirectConnectScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/DirectConnectScreenMixin.java @@ -28,12 +28,12 @@ public class DirectConnectScreenMixin extends Screen @Final private ServerInfo serverEntry; - private DirectConnectScreenMixin(WurstClient wurst, Text text_1) + private DirectConnectScreenMixin(WurstClient wurst, Text title) { - super(text_1); + super(title); } - @Inject(at = {@At("TAIL")}, method = {"saveAndClose()V"}) + @Inject(at = @At("TAIL"), method = "saveAndClose()V") private void onSaveAndClose(CallbackInfo ci) { LastServerRememberer.setLastServer(serverEntry); diff --git a/src/main/java/net/wurstclient/mixin/DisconnectedRealmsScreenMixin.java b/src/main/java/net/wurstclient/mixin/DisconnectedRealmsScreenMixin.java index eeff30c9..61de4a99 100644 --- a/src/main/java/net/wurstclient/mixin/DisconnectedRealmsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/DisconnectedRealmsScreenMixin.java @@ -36,7 +36,7 @@ public class DisconnectedRealmsScreenMixin extends RealmsScreen super(title); } - @Inject(at = @At("TAIL"), method = {"init()V"}) + @Inject(at = @At("TAIL"), method = "init()V") private void onInit(CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled()) diff --git a/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java b/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java index 6783df71..1d898d90 100644 --- a/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java @@ -19,7 +19,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.gui.screen.DisconnectedScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.gui.widget.GridWidget; +import net.minecraft.client.gui.widget.DirectionalLayoutWidget; import net.minecraft.text.Text; import net.wurstclient.WurstClient; import net.wurstclient.hacks.AutoReconnectHack; @@ -41,14 +41,14 @@ public class DisconnectedScreenMixin extends Screen private Screen parent; @Shadow @Final - private final GridWidget grid = new GridWidget(); + private DirectionalLayoutWidget grid; private DisconnectedScreenMixin(WurstClient wurst, Text title) { super(title); } - @Inject(at = @At("TAIL"), method = {"init()V"}) + @Inject(at = @At("TAIL"), method = "init()V") private void onInit(CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled()) @@ -76,12 +76,12 @@ public class DisconnectedScreenMixin extends Screen ButtonWidget reconnectButton = grid.add( ButtonWidget.builder(Text.literal("Reconnect"), b -> LastServerRememberer.reconnect(parent)).build(), - 3, 0, 1, 1, grid.copyPositioner().margin(2).marginTop(-6)); + grid.copyPositioner().margin(2).marginTop(-6)); autoReconnectButton = grid.add( ButtonWidget.builder(Text.literal("AutoReconnect"), b -> pressAutoReconnect()).build(), - 4, 0, 1, 1, grid.copyPositioner().margin(2)); + grid.copyPositioner().margin(2)); grid.refreshPositions(); Stream.of(reconnectButton, autoReconnectButton) diff --git a/src/main/java/net/wurstclient/mixin/EntityMixin.java b/src/main/java/net/wurstclient/mixin/EntityMixin.java index a0de4770..ef0d9d9c 100644 --- a/src/main/java/net/wurstclient/mixin/EntityMixin.java +++ b/src/main/java/net/wurstclient/mixin/EntityMixin.java @@ -13,17 +13,21 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import net.minecraft.entity.Entity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.server.command.CommandOutput; import net.minecraft.util.Nameable; import net.minecraft.util.math.Vec3d; +import net.minecraft.world.entity.EntityLike; +import net.wurstclient.WurstClient; import net.wurstclient.event.EventManager; import net.wurstclient.events.VelocityFromEntityCollisionListener.VelocityFromEntityCollisionEvent; import net.wurstclient.events.VelocityFromFluidListener.VelocityFromFluidEvent; @Mixin(Entity.class) -public abstract class EntityMixin implements Nameable, CommandOutput +public abstract class EntityMixin implements Nameable, EntityLike, CommandOutput { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setVelocity(Lnet/minecraft/util/math/Vec3d;)V", @@ -52,4 +56,22 @@ public abstract class EntityMixin implements Nameable, CommandOutput if(event.isCancelled()) ci.cancel(); } + + /** + * Makes invisible entities render as ghosts if TrueSight is enabled. + */ + @Inject(at = @At("RETURN"), + method = "Lnet/minecraft/entity/Entity;isInvisibleTo(Lnet/minecraft/entity/player/PlayerEntity;)Z", + cancellable = true) + private void onIsInvisibleTo(PlayerEntity player, + CallbackInfoReturnable cir) + { + // Return early if the entity is not invisible + if(!cir.getReturnValueZ()) + return; + + if(WurstClient.INSTANCE.getHax().trueSightHack + .shouldBeVisible((Entity)(Object)this)) + cir.setReturnValue(false); + } } diff --git a/src/main/java/net/wurstclient/mixin/EntityRendererMixin.java b/src/main/java/net/wurstclient/mixin/EntityRendererMixin.java index 7666fd47..7cf6fd7a 100644 --- a/src/main/java/net/wurstclient/mixin/EntityRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/EntityRendererMixin.java @@ -112,8 +112,5 @@ public abstract class EntityRendererMixin } @Shadow - public TextRenderer getTextRenderer() - { - return null; - } + public abstract TextRenderer getTextRenderer(); } diff --git a/src/main/java/net/wurstclient/mixin/FishingBobberEntityMixin.java b/src/main/java/net/wurstclient/mixin/FishingBobberEntityMixin.java deleted file mode 100644 index 6b5e6129..00000000 --- a/src/main/java/net/wurstclient/mixin/FishingBobberEntityMixin.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import net.minecraft.entity.projectile.FishingBobberEntity; -import net.minecraft.util.math.BlockPos; -import net.wurstclient.mixinterface.IFishingBobberEntity; - -@Mixin(FishingBobberEntity.class) -public abstract class FishingBobberEntityMixin implements IFishingBobberEntity -{ - @Override - public boolean checkOpenWaterAround(BlockPos pos) - { - return isOpenOrWaterAround(pos); - } - - @Shadow - private boolean isOpenOrWaterAround(BlockPos pos) - { - return false; - } -} diff --git a/src/main/java/net/wurstclient/mixin/FluidRendererMixin.java b/src/main/java/net/wurstclient/mixin/FluidRendererMixin.java index b14a79e0..ce119c44 100644 --- a/src/main/java/net/wurstclient/mixin/FluidRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/FluidRendererMixin.java @@ -23,15 +23,19 @@ import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent; @Mixin(FluidRenderer.class) public class FluidRendererMixin { + /** + * This mixin hides and shows fluids when using X-Ray without Sodium + * installed. + */ @Inject(at = @At("HEAD"), method = "isSideCovered(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;FLnet/minecraft/block/BlockState;)Z", cancellable = true) - private static void onIsSideCovered(BlockView blockView, BlockPos blockPos, - Direction direction, float maxDeviation, BlockState blockState, + private static void onIsSideCovered(BlockView world, BlockPos pos, + Direction side, float maxDeviation, BlockState neighboringBlockState, CallbackInfoReturnable cir) { - BlockState state = blockView.getBlockState(blockPos); - ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, blockPos); + BlockState state = world.getBlockState(pos); + ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, pos); EventManager.fire(event); if(event.isRendered() != null) diff --git a/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java b/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java index 9a291f6a..8a8bddb1 100644 --- a/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java @@ -34,14 +34,14 @@ import net.wurstclient.options.WurstOptionsScreen; @Mixin(GameMenuScreen.class) public abstract class GameMenuScreenMixin extends Screen { - private static final Identifier wurstTexture = + private static final Identifier WURST_TEXTURE = new Identifier("wurst", "wurst_128.png"); private ButtonWidget wurstOptionsButton; - private GameMenuScreenMixin(WurstClient wurst, Text text_1) + private GameMenuScreenMixin(WurstClient wurst, Text title) { - super(text_1); + super(title); } @Inject(at = @At("TAIL"), method = "initWidgets()V") @@ -53,6 +53,32 @@ public abstract class GameMenuScreenMixin extends Screen addWurstOptionsButton(); } + @Inject(at = @At("TAIL"), + method = "render(Lnet/minecraft/client/gui/DrawContext;IIF)V") + private void onRender(DrawContext context, int mouseX, int mouseY, + float partialTicks, CallbackInfo ci) + { + if(!WurstClient.INSTANCE.isEnabled() || wurstOptionsButton == null) + return; + + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + RenderSystem.setShaderColor(1, 1, 1, 1); + + int x = wurstOptionsButton.getX() + 34; + int y = wurstOptionsButton.getY() + 2; + int w = 63; + int h = 16; + int fw = 63; + int fh = 16; + float u = 0; + float v = 0; + context.drawTexture(WURST_TEXTURE, x, y, u, v, w, h, fw, fh); + } + private void addWurstOptionsButton() { List buttons = Screens.getButtons(this); @@ -89,6 +115,11 @@ public abstract class GameMenuScreenMixin extends Screen buttons.add(wurstOptionsButton); } + private void openWurstOptions() + { + client.setScreen(new WurstOptionsScreen(this)); + } + private boolean isFeedbackButton(ClickableWidget button) { return hasTrKey(button, "menu.sendFeedback"); @@ -104,35 +135,4 @@ public abstract class GameMenuScreenMixin extends Screen String message = button.getMessage().getString(); return message != null && message.equals(I18n.translate(key)); } - - private void openWurstOptions() - { - client.setScreen(new WurstOptionsScreen(this)); - } - - @Inject(at = @At("TAIL"), - method = "render(Lnet/minecraft/client/gui/DrawContext;IIF)V") - private void onRender(DrawContext context, int mouseX, int mouseY, - float partialTicks, CallbackInfo ci) - { - if(!WurstClient.INSTANCE.isEnabled() || wurstOptionsButton == null) - return; - - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderSystem.setShaderColor(1, 1, 1, 1); - - int x = wurstOptionsButton.getX() + 34; - int y = wurstOptionsButton.getY() + 2; - int w = 63; - int h = 16; - int fw = 63; - int fh = 16; - float u = 0; - float v = 0; - context.drawTexture(wurstTexture, x, y, u, v, w, h, fw, fh); - } } diff --git a/src/main/java/net/wurstclient/mixin/GameRendererMixin.java b/src/main/java/net/wurstclient/mixin/GameRendererMixin.java index 8452a05c..7171764c 100644 --- a/src/main/java/net/wurstclient/mixin/GameRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/GameRendererMixin.java @@ -9,7 +9,6 @@ package net.wurstclient.mixin; import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; @@ -20,8 +19,6 @@ import net.minecraft.client.render.Camera; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; -import net.minecraft.resource.SynchronousResourceReloader; -import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; import net.wurstclient.WurstClient; import net.wurstclient.event.EventManager; @@ -29,11 +26,9 @@ import net.wurstclient.events.CameraTransformViewBobbingListener.CameraTransform import net.wurstclient.events.HitResultRayTraceListener.HitResultRayTraceEvent; import net.wurstclient.events.RenderListener.RenderEvent; import net.wurstclient.hacks.FullbrightHack; -import net.wurstclient.mixinterface.IGameRenderer; @Mixin(GameRenderer.class) -public abstract class GameRendererMixin - implements AutoCloseable, SynchronousResourceReloader, IGameRenderer +public abstract class GameRendererMixin implements AutoCloseable { private boolean cancelNextBobView; @@ -92,10 +87,10 @@ public abstract class GameRendererMixin opcode = Opcodes.GETFIELD, ordinal = 0), method = "renderWorld(FJLnet/minecraft/client/util/math/MatrixStack;)V") - private void onRenderWorld(float partialTicks, long finishTimeNano, - MatrixStack matrixStack, CallbackInfo ci) + private void onRenderWorld(float tickDelta, long limitTime, + MatrixStack matrices, CallbackInfo ci) { - RenderEvent event = new RenderEvent(matrixStack, partialTicks); + RenderEvent event = new RenderEvent(matrices, tickDelta); EventManager.fire(event); } @@ -113,9 +108,9 @@ public abstract class GameRendererMixin target = "Lnet/minecraft/entity/Entity;getCameraPosVec(F)Lnet/minecraft/util/math/Vec3d;", opcode = Opcodes.INVOKEVIRTUAL, ordinal = 0), method = "updateTargetedEntity(F)V") - private void onHitResultRayTrace(float float_1, CallbackInfo ci) + private void onHitResultRayTrace(float tickDelta, CallbackInfo ci) { - HitResultRayTraceEvent event = new HitResultRayTraceEvent(float_1); + HitResultRayTraceEvent event = new HitResultRayTraceEvent(tickDelta); EventManager.fire(event); } @@ -124,10 +119,10 @@ public abstract class GameRendererMixin target = "Lnet/minecraft/util/math/MathHelper;lerp(FFF)F", ordinal = 0), method = "renderWorld(FJLnet/minecraft/client/util/math/MatrixStack;)V") - private float wurstNauseaLerp(float delta, float first, float second) + private float wurstNauseaLerp(float delta, float start, float end) { if(!WurstClient.INSTANCE.getHax().antiWobbleHack.isEnabled()) - return MathHelper.lerp(delta, first, second); + return MathHelper.lerp(delta, start, end); return 0; } @@ -135,8 +130,8 @@ public abstract class GameRendererMixin @Inject(at = @At("HEAD"), method = "getNightVisionStrength(Lnet/minecraft/entity/LivingEntity;F)F", cancellable = true) - private static void onGetNightVisionStrength(LivingEntity livingEntity, - float f, CallbackInfoReturnable cir) + private static void onGetNightVisionStrength(LivingEntity entity, + float tickDelta, CallbackInfoReturnable cir) { FullbrightHack fullbright = WurstClient.INSTANCE.getHax().fullbrightHack; @@ -148,28 +143,10 @@ public abstract class GameRendererMixin @Inject(at = @At("HEAD"), method = "tiltViewWhenHurt(Lnet/minecraft/client/util/math/MatrixStack;F)V", cancellable = true) - private void onTiltViewWhenHurt(MatrixStack matrixStack, float f, + private void onTiltViewWhenHurt(MatrixStack matrices, float tickDelta, CallbackInfo ci) { if(WurstClient.INSTANCE.getHax().noHurtcamHack.isEnabled()) ci.cancel(); } - - @Shadow - private void bobView(MatrixStack matrixStack, float partalTicks) - { - - } - - @Override - public void loadWurstShader(Identifier id) - { - loadPostProcessor(id); - } - - @Shadow - private void loadPostProcessor(Identifier id) - { - - } } diff --git a/src/main/java/net/wurstclient/mixin/InGameOverlayRendererMixin.java b/src/main/java/net/wurstclient/mixin/InGameOverlayRendererMixin.java index 7888e037..20cd33bc 100644 --- a/src/main/java/net/wurstclient/mixin/InGameOverlayRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/InGameOverlayRendererMixin.java @@ -25,18 +25,17 @@ public class InGameOverlayRendererMixin @ModifyConstant( method = "renderFireOverlay(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/util/math/MatrixStack;)V", constant = @Constant(floatValue = -0.3F)) - private static float getFireOffset(float orig) + private static float getFireOffset(float original) { - return orig - WurstClient.INSTANCE.getHax().noFireOverlayHack + return original - WurstClient.INSTANCE.getHax().noFireOverlayHack .getOverlayOffset(); } @Inject(at = @At("HEAD"), method = "renderUnderwaterOverlay(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/util/math/MatrixStack;)V", cancellable = true) - private static void onRenderUnderwaterOverlay( - MinecraftClient minecraftClient, MatrixStack matrixStack, - CallbackInfo ci) + private static void onRenderUnderwaterOverlay(MinecraftClient client, + MatrixStack matrices, CallbackInfo ci) { if(WurstClient.INSTANCE.getHax().noOverlayHack.isEnabled()) ci.cancel(); diff --git a/src/main/java/net/wurstclient/mixin/IngameHudMixin.java b/src/main/java/net/wurstclient/mixin/IngameHudMixin.java index 76457ac4..dafbd19e 100644 --- a/src/main/java/net/wurstclient/mixin/IngameHudMixin.java +++ b/src/main/java/net/wurstclient/mixin/IngameHudMixin.java @@ -7,12 +7,15 @@ */ package net.wurstclient.mixin; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.hud.DebugHud; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.util.Identifier; import net.wurstclient.WurstClient; @@ -22,20 +25,22 @@ import net.wurstclient.events.GUIRenderListener.GUIRenderEvent; @Mixin(InGameHud.class) public class IngameHudMixin { + @Shadow + @Final + private DebugHud debugHud; + @Inject( at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;enableBlend()V", remap = false, ordinal = 3), method = "render(Lnet/minecraft/client/gui/DrawContext;F)V") - private void onRender(DrawContext context, float partialTicks, - CallbackInfo ci) + private void onRender(DrawContext context, float tickDelta, CallbackInfo ci) { - if(WurstClient.MC.options.debugEnabled) + if(debugHud.shouldShowDebugHud()) return; - GUIRenderEvent event = new GUIRenderEvent(context, partialTicks); - EventManager.fire(event); + EventManager.fire(new GUIRenderEvent(context, tickDelta)); } @Inject(at = @At("HEAD"), @@ -44,15 +49,11 @@ public class IngameHudMixin private void onRenderOverlay(DrawContext context, Identifier texture, float opacity, CallbackInfo ci) { - if(texture == null || texture.getPath() == null) + if(texture == null + || !"textures/misc/pumpkinblur.png".equals(texture.getPath())) return; - if(!texture.getPath().equals("textures/misc/pumpkinblur.png")) - return; - - if(!WurstClient.INSTANCE.getHax().noPumpkinHack.isEnabled()) - return; - - ci.cancel(); + if(WurstClient.INSTANCE.getHax().noPumpkinHack.isEnabled()) + ci.cancel(); } } diff --git a/src/main/java/net/wurstclient/mixin/KeyboardMixin.java b/src/main/java/net/wurstclient/mixin/KeyboardMixin.java index 449a8c23..9ab6a055 100644 --- a/src/main/java/net/wurstclient/mixin/KeyboardMixin.java +++ b/src/main/java/net/wurstclient/mixin/KeyboardMixin.java @@ -20,12 +20,9 @@ import net.wurstclient.events.KeyPressListener.KeyPressEvent; public class KeyboardMixin { @Inject(at = @At("HEAD"), method = "onKey(JIIII)V") - private void onOnKey(long windowHandle, int keyCode, int scanCode, - int action, int modifiers, CallbackInfo ci) + private void onOnKey(long windowHandle, int key, int scancode, int action, + int modifiers, CallbackInfo ci) { - KeyPressEvent event = - new KeyPressEvent(keyCode, scanCode, action, modifiers); - - EventManager.fire(event); + EventManager.fire(new KeyPressEvent(key, scancode, action, modifiers)); } } diff --git a/src/main/java/net/wurstclient/mixin/LanguageManagerMixin.java b/src/main/java/net/wurstclient/mixin/LanguageManagerMixin.java index 87d18716..5a5471b1 100644 --- a/src/main/java/net/wurstclient/mixin/LanguageManagerMixin.java +++ b/src/main/java/net/wurstclient/mixin/LanguageManagerMixin.java @@ -24,19 +24,19 @@ import net.wurstclient.mixinterface.ILanguageManager; public abstract class LanguageManagerMixin implements SynchronousResourceReloader, ILanguageManager { - private TranslationStorage english; + private TranslationStorage wurstEnglish; - @Inject(at = {@At("HEAD")}, - method = {"reload(Lnet/minecraft/resource/ResourceManager;)V"}) + @Inject(at = @At("HEAD"), + method = "reload(Lnet/minecraft/resource/ResourceManager;)V") private void onReload(ResourceManager manager, CallbackInfo ci) { - english = TranslationStorage.load(manager, Lists.newArrayList("en_us"), - false); + wurstEnglish = TranslationStorage.load(manager, + Lists.newArrayList("en_us"), false); } @Override - public TranslationStorage getEnglish() + public TranslationStorage wurst_getEnglish() { - return english; + return wurstEnglish; } } diff --git a/src/main/java/net/wurstclient/mixin/LightTextureManagerMixin.java b/src/main/java/net/wurstclient/mixin/LightTextureManagerMixin.java deleted file mode 100644 index 8286721c..00000000 --- a/src/main/java/net/wurstclient/mixin/LightTextureManagerMixin.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import net.minecraft.client.render.LightmapTextureManager; -import net.wurstclient.WurstClient; - -@Mixin(LightmapTextureManager.class) -public class LightTextureManagerMixin -{ - @Inject(at = {@At("HEAD")}, - method = {"getDarknessFactor(F)F"}, - cancellable = true) - private void onGetDarknessFactor(float delta, - CallbackInfoReturnable ci) - { - if(WurstClient.INSTANCE.getHax().antiBlindHack.isEnabled()) - ci.setReturnValue(0F); - } -} diff --git a/src/main/java/net/wurstclient/mixin/LivingEntityRendererMixin.java b/src/main/java/net/wurstclient/mixin/LivingEntityRendererMixin.java index 117f1d8d..86e5b45e 100644 --- a/src/main/java/net/wurstclient/mixin/LivingEntityRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/LivingEntityRendererMixin.java @@ -17,27 +17,11 @@ import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.LivingEntityRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; import net.wurstclient.WurstClient; @Mixin(LivingEntityRenderer.class) public abstract class LivingEntityRendererMixin { - /** - * Makes invisible entities render as ghosts if TrueSight is enabled. - */ - @Redirect(at = @At(value = "INVOKE", - target = "Lnet/minecraft/entity/LivingEntity;isInvisibleTo(Lnet/minecraft/entity/player/PlayerEntity;)Z", - ordinal = 0), - method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V") - private boolean isInvisibleToWurst(LivingEntity e, PlayerEntity player) - { - if(WurstClient.INSTANCE.getHax().trueSightHack.isEnabled()) - return false; - - return e.isInvisibleTo(player); - } - /** * Disables the distance limit in hasLabel() if configured in NameTags. */ @@ -61,7 +45,7 @@ public abstract class LivingEntityRendererMixin ordinal = 0), method = "hasLabel(Lnet/minecraft/entity/LivingEntity;)Z", cancellable = true) - private void shouldForceLabel(LivingEntity e, + private void shouldForceLabel(LivingEntity entity, CallbackInfoReturnable cir) { // return true immediately after the distance check diff --git a/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java b/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java index fa87c330..c12af428 100644 --- a/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java +++ b/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java @@ -10,16 +10,15 @@ package net.wurstclient.mixin; import java.io.File; import java.util.UUID; -import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import com.mojang.authlib.GameProfile; import com.mojang.authlib.exceptions.AuthenticationException; import com.mojang.authlib.minecraft.UserApiService; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; @@ -28,12 +27,9 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.WindowEventHandler; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerInteractionManager; -import net.minecraft.client.resource.language.LanguageManager; -import net.minecraft.client.util.ProfileKeys; -import net.minecraft.client.util.ProfileKeysImpl; -import net.minecraft.client.util.Session; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.entity.Entity; +import net.minecraft.client.session.ProfileKeys; +import net.minecraft.client.session.ProfileKeysImpl; +import net.minecraft.client.session.Session; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.thread.ReentrantThreadExecutor; @@ -43,10 +39,7 @@ import net.wurstclient.events.LeftClickListener.LeftClickEvent; import net.wurstclient.events.RightClickListener.RightClickEvent; import net.wurstclient.mixinterface.IClientPlayerEntity; import net.wurstclient.mixinterface.IClientPlayerInteractionManager; -import net.wurstclient.mixinterface.ILanguageManager; import net.wurstclient.mixinterface.IMinecraftClient; -import net.wurstclient.mixinterface.IWorld; -import net.wurstclient.other_features.NoTelemetryOtf; @Mixin(MinecraftClient.class) public abstract class MinecraftClientMixin @@ -57,19 +50,9 @@ public abstract class MinecraftClientMixin @Final public File runDirectory; @Shadow - private int itemUseCooldown; + public ClientPlayerInteractionManager interactionManager; @Shadow - private ClientPlayerInteractionManager interactionManager; - @Shadow - @Final - private LanguageManager languageManager; - @Shadow - private ClientPlayerEntity player; - @Shadow - public ClientWorld world; - @Shadow - @Final - private Session session; + public ClientPlayerEntity player; @Shadow @Final private YggdrasilAuthenticationService authenticationService; @@ -77,14 +60,14 @@ public abstract class MinecraftClientMixin private Session wurstSession; private ProfileKeysImpl wurstProfileKeys; - private MinecraftClientMixin(WurstClient wurst, String string_1) + private MinecraftClientMixin(WurstClient wurst, String name) { - super(string_1); + super(name); } - @Inject(at = {@At(value = "FIELD", + @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;crosshairTarget:Lnet/minecraft/util/hit/HitResult;", - ordinal = 0)}, method = {"doAttack()Z"}, cancellable = true) + ordinal = 0), method = "doAttack()Z", cancellable = true) private void onDoAttack(CallbackInfoReturnable cir) { LeftClickEvent event = new LeftClickEvent(); @@ -94,9 +77,12 @@ public abstract class MinecraftClientMixin cir.setReturnValue(false); } - @Inject(at = {@At(value = "FIELD", - target = "Lnet/minecraft/client/MinecraftClient;itemUseCooldown:I", - ordinal = 0)}, method = {"doItemUse()V"}, cancellable = true) + @Inject( + at = @At(value = "FIELD", + target = "Lnet/minecraft/client/MinecraftClient;itemUseCooldown:I", + ordinal = 0), + method = "doItemUse()V", + cancellable = true) private void onDoItemUse(CallbackInfo ci) { RightClickEvent event = new RightClickEvent(); @@ -106,47 +92,45 @@ public abstract class MinecraftClientMixin ci.cancel(); } - @Inject(at = {@At("HEAD")}, method = {"doItemPick()V"}) + @Inject(at = @At("HEAD"), method = "doItemPick()V") private void onDoItemPick(CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled()) return; HitResult hitResult = WurstClient.MC.crosshairTarget; - if(hitResult == null || hitResult.getType() != HitResult.Type.ENTITY) + if(!(hitResult instanceof EntityHitResult eHitResult)) return; - Entity entity = ((EntityHitResult)hitResult).getEntity(); - WurstClient.INSTANCE.getFriends().middleClick(entity); + WurstClient.INSTANCE.getFriends().middleClick(eHitResult.getEntity()); } @Inject(at = @At("HEAD"), - method = {"getSession()Lnet/minecraft/client/util/Session;"}, + method = "getSession()Lnet/minecraft/client/session/Session;", cancellable = true) private void onGetSession(CallbackInfoReturnable cir) + { + if(wurstSession != null) + cir.setReturnValue(wurstSession); + } + + @Inject(at = @At("RETURN"), + method = "getGameProfile()Lcom/mojang/authlib/GameProfile;", + cancellable = true) + public void onGetGameProfile(CallbackInfoReturnable cir) { if(wurstSession == null) return; - cir.setReturnValue(wurstSession); - } - - @Redirect(at = @At(value = "FIELD", - target = "Lnet/minecraft/client/MinecraftClient;session:Lnet/minecraft/client/util/Session;", - opcode = Opcodes.GETFIELD, - ordinal = 0), - method = { - "getSessionProperties()Lcom/mojang/authlib/properties/PropertyMap;"}) - private Session getSessionForSessionProperties(MinecraftClient mc) - { - if(wurstSession != null) - return wurstSession; - - return session; + GameProfile oldProfile = cir.getReturnValue(); + GameProfile newProfile = new GameProfile(wurstSession.getUuidOrNull(), + wurstSession.getUsername()); + newProfile.getProperties().putAll(oldProfile.getProperties()); + cir.setReturnValue(newProfile); } @Inject(at = @At("HEAD"), - method = {"getProfileKeys()Lnet/minecraft/client/util/ProfileKeys;"}, + method = "getProfileKeys()Lnet/minecraft/client/session/ProfileKeys;", cancellable = true) private void onGetProfileKeys(CallbackInfoReturnable cir) { @@ -164,9 +148,8 @@ public abstract class MinecraftClientMixin cancellable = true) private void onIsTelemetryEnabledByApi(CallbackInfoReturnable cir) { - NoTelemetryOtf noTelemetryOtf = - WurstClient.INSTANCE.getOtfs().noTelemetryOtf; - cir.setReturnValue(!noTelemetryOtf.isEnabled()); + cir.setReturnValue( + !WurstClient.INSTANCE.getOtfs().noTelemetryOtf.isEnabled()); } @Inject(at = @At("HEAD"), @@ -175,27 +158,8 @@ public abstract class MinecraftClientMixin private void onIsOptionalTelemetryEnabledByApi( CallbackInfoReturnable cir) { - NoTelemetryOtf noTelemetryOtf = - WurstClient.INSTANCE.getOtfs().noTelemetryOtf; - cir.setReturnValue(!noTelemetryOtf.isEnabled()); - } - - @Override - public void rightClick() - { - doItemUse(); - } - - @Override - public int getItemUseCooldown() - { - return itemUseCooldown; - } - - @Override - public void setItemUseCooldown(int itemUseCooldown) - { - this.itemUseCooldown = itemUseCooldown; + cir.setReturnValue( + !WurstClient.INSTANCE.getOtfs().noTelemetryOtf.isEnabled()); } @Override @@ -204,24 +168,12 @@ public abstract class MinecraftClientMixin return (IClientPlayerEntity)player; } - @Override - public IWorld getWorld() - { - return (IWorld)world; - } - @Override public IClientPlayerInteractionManager getInteractionManager() { return (IClientPlayerInteractionManager)interactionManager; } - @Override - public ILanguageManager getLanguageManager() - { - return (ILanguageManager)languageManager; - } - @Override public void setSession(Session session) { @@ -229,7 +181,7 @@ public abstract class MinecraftClientMixin UserApiService userApiService = wurst_createUserApiService(session.getAccessToken()); - UUID uuid = wurstSession.getProfile().getId(); + UUID uuid = wurstSession.getUuidOrNull(); wurstProfileKeys = new ProfileKeysImpl(userApiService, uuid, runDirectory.toPath()); } @@ -246,10 +198,4 @@ public abstract class MinecraftClientMixin return UserApiService.OFFLINE; } } - - @Shadow - private void doItemUse() - { - - } } diff --git a/src/main/java/net/wurstclient/mixin/MiningToolItemMixin.java b/src/main/java/net/wurstclient/mixin/MiningToolItemMixin.java deleted file mode 100644 index bef213a1..00000000 --- a/src/main/java/net/wurstclient/mixin/MiningToolItemMixin.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixin; - -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import com.google.common.collect.Multimap; - -import net.minecraft.entity.attribute.EntityAttribute; -import net.minecraft.entity.attribute.EntityAttributeModifier; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.item.MiningToolItem; -import net.minecraft.item.ToolItem; -import net.minecraft.item.ToolMaterial; -import net.wurstclient.WurstClient; -import net.wurstclient.mixinterface.IMiningToolItem; - -@Mixin(MiningToolItem.class) -public class MiningToolItemMixin extends ToolItem implements IMiningToolItem -{ - @Shadow - @Final - protected float attackDamage; - - @Shadow - @Final - private Multimap attributeModifiers; - - private MiningToolItemMixin(WurstClient wurst, ToolMaterial material, - Settings settings) - { - super(material, settings); - } - - @Override - public float fuckMcAfee1() - { - return attackDamage; - } - - @Override - public float fuckMcAfee2() - { - return (float)attributeModifiers - .get(EntityAttributes.GENERIC_ATTACK_SPEED).iterator().next() - .getValue(); - } -} diff --git a/src/main/java/net/wurstclient/mixin/MouseMixin.java b/src/main/java/net/wurstclient/mixin/MouseMixin.java index 3ce4adbb..c6e6d5f8 100644 --- a/src/main/java/net/wurstclient/mixin/MouseMixin.java +++ b/src/main/java/net/wurstclient/mixin/MouseMixin.java @@ -19,11 +19,10 @@ import net.wurstclient.events.MouseScrollListener.MouseScrollEvent; @Mixin(Mouse.class) public class MouseMixin { - @Inject(at = {@At("RETURN")}, method = {"onMouseScroll(JDD)V"}) - private void onOnMouseScroll(long long_1, double double_1, double double_2, - CallbackInfo ci) + @Inject(at = @At("RETURN"), method = "onMouseScroll(JDD)V") + private void onOnMouseScroll(long window, double horizontal, + double vertical, CallbackInfo ci) { - MouseScrollEvent event = new MouseScrollEvent(double_2); - EventManager.fire(event); + EventManager.fire(new MouseScrollEvent(vertical)); } } diff --git a/src/main/java/net/wurstclient/mixin/MultiplayerScreenMixin.java b/src/main/java/net/wurstclient/mixin/MultiplayerScreenMixin.java index cd5528be..9a946565 100644 --- a/src/main/java/net/wurstclient/mixin/MultiplayerScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/MultiplayerScreenMixin.java @@ -33,24 +33,12 @@ public class MultiplayerScreenMixin extends Screen implements IMultiplayerScreen private ButtonWidget lastServerButton; - private MultiplayerScreenMixin(WurstClient wurst, Text text_1) + private MultiplayerScreenMixin(WurstClient wurst, Text title) { - super(text_1); + super(title); } - @Override - public MultiplayerServerListWidget getServerListSelector() - { - return serverListWidget; - } - - @Override - public void connectToServer(ServerInfo server) - { - connect(server); - } - - @Inject(at = {@At("TAIL")}, method = {"init()V"}) + @Inject(at = @At("TAIL"), method = "init()V") private void onInit(CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled()) @@ -67,17 +55,17 @@ public class MultiplayerScreenMixin extends Screen implements IMultiplayerScreen .builder(Text.literal("Server Finder"), b -> client.setScreen(new ServerFinderScreen( (MultiplayerScreen)(Object)this))) - .dimensions(width / 2 + 154 + 4, height - 52, 100, 20).build()); + .dimensions(width / 2 + 154 + 4, height - 54, 100, 20).build()); addDrawableChild(ButtonWidget .builder(Text.literal("Clean Up"), b -> client.setScreen( new CleanUpScreen((MultiplayerScreen)(Object)this))) - .dimensions(width / 2 + 154 + 4, height - 28, 100, 20).build()); + .dimensions(width / 2 + 154 + 4, height - 30, 100, 20).build()); } - @Inject(at = {@At("TAIL")}, method = {"tick()V"}) - public void onTick(CallbackInfo ci) + @Inject(at = @At("TAIL"), method = "tick()V") + private void onTick(CallbackInfo ci) { if(lastServerButton == null) return; @@ -85,13 +73,25 @@ public class MultiplayerScreenMixin extends Screen implements IMultiplayerScreen lastServerButton.active = LastServerRememberer.getLastServer() != null; } - @Inject(at = {@At("HEAD")}, - method = {"connect(Lnet/minecraft/client/network/ServerInfo;)V"}) + @Inject(at = @At("HEAD"), + method = "connect(Lnet/minecraft/client/network/ServerInfo;)V") private void onConnect(ServerInfo entry, CallbackInfo ci) { LastServerRememberer.setLastServer(entry); } + @Override + public MultiplayerServerListWidget getServerListSelector() + { + return serverListWidget; + } + + @Override + public void connectToServer(ServerInfo server) + { + connect(server); + } + @Shadow private void connect(ServerInfo entry) { diff --git a/src/main/java/net/wurstclient/mixin/PlayerInventoryMixin.java b/src/main/java/net/wurstclient/mixin/PlayerInventoryMixin.java index bd76b87f..f4e06c0d 100644 --- a/src/main/java/net/wurstclient/mixin/PlayerInventoryMixin.java +++ b/src/main/java/net/wurstclient/mixin/PlayerInventoryMixin.java @@ -18,12 +18,11 @@ import net.wurstclient.WurstClient; @Mixin(PlayerInventory.class) public class PlayerInventoryMixin { - @Inject(at = {@At("HEAD")}, - method = {"scrollInHotbar(D)V"}, - cancellable = true) + @Inject(at = @At("HEAD"), method = "scrollInHotbar(D)V", cancellable = true) private void onScrollInHotbar(double scrollAmount, CallbackInfo ci) { - if(WurstClient.INSTANCE.getZoomKey().isPressed()) + if(WurstClient.INSTANCE.getOtfs().zoomOtf + .shouldPreventHotbarScrolling()) ci.cancel(); } } diff --git a/src/main/java/net/wurstclient/mixin/PlayerSkinProviderMixin.java b/src/main/java/net/wurstclient/mixin/PlayerSkinProviderMixin.java index ebd56e03..15252539 100644 --- a/src/main/java/net/wurstclient/mixin/PlayerSkinProviderMixin.java +++ b/src/main/java/net/wurstclient/mixin/PlayerSkinProviderMixin.java @@ -9,104 +9,33 @@ package net.wurstclient.mixin; import java.io.InputStreamReader; import java.net.URL; -import java.util.HashMap; +import java.util.concurrent.CompletableFuture; -import javax.annotation.Nullable; - -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.ModifyVariable; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Maps; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.mojang.authlib.GameProfile; -import com.mojang.authlib.minecraft.InsecurePublicKeyException; import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; -import com.mojang.authlib.minecraft.MinecraftSessionService; -import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.texture.PlayerSkinProvider; -import net.minecraft.util.Identifier; -import net.minecraft.util.Util; +import net.minecraft.client.texture.PlayerSkinProvider.Textures; +import net.minecraft.client.util.SkinTextures; @Mixin(PlayerSkinProvider.class) -public class PlayerSkinProviderMixin +public abstract class PlayerSkinProviderMixin { - @Shadow - @Final - private MinecraftSessionService sessionService; - private static JsonObject capes; + private MinecraftProfileTexture currentCape; @Inject(at = @At("HEAD"), - method = "loadSkin(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$SkinTextureAvailableCallback;Z)V", - cancellable = true) - private void onLoadSkin(GameProfile profile, - PlayerSkinProvider.SkinTextureAvailableCallback callback, - boolean requireSecure, CallbackInfo ci) - { - // Can't @Inject nicely because everything is wrapped in a lambda. - // Had to replace the whole method. - - Runnable runnable = () -> { - HashMap map = - Maps.newHashMap(); - try - { - map.putAll(sessionService.getTextures(profile, requireSecure)); - }catch(InsecurePublicKeyException e) - { - // empty catch block - } - if(map.isEmpty()) - { - profile.getProperties().clear(); - if(profile.getId().equals(MinecraftClient.getInstance() - .getSession().getProfile().getId())) - { - profile.getProperties().putAll( - MinecraftClient.getInstance().getSessionProperties()); - map.putAll(sessionService.getTextures(profile, false)); - }else - { - sessionService.fillProfileProperties(profile, - requireSecure); - try - { - map.putAll( - sessionService.getTextures(profile, requireSecure)); - }catch(InsecurePublicKeyException e) - { - - } - } - } - - addWurstCape(profile, map); - - MinecraftClient.getInstance().execute(() -> { - RenderSystem.recordRenderCall(() -> { - ImmutableList.of(Type.SKIN, Type.CAPE).forEach(type -> { - if(map.containsKey(type)) - loadSkin(map.get(type), type, callback); - }); - }); - }); - }; - Util.getMainWorkerExecutor().execute(runnable); - - ci.cancel(); - } - - private void addWurstCape(GameProfile profile, - HashMap map) + method = "fetchSkinTextures(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$Textures;)Ljava/util/concurrent/CompletableFuture;") + private void onFetchSkinTextures(GameProfile profile, Textures textures, + CallbackInfoReturnable> cir) { String name = profile.getName(); String uuid = profile.getId().toString(); @@ -119,13 +48,15 @@ public class PlayerSkinProviderMixin if(capes.has(name)) { String capeURL = capes.get(name).getAsString(); - map.put(Type.CAPE, new MinecraftProfileTexture(capeURL, null)); + currentCape = new MinecraftProfileTexture(capeURL, null); }else if(capes.has(uuid)) { String capeURL = capes.get(uuid).getAsString(); - map.put(Type.CAPE, new MinecraftProfileTexture(capeURL, null)); - } + currentCape = new MinecraftProfileTexture(capeURL, null); + + }else + currentCape = null; }catch(Exception e) { @@ -136,6 +67,21 @@ public class PlayerSkinProviderMixin } } + @ModifyVariable(at = @At("STORE"), + method = "fetchSkinTextures(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$Textures;)Ljava/util/concurrent/CompletableFuture;", + ordinal = 1, + name = "minecraftProfileTexture2") + private MinecraftProfileTexture modifyCapeTexture( + MinecraftProfileTexture old) + { + if(currentCape == null) + return old; + + MinecraftProfileTexture result = currentCape; + currentCape = null; + return result; + } + private void setupWurstCapes() { try @@ -155,12 +101,4 @@ public class PlayerSkinProviderMixin e.printStackTrace(); } } - - @Shadow - public Identifier loadSkin(MinecraftProfileTexture profileTexture, - Type type, - @Nullable PlayerSkinProvider.SkinTextureAvailableCallback callback) - { - return null; - } } diff --git a/src/main/java/net/wurstclient/mixin/PowderSnowBlockMixin.java b/src/main/java/net/wurstclient/mixin/PowderSnowBlockMixin.java index fdf6776c..9850818e 100644 --- a/src/main/java/net/wurstclient/mixin/PowderSnowBlockMixin.java +++ b/src/main/java/net/wurstclient/mixin/PowderSnowBlockMixin.java @@ -27,8 +27,8 @@ public abstract class PowderSnowBlockMixin extends Block super(settings); } - @Inject(at = {@At("HEAD")}, - method = {"canWalkOnPowderSnow(Lnet/minecraft/entity/Entity;)Z"}, + @Inject(at = @At("HEAD"), + method = "canWalkOnPowderSnow(Lnet/minecraft/entity/Entity;)Z", cancellable = true) private static void onCanWalkOnPowderSnow(Entity entity, CallbackInfoReturnable cir) @@ -36,9 +36,7 @@ public abstract class PowderSnowBlockMixin extends Block if(!WurstClient.INSTANCE.getHax().snowShoeHack.isEnabled()) return; - if(entity != WurstClient.MC.player) - return; - - cir.setReturnValue(true); + if(entity == WurstClient.MC.player) + cir.setReturnValue(true); } } diff --git a/src/main/java/net/wurstclient/mixin/RenderTickCounterMixin.java b/src/main/java/net/wurstclient/mixin/RenderTickCounterMixin.java index 5bf2e4c4..bf520849 100644 --- a/src/main/java/net/wurstclient/mixin/RenderTickCounterMixin.java +++ b/src/main/java/net/wurstclient/mixin/RenderTickCounterMixin.java @@ -16,22 +16,21 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import net.minecraft.client.render.RenderTickCounter; import net.wurstclient.WurstClient; -import net.wurstclient.hacks.TimerHack; @Mixin(RenderTickCounter.class) public abstract class RenderTickCounterMixin { @Shadow - private float lastFrameDuration; + public float lastFrameDuration; - @Inject(at = {@At(value = "FIELD", + @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/RenderTickCounter;prevTimeMillis:J", opcode = Opcodes.PUTFIELD, - ordinal = 0)}, method = {"beginRenderTick(J)I"}) - public void onBeginRenderTick(long long_1, + ordinal = 0), method = "beginRenderTick(J)I") + public void onBeginRenderTick(long timeMillis, CallbackInfoReturnable cir) { - TimerHack timerHack = WurstClient.INSTANCE.getHax().timerHack; - lastFrameDuration *= timerHack.getTimerSpeed(); + lastFrameDuration *= + WurstClient.INSTANCE.getHax().timerHack.getTimerSpeed(); } } diff --git a/src/main/java/net/wurstclient/mixin/ScreenMixin.java b/src/main/java/net/wurstclient/mixin/ScreenMixin.java index 31c44b1e..0fbfe244 100644 --- a/src/main/java/net/wurstclient/mixin/ScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/ScreenMixin.java @@ -7,11 +7,7 @@ */ package net.wurstclient.mixin; -import java.util.List; - -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -21,29 +17,19 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.wurstclient.WurstClient; -import net.wurstclient.mixinterface.IScreen; @Mixin(Screen.class) public abstract class ScreenMixin extends AbstractParentElement - implements Drawable, IScreen + implements Drawable { - @Shadow - @Final - private List drawables; - @Inject(at = @At("HEAD"), - method = "renderBackground(Lnet/minecraft/client/gui/DrawContext;)V", + method = "renderBackground(Lnet/minecraft/client/gui/DrawContext;IIF)V", cancellable = true) - public void onRenderBackground(DrawContext context, CallbackInfo ci) + public void onRenderBackground(DrawContext context, int mouseX, int mouseY, + float partialTicks, CallbackInfo ci) { if(WurstClient.INSTANCE.getHax().noBackgroundHack .shouldCancelBackground((Screen)(Object)this)) ci.cancel(); } - - @Override - public List getButtons() - { - return drawables; - } } diff --git a/src/main/java/net/wurstclient/mixin/ServerListMixin.java b/src/main/java/net/wurstclient/mixin/ServerListMixin.java deleted file mode 100644 index 8b3bd265..00000000 --- a/src/main/java/net/wurstclient/mixin/ServerListMixin.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixin; - -import java.util.List; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import net.minecraft.client.network.ServerInfo; -import net.minecraft.client.option.ServerList; -import net.wurstclient.mixinterface.IServerList; - -@Mixin(ServerList.class) -public class ServerListMixin implements IServerList -{ - @Shadow - private List servers; - - @Override - public void clear() - { - servers.clear(); - } -} diff --git a/src/main/java/net/wurstclient/mixin/ShulkerBoxScreenMixin.java b/src/main/java/net/wurstclient/mixin/ShulkerBoxScreenMixin.java index 66b7b95f..a25432f4 100644 --- a/src/main/java/net/wurstclient/mixin/ShulkerBoxScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/ShulkerBoxScreenMixin.java @@ -10,7 +10,6 @@ package net.wurstclient.mixin; import org.spongepowered.asm.mixin.Mixin; import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; import net.minecraft.client.gui.screen.ingame.ShulkerBoxScreen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.entity.player.PlayerInventory; @@ -24,7 +23,6 @@ import net.wurstclient.hacks.AutoStealHack; @Mixin(ShulkerBoxScreen.class) public abstract class ShulkerBoxScreenMixin extends HandledScreen - implements ScreenHandlerProvider { private final int rows = 3; @@ -32,11 +30,10 @@ public abstract class ShulkerBoxScreenMixin WurstClient.INSTANCE.getHax().autoStealHack; private int mode; - public ShulkerBoxScreenMixin(WurstClient wurst, - ShulkerBoxScreenHandler container, PlayerInventory playerInventory, - Text name) + private ShulkerBoxScreenMixin(WurstClient wurst, + ShulkerBoxScreenHandler handler, PlayerInventory inventory, Text title) { - super(container, playerInventory, name); + super(handler, inventory, title); } @Override diff --git a/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java b/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java index 44e64d9a..cd36e13c 100644 --- a/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java +++ b/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java @@ -18,24 +18,26 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockView; import net.wurstclient.event.EventManager; -import net.wurstclient.events.ShouldDrawSideListener; +import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent; @Pseudo @Mixin(targets = { + // current target "me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache", + // < Sodium 0.5.0 "me.jellysquid.mods.sodium.client.render.occlusion.BlockOcclusionCache"}, remap = false) public class SodiumBlockOcclusionCacheMixin { - @Inject(at = @At("HEAD"), - method = "shouldDrawSide", - cancellable = true, - remap = false) - public void shouldDrawSide(BlockState state, BlockView view, BlockPos pos, - Direction facing, CallbackInfoReturnable cir) + /** + * This mixin hides and shows regular full blocks when using X-Ray with + * Sodium installed. + */ + @Inject(at = @At("HEAD"), method = "shouldDrawSide", cancellable = true) + public void shouldDrawSide(BlockState state, BlockView world, BlockPos pos, + Direction side, CallbackInfoReturnable cir) { - ShouldDrawSideListener.ShouldDrawSideEvent event = - new ShouldDrawSideListener.ShouldDrawSideEvent(state, pos); + ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, pos); EventManager.fire(event); if(event.isRendered() != null) diff --git a/src/main/java/net/wurstclient/mixin/SodiumFluidRendererMixin.java b/src/main/java/net/wurstclient/mixin/SodiumFluidRendererMixin.java new file mode 100644 index 00000000..550debc1 --- /dev/null +++ b/src/main/java/net/wurstclient/mixin/SodiumFluidRendererMixin.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.BlockRenderView; +import net.wurstclient.event.EventManager; +import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent; + +@Pseudo +@Mixin(targets = { + // current target + "me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.FluidRenderer", + // < Sodium 0.4.9 + "me.jellysquid.mods.sodium.client.render.pipeline.FluidRenderer"}, + remap = false) +public class SodiumFluidRendererMixin +{ + /** + * This mixin hides and shows fluids when using X-Ray with Sodium installed. + */ + @Inject(at = @At("HEAD"), method = "isSideExposed", cancellable = true) + private void isSideExposed(BlockRenderView world, int x, int y, int z, + Direction dir, float height, CallbackInfoReturnable cir) + { + BlockPos pos = new BlockPos(x, y, z); + BlockState state = world.getBlockState(pos); + ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, pos); + EventManager.fire(event); + + if(event.isRendered() != null) + cir.setReturnValue(event.isRendered()); + } +} diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 31ba96df..464c5ae3 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import net.minecraft.client.gui.Drawable; +import net.fabricmc.fabric.api.client.screen.v1.Screens; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.StatsListener; import net.minecraft.client.gui.screen.StatsScreen; @@ -21,17 +21,16 @@ import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.resource.language.I18n; import net.minecraft.text.Text; import net.wurstclient.WurstClient; -import net.wurstclient.mixinterface.IScreen; @Mixin(StatsScreen.class) public abstract class StatsScreenMixin extends Screen implements StatsListener { - private StatsScreenMixin(WurstClient wurst, Text text_1) + private StatsScreenMixin(WurstClient wurst, Text title) { - super(text_1); + super(title); } - @Inject(at = {@At("TAIL")}, method = {"createButtons()V"}) + @Inject(at = @At("TAIL"), method = "createButtons()V") private void onCreateButtons(CallbackInfo ci) { if(WurstClient.INSTANCE.getOtfs().disableOtf.shouldHideEnableButton()) @@ -44,13 +43,8 @@ public abstract class StatsScreenMixin extends Screen implements StatsListener updateWurstButtonText(toggleWurstButton); addDrawableChild(toggleWurstButton); - for(Drawable d : ((IScreen)this).getButtons()) + for(ClickableWidget button : Screens.getButtons(this)) { - if(!(d instanceof ClickableWidget)) - continue; - - ClickableWidget button = (ClickableWidget)d; - if(!button.getMessage().getString() .equals(I18n.translate("gui.done"))) continue; diff --git a/src/main/java/net/wurstclient/mixin/StatusEffectInstanceMixin.java b/src/main/java/net/wurstclient/mixin/StatusEffectInstanceMixin.java index ac95afc5..2c70cdc4 100644 --- a/src/main/java/net/wurstclient/mixin/StatusEffectInstanceMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatusEffectInstanceMixin.java @@ -23,9 +23,7 @@ public abstract class StatusEffectInstanceMixin @Shadow private int duration; - @Inject(at = {@At("HEAD")}, - method = {"updateDuration()I"}, - cancellable = true) + @Inject(at = @At("HEAD"), method = "updateDuration()I", cancellable = true) private void onUpdateDuration(CallbackInfoReturnable cir) { if(WurstClient.INSTANCE.getHax().potionSaverHack.isFrozen()) diff --git a/src/main/java/net/wurstclient/mixin/SwordItemMixin.java b/src/main/java/net/wurstclient/mixin/SwordItemMixin.java deleted file mode 100644 index 8a943428..00000000 --- a/src/main/java/net/wurstclient/mixin/SwordItemMixin.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixin; - -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import com.google.common.collect.Multimap; - -import net.minecraft.entity.attribute.EntityAttribute; -import net.minecraft.entity.attribute.EntityAttributeModifier; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.item.SwordItem; -import net.minecraft.item.ToolItem; -import net.minecraft.item.ToolMaterial; -import net.wurstclient.WurstClient; -import net.wurstclient.mixinterface.ISwordItem; - -@Mixin(SwordItem.class) -public class SwordItemMixin extends ToolItem implements ISwordItem -{ - @Shadow - @Final - protected float attackDamage; - - @Shadow - @Final - private Multimap attributeModifiers; - - private SwordItemMixin(WurstClient wurst, ToolMaterial material, - Settings settings) - { - super(material, settings); - } - - @Override - public float fuckMcAfee() - { - return (float)attributeModifiers - .get(EntityAttributes.GENERIC_ATTACK_SPEED).iterator().next() - .getValue(); - } -} diff --git a/src/main/java/net/wurstclient/mixin/TelemetryManagerMixin.java b/src/main/java/net/wurstclient/mixin/TelemetryManagerMixin.java index 2586718c..59f5ef5f 100644 --- a/src/main/java/net/wurstclient/mixin/TelemetryManagerMixin.java +++ b/src/main/java/net/wurstclient/mixin/TelemetryManagerMixin.java @@ -12,15 +12,15 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import net.minecraft.client.util.telemetry.TelemetryManager; -import net.minecraft.client.util.telemetry.TelemetrySender; +import net.minecraft.client.session.telemetry.TelemetryManager; +import net.minecraft.client.session.telemetry.TelemetrySender; import net.wurstclient.WurstClient; @Mixin(TelemetryManager.class) public class TelemetryManagerMixin { @Inject(at = @At("HEAD"), - method = "getSender()Lnet/minecraft/client/util/telemetry/TelemetrySender;", + method = "getSender()Lnet/minecraft/client/session/telemetry/TelemetrySender;", cancellable = true) private void onGetSender(CallbackInfoReturnable cir) { diff --git a/src/main/java/net/wurstclient/mixin/TerrainRenderContextMixin.java b/src/main/java/net/wurstclient/mixin/TerrainRenderContextMixin.java deleted file mode 100644 index 651978e6..00000000 --- a/src/main/java/net/wurstclient/mixin/TerrainRenderContextMixin.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import net.fabricmc.fabric.impl.client.indigo.renderer.render.TerrainRenderContext; -import net.minecraft.block.BlockState; -import net.minecraft.client.render.model.BakedModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.BlockPos; -import net.wurstclient.event.EventManager; -import net.wurstclient.events.TesselateBlockListener.TesselateBlockEvent; - -@Mixin(TerrainRenderContext.class) -public class TerrainRenderContextMixin -{ - /** - * This is a part of what allows X-Ray to make blocks invisible. It's - * also the part that keeps breaking whenever Fabric API updates their - * rendering code. - * - *

- * We could make this optional to stop the game from crashing, but then - * X-Ray would silently stop working and it would be much harder to debug. - */ - @Inject(at = @At("HEAD"), - method = "tessellateBlock", - cancellable = true, - remap = false) - private void onTessellateBlock(BlockState blockState, BlockPos blockPos, - final BakedModel model, MatrixStack matrixStack, CallbackInfo ci) - { - TesselateBlockEvent event = - new TesselateBlockEvent(blockState, blockPos); - EventManager.fire(event); - - if(event.isCancelled()) - ci.cancel(); - } -} diff --git a/src/main/java/net/wurstclient/mixin/TextVisitFactoryMixin.java b/src/main/java/net/wurstclient/mixin/TextVisitFactoryMixin.java index aa017005..cb8a8d2b 100644 --- a/src/main/java/net/wurstclient/mixin/TextVisitFactoryMixin.java +++ b/src/main/java/net/wurstclient/mixin/TextVisitFactoryMixin.java @@ -20,8 +20,7 @@ public abstract class TextVisitFactoryMixin @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/text/TextVisitFactory;visitFormatted(Ljava/lang/String;ILnet/minecraft/text/Style;Lnet/minecraft/text/Style;Lnet/minecraft/text/CharacterVisitor;)Z", ordinal = 0), - method = { - "visitFormatted(Ljava/lang/String;ILnet/minecraft/text/Style;Lnet/minecraft/text/CharacterVisitor;)Z"}, + method = "visitFormatted(Ljava/lang/String;ILnet/minecraft/text/Style;Lnet/minecraft/text/CharacterVisitor;)Z", index = 0) private static String adjustText(String text) { diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index bbe58526..580b6d28 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import net.minecraft.client.gui.Drawable; +import net.fabricmc.fabric.api.client.screen.v1.Screens; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.TitleScreen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -22,7 +22,6 @@ import net.minecraft.client.resource.language.I18n; import net.minecraft.text.Text; import net.wurstclient.WurstClient; import net.wurstclient.altmanager.screens.AltManagerScreen; -import net.wurstclient.mixinterface.IScreen; @Mixin(TitleScreen.class) public abstract class TitleScreenMixin extends Screen @@ -30,23 +29,19 @@ public abstract class TitleScreenMixin extends Screen private ClickableWidget realmsButton = null; private ButtonWidget altsButton; - private TitleScreenMixin(WurstClient wurst, Text text_1) + private TitleScreenMixin(WurstClient wurst, Text title) { - super(text_1); + super(title); } - @Inject(at = {@At("RETURN")}, method = {"init()V"}) + @Inject(at = @At("RETURN"), method = "init()V") private void onInitWidgetsNormal(CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled()) return; - for(Drawable d : ((IScreen)this).getButtons()) + for(ClickableWidget button : Screens.getButtons(this)) { - if(!(d instanceof ClickableWidget)) - continue; - - ClickableWidget button = (ClickableWidget)d; if(!button.getMessage().getString() .equals(I18n.translate("menu.online"))) continue; @@ -69,7 +64,7 @@ public abstract class TitleScreenMixin extends Screen .dimensions(width / 2 + 2, realmsButton.getY(), 98, 20).build()); } - @Inject(at = {@At("RETURN")}, method = {"tick()V"}) + @Inject(at = @At("RETURN"), method = "tick()V") private void onTick(CallbackInfo ci) { if(realmsButton == null || altsButton == null) diff --git a/src/main/java/net/wurstclient/mixin/WorldMixin.java b/src/main/java/net/wurstclient/mixin/WorldMixin.java index dc7bf14c..4dc50827 100644 --- a/src/main/java/net/wurstclient/mixin/WorldMixin.java +++ b/src/main/java/net/wurstclient/mixin/WorldMixin.java @@ -7,31 +7,24 @@ */ package net.wurstclient.mixin; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; - -import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import net.minecraft.entity.Entity; -import net.minecraft.util.math.Box; -import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import net.wurstclient.WurstClient; import net.wurstclient.hacks.NoWeatherHack; -import net.wurstclient.mixinterface.IWorld; @Mixin(World.class) -public abstract class WorldMixin implements WorldAccess, AutoCloseable, IWorld +public abstract class WorldMixin implements WorldAccess, AutoCloseable { - @Inject(at = {@At("HEAD")}, - method = {"getRainGradient(F)F"}, + @Inject(at = @At("HEAD"), + method = "getRainGradient(F)F", cancellable = true) - private void onGetRainGradient(float f, CallbackInfoReturnable cir) + private void onGetRainGradient(float delta, + CallbackInfoReturnable cir) { if(WurstClient.INSTANCE.getHax().noWeatherHack.isRainDisabled()) cir.setReturnValue(0F); @@ -40,12 +33,10 @@ public abstract class WorldMixin implements WorldAccess, AutoCloseable, IWorld @Override public float getSkyAngle(float tickDelta) { - NoWeatherHack noWeatherHack = - WurstClient.INSTANCE.getHax().noWeatherHack; + NoWeatherHack noWeather = WurstClient.INSTANCE.getHax().noWeatherHack; - long timeOfDay = - noWeatherHack.isTimeChanged() ? noWeatherHack.getChangedTime() - : getLevelProperties().getTimeOfDay(); + long timeOfDay = noWeather.isTimeChanged() ? noWeather.getChangedTime() + : getLevelProperties().getTimeOfDay(); return getDimension().getSkyAngle(timeOfDay); } @@ -53,20 +44,11 @@ public abstract class WorldMixin implements WorldAccess, AutoCloseable, IWorld @Override public int getMoonPhase() { - NoWeatherHack noWeatherHack = - WurstClient.INSTANCE.getHax().noWeatherHack; + NoWeatherHack noWeather = WurstClient.INSTANCE.getHax().noWeatherHack; - if(noWeatherHack.isMoonPhaseChanged()) - return noWeatherHack.getChangedMoonPhase(); + if(noWeather.isMoonPhaseChanged()) + return noWeather.getChangedMoonPhase(); return getDimension().getMoonPhase(getLunarTime()); } - - @Override - public Stream getBlockCollisionsStream(@Nullable Entity entity, - Box box) - { - return StreamSupport - .stream(getBlockCollisions(entity, box).spliterator(), false); - } } diff --git a/src/main/java/net/wurstclient/mixin/WorldRendererMixin.java b/src/main/java/net/wurstclient/mixin/WorldRendererMixin.java index d74f109f..433dd1cf 100644 --- a/src/main/java/net/wurstclient/mixin/WorldRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/WorldRendererMixin.java @@ -22,7 +22,7 @@ public class WorldRendererMixin @Inject(at = @At("HEAD"), method = "hasBlindnessOrDarkness(Lnet/minecraft/client/render/Camera;)Z", cancellable = true) - private void onHasBlindnessOrDarknessEffect(Camera camera, + private void onHasBlindnessOrDarkness(Camera camera, CallbackInfoReturnable ci) { if(WurstClient.INSTANCE.getHax().antiBlindHack.isEnabled()) diff --git a/src/main/java/net/wurstclient/mixinterface/IArmorItem.java b/src/main/java/net/wurstclient/mixinterface/IArmorItem.java deleted file mode 100644 index 24572b80..00000000 --- a/src/main/java/net/wurstclient/mixinterface/IArmorItem.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixinterface; - -public interface IArmorItem -{ - public float getToughness(); -} diff --git a/src/main/java/net/wurstclient/mixinterface/IClientPlayerEntity.java b/src/main/java/net/wurstclient/mixinterface/IClientPlayerEntity.java index 195ad722..68e031fc 100644 --- a/src/main/java/net/wurstclient/mixinterface/IClientPlayerEntity.java +++ b/src/main/java/net/wurstclient/mixinterface/IClientPlayerEntity.java @@ -7,17 +7,7 @@ */ package net.wurstclient.mixinterface; -import net.minecraft.util.math.Vec3d; - public interface IClientPlayerEntity { - public void setNoClip(boolean noClip); - - public float getLastYaw(); - - public float getLastPitch(); - - public void setMovementMultiplier(Vec3d movementMultiplier); - public boolean isTouchingWaterBypass(); } diff --git a/src/main/java/net/wurstclient/mixinterface/IClientPlayerInteractionManager.java b/src/main/java/net/wurstclient/mixinterface/IClientPlayerInteractionManager.java index 297797aa..84868ca1 100644 --- a/src/main/java/net/wurstclient/mixinterface/IClientPlayerInteractionManager.java +++ b/src/main/java/net/wurstclient/mixinterface/IClientPlayerInteractionManager.java @@ -16,10 +16,6 @@ import net.minecraft.util.math.Vec3d; public interface IClientPlayerInteractionManager { - public float getCurrentBreakingProgress(); - - public void setBreakingBlock(boolean breakingBlock); - public void windowClick_PICKUP(int slot); public void windowClick_QUICK_MOVE(int slot); @@ -30,9 +26,6 @@ public interface IClientPlayerInteractionManager public void rightClickItem(); - public void rightClickBlock(BlockPos pos, Direction side, Vec3d hitVec, - Hand hand); - public void rightClickBlock(BlockPos pos, Direction side, Vec3d hitVec); public void sendPlayerActionC2SPacket(PlayerActionC2SPacket.Action action, @@ -40,6 +33,4 @@ public interface IClientPlayerInteractionManager public void sendPlayerInteractBlockPacket(Hand hand, BlockHitResult blockHitResult); - - public void setBlockHitDelay(int delay); } diff --git a/src/main/java/net/wurstclient/mixinterface/IFishingBobberEntity.java b/src/main/java/net/wurstclient/mixinterface/IFishingBobberEntity.java deleted file mode 100644 index 02deac3e..00000000 --- a/src/main/java/net/wurstclient/mixinterface/IFishingBobberEntity.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixinterface; - -import net.minecraft.util.math.BlockPos; - -public interface IFishingBobberEntity -{ - public boolean checkOpenWaterAround(BlockPos pos); -} diff --git a/src/main/java/net/wurstclient/mixinterface/IGameRenderer.java b/src/main/java/net/wurstclient/mixinterface/IGameRenderer.java deleted file mode 100644 index 6e28224e..00000000 --- a/src/main/java/net/wurstclient/mixinterface/IGameRenderer.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixinterface; - -import net.minecraft.util.Identifier; - -public interface IGameRenderer -{ - public void loadWurstShader(Identifier identifier); -} diff --git a/src/main/java/net/wurstclient/mixinterface/ILanguageManager.java b/src/main/java/net/wurstclient/mixinterface/ILanguageManager.java index 3ca321f7..e0213f0b 100644 --- a/src/main/java/net/wurstclient/mixinterface/ILanguageManager.java +++ b/src/main/java/net/wurstclient/mixinterface/ILanguageManager.java @@ -8,8 +8,15 @@ package net.wurstclient.mixinterface; import net.minecraft.client.resource.language.TranslationStorage; +import net.wurstclient.WurstClient; public interface ILanguageManager { - public TranslationStorage getEnglish(); + public TranslationStorage wurst_getEnglish(); + + public static TranslationStorage getEnglish() + { + return ((ILanguageManager)WurstClient.MC.getLanguageManager()) + .wurst_getEnglish(); + } } diff --git a/src/main/java/net/wurstclient/mixinterface/IMinecraftClient.java b/src/main/java/net/wurstclient/mixinterface/IMinecraftClient.java index d2d565ce..500f461b 100644 --- a/src/main/java/net/wurstclient/mixinterface/IMinecraftClient.java +++ b/src/main/java/net/wurstclient/mixinterface/IMinecraftClient.java @@ -7,23 +7,13 @@ */ package net.wurstclient.mixinterface; -import net.minecraft.client.util.Session; +import net.minecraft.client.session.Session; public interface IMinecraftClient { - public void rightClick(); - - public void setItemUseCooldown(int itemUseCooldown); - public IClientPlayerInteractionManager getInteractionManager(); - public ILanguageManager getLanguageManager(); - - public int getItemUseCooldown(); - public IClientPlayerEntity getPlayer(); - public IWorld getWorld(); - public void setSession(Session session); } diff --git a/src/main/java/net/wurstclient/mixinterface/IMiningToolItem.java b/src/main/java/net/wurstclient/mixinterface/IMiningToolItem.java deleted file mode 100644 index 85b1d5ef..00000000 --- a/src/main/java/net/wurstclient/mixinterface/IMiningToolItem.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixinterface; - -public interface IMiningToolItem -{ - /** - * Returns the attack damage. Calling it getAttackDamage() causes a false - * positive from McAfee GW Edition. - */ - public float fuckMcAfee1(); - - /** - * Returns the attack speed. Calling it getAttackSpeed() causes a false - * positive from McAfee GW Edition. - */ - public float fuckMcAfee2(); -} diff --git a/src/main/java/net/wurstclient/mixinterface/IScreen.java b/src/main/java/net/wurstclient/mixinterface/IScreen.java deleted file mode 100644 index c952f2ea..00000000 --- a/src/main/java/net/wurstclient/mixinterface/IScreen.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixinterface; - -import java.util.List; - -import net.minecraft.client.gui.Drawable; - -public interface IScreen -{ - public List getButtons(); -} diff --git a/src/main/java/net/wurstclient/mixinterface/IServerList.java b/src/main/java/net/wurstclient/mixinterface/IServerList.java deleted file mode 100644 index 5eef438a..00000000 --- a/src/main/java/net/wurstclient/mixinterface/IServerList.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixinterface; - -public interface IServerList -{ - public void clear(); -} diff --git a/src/main/java/net/wurstclient/mixinterface/ISwordItem.java b/src/main/java/net/wurstclient/mixinterface/ISwordItem.java deleted file mode 100644 index f0deaafc..00000000 --- a/src/main/java/net/wurstclient/mixinterface/ISwordItem.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixinterface; - -public interface ISwordItem -{ - /** - * Returns the attack speed. Calling it getAttackSpeed() causes a false - * positive from McAfee GW Edition. - */ - public float fuckMcAfee(); -} diff --git a/src/main/java/net/wurstclient/mixinterface/IWorld.java b/src/main/java/net/wurstclient/mixinterface/IWorld.java deleted file mode 100644 index 666ede9f..00000000 --- a/src/main/java/net/wurstclient/mixinterface/IWorld.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixinterface; - -import java.util.stream.Stream; - -import org.jetbrains.annotations.Nullable; - -import net.minecraft.entity.Entity; -import net.minecraft.util.math.Box; -import net.minecraft.util.shape.VoxelShape; - -public interface IWorld -{ - public Stream getBlockCollisionsStream(@Nullable Entity entity, - Box box); - - public default Stream getCollidingBoxes(@Nullable Entity entity, - Box box) - { - return getBlockCollisionsStream(entity, box) - .flatMap(vs -> vs.getBoundingBoxes().stream()) - .filter(b -> b.intersects(box)); - } -} diff --git a/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java index 725a8397..ffaa183a 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java @@ -21,8 +21,8 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; +import net.fabricmc.fabric.api.client.screen.v1.Screens; import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.render.BufferBuilder; @@ -34,6 +34,7 @@ import net.minecraft.client.sound.PositionedSoundInstance; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.sound.SoundEvents; import net.minecraft.text.Text; +import net.minecraft.util.math.MathHelper; import net.wurstclient.Feature; import net.wurstclient.WurstClient; import net.wurstclient.clickgui.ClickGui; @@ -44,7 +45,6 @@ import net.wurstclient.hack.Hack; import net.wurstclient.hacks.TooManyHaxHack; import net.wurstclient.keybinds.Keybind; import net.wurstclient.keybinds.PossibleKeybind; -import net.wurstclient.mixinterface.IScreen; import net.wurstclient.settings.Setting; import net.wurstclient.util.ChatUtils; import net.wurstclient.util.RenderUtils; @@ -337,33 +337,29 @@ public final class NavigatorFeatureScreen extends NavigatorScreen int bgx2 = middleX + 154; int bgy1 = 60; int bgy2 = height - 43; + boolean noButtons = Screens.getButtons(this).isEmpty(); + int bgy3 = bgy2 - (noButtons ? 0 : 24); + int windowY1 = bgy1 + scroll + windowComponentY; + int windowY2 = windowY1 + window.getInnerHeight(); setColorToBackground(); drawQuads(matrixStack, bgx1, bgy1, bgx2, - Math.max(bgy1, - Math.min(bgy2 - - (((IScreen)(Object)this).getButtons().isEmpty() ? 0 : 24), - bgy1 + scroll + windowComponentY))); - drawQuads(matrixStack, bgx1, - Math.max(bgy1, Math.min(bgy2 - - (((IScreen)(Object)this).getButtons().isEmpty() ? 0 : 24), - bgy1 + scroll + windowComponentY + window.getInnerHeight())), + MathHelper.clamp(windowY1, bgy1, bgy3)); + drawQuads(matrixStack, bgx1, MathHelper.clamp(windowY2, bgy1, bgy3), bgx2, bgy2); drawBoxShadow(matrixStack, bgx1, bgy1, bgx2, bgy2); // scissor box - RenderUtils.scissorBox(bgx1, bgy1, bgx2, - bgy2 - (((IScreen)(Object)this).getButtons().isEmpty() ? 0 : 24)); + RenderUtils.scissorBox(bgx1, bgy1, bgx2, bgy3); GL11.glEnable(GL11.GL_SCISSOR_TEST); // settings gui.setTooltip(""); window.validate(); - int windowY = bgy1 + scroll + windowComponentY; - window.setY(windowY - 13); + window.setY(windowY1 - 13); matrixStack.push(); - matrixStack.translate(bgx1, windowY, 0); + matrixStack.translate(bgx1, windowY1, 0); { int x1 = 0; @@ -433,7 +429,7 @@ public final class NavigatorFeatureScreen extends NavigatorScreen } for(int i = 0; i < window.countChildren(); i++) - window.getChild(i).render(context, mouseX - bgx1, mouseY - windowY, + window.getChild(i).render(context, mouseX - bgx1, mouseY - windowY1, partialTicks); matrixStack.pop(); @@ -487,13 +483,8 @@ public final class NavigatorFeatureScreen extends NavigatorScreen GL11.glDisable(GL11.GL_SCISSOR_TEST); // buttons below scissor box - for(Drawable d : ((IScreen)(Object)this).getButtons()) + for(ClickableWidget button : Screens.getButtons(this)) { - if(!(d instanceof ClickableWidget)) - continue; - - ClickableWidget button = (ClickableWidget)d; - // positions int x1 = button.getX(); int x2 = x1 + button.getWidth(); diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 70cd9d69..055b4bf5 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -189,8 +189,6 @@ public final class NavigatorMainScreen extends NavigatorScreen @Override protected void onUpdate() { - searchBar.tick(); - String newText = searchBar.getText(); if(clickTimer == -1 && !newText.equals(lastSearchText)) { diff --git a/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java index 2392e5c3..d6558973 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java @@ -15,8 +15,8 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; +import net.fabricmc.fabric.api.client.screen.v1.Screens; import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.util.InputUtil; @@ -25,7 +25,6 @@ import net.minecraft.text.Text; import net.wurstclient.WurstClient; import net.wurstclient.clickgui.ClickGui; import net.wurstclient.keybinds.PossibleKeybind; -import net.wurstclient.mixinterface.IScreen; import net.wurstclient.util.RenderUtils; public class NavigatorNewKeybindScreen extends NavigatorScreen @@ -174,10 +173,11 @@ public class NavigatorNewKeybindScreen extends NavigatorScreen int bgx2 = middleX + 154; int bgy1 = 60; int bgy2 = height - 43; + boolean noButtons = Screens.getButtons(this).isEmpty(); + int bgy3 = bgy2 - (noButtons ? 0 : 24); // scissor box - RenderUtils.scissorBox(bgx1, bgy1, bgx2, - bgy2 - (((IScreen)this).getButtons().isEmpty() ? 0 : 24)); + RenderUtils.scissorBox(bgx1, bgy1, bgx2, bgy3); GL11.glEnable(GL11.GL_SCISSOR_TEST); // possible keybinds @@ -237,13 +237,8 @@ public class NavigatorNewKeybindScreen extends NavigatorScreen GL11.glDisable(GL11.GL_SCISSOR_TEST); // buttons below scissor box - for(Drawable d : ((IScreen)this).getButtons()) + for(ClickableWidget button : Screens.getButtons(this)) { - if(!(d instanceof ClickableWidget)) - continue; - - ClickableWidget button = (ClickableWidget)d; - // positions int x1 = button.getX(); int x2 = x1 + button.getWidth(); diff --git a/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java index 645bec4c..9bfa8da1 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java @@ -17,8 +17,8 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; +import net.fabricmc.fabric.api.client.screen.v1.Screens; import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.util.math.MatrixStack; @@ -26,7 +26,6 @@ import net.minecraft.text.Text; import net.wurstclient.WurstClient; import net.wurstclient.clickgui.ClickGui; import net.wurstclient.keybinds.PossibleKeybind; -import net.wurstclient.mixinterface.IScreen; import net.wurstclient.util.RenderUtils; public class NavigatorRemoveKeybindScreen extends NavigatorScreen @@ -146,10 +145,11 @@ public class NavigatorRemoveKeybindScreen extends NavigatorScreen int bgx2 = middleX + 154; int bgy1 = 60; int bgy2 = height - 43; + boolean noButtons = Screens.getButtons(this).isEmpty(); + int bgy3 = bgy2 - (noButtons ? 0 : 24); // scissor box - RenderUtils.scissorBox(bgx1, bgy1, bgx2, - bgy2 - (((IScreen)this).getButtons().isEmpty() ? 0 : 24)); + RenderUtils.scissorBox(bgx1, bgy1, bgx2, bgy3); GL11.glEnable(GL11.GL_SCISSOR_TEST); // possible keybinds @@ -208,13 +208,8 @@ public class NavigatorRemoveKeybindScreen extends NavigatorScreen GL11.glDisable(GL11.GL_SCISSOR_TEST); // buttons below scissor box - for(Drawable d : ((IScreen)this).getButtons()) + for(ClickableWidget button : Screens.getButtons(this)) { - if(!(d instanceof ClickableWidget)) - continue; - - ClickableWidget button = (ClickableWidget)d; - // positions int x1 = button.getX(); int x2 = x1 + button.getWidth(); diff --git a/src/main/java/net/wurstclient/navigator/NavigatorScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorScreen.java index 556bf174..d57478e3 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorScreen.java @@ -113,12 +113,13 @@ public abstract class NavigatorScreen extends Screen } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double delta) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { // scrollbar if(!scrollbarLocked) { - scroll += delta * 4; + scroll += verticalAmount * 4; if(scroll > 0) scroll = 0; @@ -133,7 +134,8 @@ public abstract class NavigatorScreen extends Screen scrollKnobPosition += 2; } - return super.mouseScrolled(mouseX, mouseY, delta); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override diff --git a/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java b/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java index 88864e7c..98cc86dd 100644 --- a/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java +++ b/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java @@ -13,6 +13,7 @@ import java.util.function.Supplier; import net.minecraft.client.font.MultilineText; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.LiteralTextContent; @@ -101,9 +102,10 @@ public final class ForcedChatReportsScreen extends Screen } @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) + public void render(DrawContext context, int mouseX, int mouseY, + float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); int centerX = width / 2; int reasonY = (height - 68) / 2 - reasonHeight / 2; @@ -113,7 +115,8 @@ public final class ForcedChatReportsScreen extends Screen 0xAAAAAA); reasonFormatted.drawCenterWithShadow(context, centerX, reasonY); - super.render(context, mouseX, mouseY, delta); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java b/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java index fe212eb8..a6190329 100644 --- a/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java +++ b/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java @@ -13,6 +13,7 @@ import java.util.function.Supplier; import net.minecraft.client.font.MultilineText; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.Text; @@ -117,9 +118,10 @@ public final class NcrModRequiredScreen extends Screen } @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) + public void render(DrawContext context, int mouseX, int mouseY, + float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); int centerX = width / 2; int reasonY = (height - 68) / 2 - reasonHeight / 2; @@ -129,7 +131,8 @@ public final class NcrModRequiredScreen extends Screen 0xAAAAAA); reasonFormatted.drawCenterWithShadow(context, centerX, reasonY); - super.render(context, mouseX, mouseY, delta); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java b/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java index b8f8962c..a5ff001a 100644 --- a/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java +++ b/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java @@ -13,6 +13,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -81,22 +82,18 @@ public final class EnterProfileNameScreen extends Screen return super.keyPressed(keyCode, scanCode, int_3); } - @Override - public void tick() - { - valueField.tick(); - } - @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(client.textRenderer, "Name your new profile", width / 2, 20, 0xFFFFFF); valueField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/options/KeybindEditorScreen.java b/src/main/java/net/wurstclient/options/KeybindEditorScreen.java index fe346160..8eef9151 100644 --- a/src/main/java/net/wurstclient/options/KeybindEditorScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindEditorScreen.java @@ -8,6 +8,7 @@ package net.wurstclient.options; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -87,17 +88,11 @@ public final class KeybindEditorScreen extends Screen return super.mouseClicked(mouseX, mouseY, mouseButton); } - @Override - public void tick() - { - commandField.tick(); - } - @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(textRenderer, (oldKey != null ? "Edit" : "Add") + " Keybind", width / 2, 20, @@ -110,7 +105,9 @@ public final class KeybindEditorScreen extends Screen width / 2 - 100, 87, 0xa0a0a0); commandField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/options/KeybindManagerScreen.java b/src/main/java/net/wurstclient/options/KeybindManagerScreen.java index 43d5d7c4..3e3bf581 100644 --- a/src/main/java/net/wurstclient/options/KeybindManagerScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindManagerScreen.java @@ -11,6 +11,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -121,11 +122,12 @@ public final class KeybindManagerScreen extends Screen } @Override - public boolean mouseScrolled(double double_1, double double_2, - double double_3) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(double_1, double_2, double_3); - return super.mouseScrolled(double_1, double_2, double_3); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -166,7 +168,7 @@ public final class KeybindManagerScreen extends Screen public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); listGui.render(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(textRenderer, "Keybind Manager", @@ -174,7 +176,8 @@ public final class KeybindManagerScreen extends Screen context.drawCenteredTextWithShadow(textRenderer, "Keybinds: " + listGui.getItemCount(), width / 2, 20, 0xffffff); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java b/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java index 0946e70a..ad7b2607 100644 --- a/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java @@ -18,6 +18,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.Text; @@ -144,11 +145,12 @@ public final class KeybindProfilesScreen extends Screen } @Override - public boolean mouseScrolled(double double_1, double double_2, - double double_3) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(double_1, double_2, double_3); - return super.mouseScrolled(double_1, double_2, double_3); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -173,13 +175,14 @@ public final class KeybindProfilesScreen extends Screen public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); listGui.render(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(client.textRenderer, "Keybind Profiles", width / 2, 12, 0xffffff); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); if(loadButton.isSelected() && !loadButton.active) context.drawTooltip(textRenderer, diff --git a/src/main/java/net/wurstclient/options/PressAKeyScreen.java b/src/main/java/net/wurstclient/options/PressAKeyScreen.java index da209054..b4f58e8b 100644 --- a/src/main/java/net/wurstclient/options/PressAKeyScreen.java +++ b/src/main/java/net/wurstclient/options/PressAKeyScreen.java @@ -10,6 +10,7 @@ package net.wurstclient.options; import org.lwjgl.glfw.GLFW; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.InputUtil; import net.minecraft.text.Text; @@ -53,9 +54,11 @@ public class PressAKeyScreen extends Screen public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(textRenderer, "Press a key", width / 2, height / 4 + 48, 16777215); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/net/wurstclient/options/WurstOptionsScreen.java b/src/main/java/net/wurstclient/options/WurstOptionsScreen.java index 8cce4e9d..77c878e3 100644 --- a/src/main/java/net/wurstclient/options/WurstOptionsScreen.java +++ b/src/main/java/net/wurstclient/options/WurstOptionsScreen.java @@ -11,6 +11,7 @@ import java.util.Arrays; import java.util.List; import java.util.function.Supplier; +import net.fabricmc.fabric.api.client.screen.v1.Screens; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; @@ -24,9 +25,9 @@ import net.wurstclient.WurstClient; import net.wurstclient.analytics.WurstAnalytics; import net.wurstclient.commands.FriendsCmd; import net.wurstclient.hacks.XRayHack; -import net.wurstclient.mixinterface.IScreen; import net.wurstclient.other_features.VanillaSpoofOtf; import net.wurstclient.settings.CheckboxSetting; +import net.wurstclient.util.ChatUtils; public class WurstOptionsScreen extends Screen { @@ -70,29 +71,26 @@ public class WurstOptionsScreen extends Screen new WurstOptionsButton(-154, 48, () -> "Count Users: " + (analytics.isEnabled() ? "ON" : "OFF"), - "Counts how many people are using Wurst\n" - + "and which versions are the most popular.\n" - + "We use this data to decide when to stop\n" - + "supporting old Minecraft versions.\n\n" - + "We use a random ID to tell users apart\n" - + "so that this data can never be linked to\n" - + "your Minecraft account. The random ID is\n" - + "changed every 3 days to make extra sure\n" - + "that you remain anonymous.", + "Counts how many people are using Wurst and which versions are the" + + " most popular. We use this data to decide when to stop" + + " supporting old Minecraft versions.\n\n" + + "We use a random ID to tell users apart so that this data can" + + " never be linked to your Minecraft account. The random ID is" + + " changed every 3 days to make extra sure that you remain" + + " anonymous.", b -> analytics.setEnabled(!analytics.isEnabled())); new WurstOptionsButton(-154, 72, () -> "Spoof Vanilla: " + (vanillaSpoofOtf.isEnabled() ? "ON" : "OFF"), - vanillaSpoofOtf.getWrappedDescription(200), + vanillaSpoofOtf.getDescription(), b -> vanillaSpoofOtf.doPrimaryAction()); new WurstOptionsButton(-154, 96, () -> "Translations: " + (!forceEnglish.isChecked() ? "ON" : "OFF"), - "§cThis is an experimental feature!\n" - + "We don't have many translations yet. If you\n" - + "speak both English and some other language,\n" - + "please help us by adding more translations.", + "Allows text in Wurst to be displayed in other languages than" + + " English. It will use the same language that Minecraft is" + + " set to.\n\n" + "This is an experimental feature!", b -> forceEnglish.setChecked(!forceEnglish.isChecked())); } @@ -101,18 +99,17 @@ public class WurstOptionsScreen extends Screen XRayHack xRayHack = WurstClient.INSTANCE.getHax().xRayHack; new WurstOptionsButton(-50, 24, () -> "Keybinds", - "Keybinds allow you to toggle any hack\n" - + "or command by simply pressing a\n" + "button.", + "Keybinds allow you to toggle any hack or command by simply" + + " pressing a button.", b -> client.setScreen(new KeybindManagerScreen(this))); new WurstOptionsButton(-50, 48, () -> "X-Ray Blocks", - "Manager for the blocks\n" + "that X-Ray will show.", + "Manager for the blocks that X-Ray will show.", b -> xRayHack.openBlockListEditor(this)); new WurstOptionsButton(-50, 72, () -> "Zoom", - "The Zoom Manager allows you to\n" - + "change the zoom key, how far it\n" - + "will zoom in and more.", + "The Zoom Manager allows you to change the zoom key and how far it" + + " will zoom in.", b -> client.setScreen(new ZoomManagerScreen(this))); } @@ -121,14 +118,16 @@ public class WurstOptionsScreen extends Screen OperatingSystem os = Util.getOperatingSystem(); new WurstOptionsButton(54, 24, () -> "Official Website", - "WurstClient.net", b -> os.open( + "§n§lWurstClient.net", b -> os.open( "https://www.wurstclient.net/?utm_source=Wurst+Client&utm_medium=Wurst+Options&utm_content=Official+Website")); - new WurstOptionsButton(54, 48, () -> "Wurst Wiki", "Wurst.Wiki", + new WurstOptionsButton(54, 48, () -> "Wurst Wiki", "§n§lWurst.Wiki\n" + + "We are looking for volunteers to help us expand" + + " the wiki and keep it up to date with the latest Wurst updates.", b -> os.open( "https://wurst.wiki/?utm_source=Wurst+Client&utm_medium=Wurst+Options&utm_content=Wurst+Wiki")); - new WurstOptionsButton(54, 72, () -> "WurstForum", "WurstForum.net", + new WurstOptionsButton(54, 72, () -> "WurstForum", "§n§lWurstForum.net", b -> os.open( "https://wurstforum.net/?utm_source=Wurst+Client&utm_medium=Wurst+Options&utm_content=WurstForum")); @@ -136,7 +135,12 @@ public class WurstOptionsScreen extends Screen b -> os.open("https://www.wurstclient.net/twitter/")); new WurstOptionsButton(54, 120, () -> "Donate", - "WurstClient.net/donate", b -> os.open( + "§n§lWurstClient.net/donate\n" + + "Donate now to help me keep the Wurst Client alive and free" + + " to use for everyone.\n\n" + + "Every bit helps and is much appreciated! You can also get a" + + " few cool perks in return.", + b -> os.open( "https://www.wurstclient.net/donate/?utm_source=Wurst+Client&utm_medium=Wurst+Options&utm_content=Donate")); } @@ -150,9 +154,12 @@ public class WurstOptionsScreen extends Screen public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); renderTitles(context); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); + renderButtonTooltip(context, mouseX, mouseY); } @@ -177,13 +184,8 @@ public class WurstOptionsScreen extends Screen private void renderButtonTooltip(DrawContext context, int mouseX, int mouseY) { - for(Drawable d : ((IScreen)this).getButtons()) + for(ClickableWidget button : Screens.getButtons(this)) { - if(!(d instanceof ClickableWidget)) - continue; - - ClickableWidget button = (ClickableWidget)d; - if(!button.isSelected() || !(button instanceof WurstOptionsButton)) continue; @@ -217,7 +219,7 @@ public class WurstOptionsScreen extends Screen this.tooltip = Arrays.asList(); else { - String[] lines = tooltip.split("\n"); + String[] lines = ChatUtils.wrapText(tooltip, 200).split("\n"); Text[] lines2 = new Text[lines.length]; for(int i = 0; i < lines.length; i++) diff --git a/src/main/java/net/wurstclient/options/ZoomManagerScreen.java b/src/main/java/net/wurstclient/options/ZoomManagerScreen.java index 8f16145f..ebe8cc06 100644 --- a/src/main/java/net/wurstclient/options/ZoomManagerScreen.java +++ b/src/main/java/net/wurstclient/options/ZoomManagerScreen.java @@ -8,6 +8,7 @@ package net.wurstclient.options; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.option.KeyBinding; @@ -33,11 +34,11 @@ public class ZoomManagerScreen extends Screen implements PressAKeyCallback @Override public void init() { - ZoomOtf zoom = WurstClient.INSTANCE.getOtfs().zoomOtf; + WurstClient wurst = WurstClient.INSTANCE; + ZoomOtf zoom = wurst.getOtfs().zoomOtf; SliderSetting level = zoom.getLevelSetting(); CheckboxSetting scroll = zoom.getScrollSetting(); - String zoomKeyName = WurstClient.INSTANCE.getZoomKey() - .getBoundKeyTranslationKey().replace("key.keyboard.", ""); + Text zoomKeyName = wurst.getZoomKey().getBoundKeyLocalizedText(); addDrawableChild(ButtonWidget .builder(Text.literal("Back"), b -> client.setScreen(prevScreen)) @@ -45,7 +46,7 @@ public class ZoomManagerScreen extends Screen implements PressAKeyCallback .build()); addDrawableChild(keyButton = ButtonWidget - .builder(Text.literal("Zoom Key: " + zoomKeyName), + .builder(Text.literal("Zoom Key: ").append(zoomKeyName), b -> client.setScreen(new PressAKeyScreen(this))) .dimensions(width / 2 - 79, height / 4 + 24 - 16, 158, 20).build()); @@ -100,14 +101,15 @@ public class ZoomManagerScreen extends Screen implements PressAKeyCallback ZoomOtf zoom = WurstClient.INSTANCE.getOtfs().zoomOtf; SliderSetting level = zoom.getLevelSetting(); - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(textRenderer, "Zoom Manager", width / 2, 40, 0xffffff); context.drawTextWithShadow(textRenderer, "Zoom Level: " + level.getValueString(), width / 2 - 75, height / 4 + 44, 0xcccccc); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/other_features/TranslationsOtf.java b/src/main/java/net/wurstclient/other_features/TranslationsOtf.java index aa7c5866..886d0c5d 100644 --- a/src/main/java/net/wurstclient/other_features/TranslationsOtf.java +++ b/src/main/java/net/wurstclient/other_features/TranslationsOtf.java @@ -25,9 +25,10 @@ public final class TranslationsOtf extends OtherFeature public TranslationsOtf() { - super("Translations", "Localization settings.\n\n" - + "\u00a7cThis is an experimental feature!\u00a7r\n" - + "We don't have many translations yet. If you speak both English and some other language, please help us by adding more translations."); + super("Translations", "Allows text in Wurst to be displayed" + + " in other languages than English. It will use the same language" + + " that Minecraft is set to.\n\n" + + "This is an experimental feature!"); addSetting(forceEnglish); } diff --git a/src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java b/src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java index ba0ee0b5..0ad90444 100644 --- a/src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java +++ b/src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java @@ -7,13 +7,11 @@ */ package net.wurstclient.other_features; -import io.netty.buffer.Unpooled; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket; +import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket; +import net.minecraft.util.Identifier; import net.wurstclient.DontBlock; import net.wurstclient.SearchTags; import net.wurstclient.events.ConnectionPacketOutputListener; -import net.wurstclient.mixin.CustomPayloadC2SPacketAccessor; import net.wurstclient.other_feature.OtherFeature; import net.wurstclient.settings.CheckboxSetting; @@ -41,23 +39,25 @@ public final class VanillaSpoofOtf extends OtherFeature if(!spoof.isChecked()) return; - if(!(event.getPacket() instanceof CustomPayloadC2SPacketAccessor)) + if(!(event.getPacket() instanceof CustomPayloadC2SPacket packet)) return; - CustomPayloadC2SPacketAccessor packet = - (CustomPayloadC2SPacketAccessor)event.getPacket(); + Identifier channel = packet.payload().id(); - if(packet.getChannel().getNamespace().equals("minecraft") - && packet.getChannel().getPath().equals("register")) + if(channel.getNamespace().equals("minecraft") + && channel.getPath().equals("register")) event.cancel(); + + // Apparently the Minecraft client no longer sends its brand to the + // server as of 23w31a - if(packet.getChannel().getNamespace().equals("minecraft") - && packet.getChannel().getPath().equals("brand")) - event.setPacket(new CustomPayloadC2SPacket( - CustomPayloadC2SPacket.BRAND, - new PacketByteBuf(Unpooled.buffer()).writeString("vanilla"))); + // if(packet.getChannel().getNamespace().equals("minecraft") + // && packet.getChannel().getPath().equals("brand")) + // event.setPacket(new CustomPayloadC2SPacket( + // CustomPayloadC2SPacket.BRAND, + // new PacketByteBuf(Unpooled.buffer()).writeString("vanilla"))); - if(packet.getChannel().getNamespace().equals("fabric")) + if(channel.getNamespace().equals("fabric")) event.cancel(); } diff --git a/src/main/java/net/wurstclient/other_features/ZoomOtf.java b/src/main/java/net/wurstclient/other_features/ZoomOtf.java index 43b5c1e3..20f6c56b 100644 --- a/src/main/java/net/wurstclient/other_features/ZoomOtf.java +++ b/src/main/java/net/wurstclient/other_features/ZoomOtf.java @@ -93,6 +93,11 @@ public final class ZoomOtf extends OtherFeature implements MouseScrollListener level.getMaximum()); } + public boolean shouldPreventHotbarScrolling() + { + return WURST.getZoomKey().isPressed() && scroll.isChecked(); + } + public SliderSetting getLevelSetting() { return level; diff --git a/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java b/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java index f706da3d..ef1e4a4c 100644 --- a/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java +++ b/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java @@ -13,6 +13,7 @@ import java.util.function.Supplier; import org.lwjgl.glfw.GLFW; +import net.fabricmc.fabric.api.client.screen.v1.Screens; import net.minecraft.SharedConstants; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; @@ -24,7 +25,6 @@ import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.network.ServerInfo; import net.minecraft.text.Text; import net.wurstclient.mixinterface.IMultiplayerScreen; -import net.wurstclient.mixinterface.IScreen; public class CleanUpScreen extends Screen { @@ -204,27 +204,24 @@ public class CleanUpScreen extends Screen public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(textRenderer, "Clean Up", width / 2, 20, 16777215); context.drawCenteredTextWithShadow(textRenderer, "Please select the servers you want to remove:", width / 2, 36, 10526880); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); + renderButtonTooltip(context, mouseX, mouseY); } private void renderButtonTooltip(DrawContext context, int mouseX, int mouseY) { - for(Drawable d : ((IScreen)this).getButtons()) + for(ClickableWidget button : Screens.getButtons(this)) { - if(!(d instanceof ClickableWidget)) - continue; - - ClickableWidget button = (ClickableWidget)d; - if(!button.isSelected() || !(button instanceof CleanUpButton)) continue; diff --git a/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java b/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java index f8429ed6..9b884939 100644 --- a/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java +++ b/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java @@ -14,11 +14,13 @@ import java.util.ArrayList; import org.lwjgl.glfw.GLFW; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.network.ServerInfo; +import net.minecraft.client.network.ServerInfo.ServerType; import net.minecraft.text.Text; import net.minecraft.util.Util; import net.wurstclient.mixinterface.IMultiplayerScreen; @@ -156,8 +158,6 @@ public class ServerFinderScreen extends Screen @Override public void tick() { - ipBox.tick(); - searchButton .setMessage(Text.literal(state.isRunning() ? "Cancel" : "Search")); ipBox.active = !state.isRunning(); @@ -189,9 +189,8 @@ public class ServerFinderScreen extends Screen if(!isServerInList(pingers.get(i).getServerIP())) { prevScreen.getServerList() - .add( - new ServerInfo("Grief me #" + working, - pingers.get(i).getServerIP(), false), + .add(new ServerInfo("Grief me #" + working, + pingers.get(i).getServerIP(), ServerType.OTHER), false); prevScreen.getServerList().saveFile(); ((IMultiplayerScreen)prevScreen).getServerListSelector() @@ -217,7 +216,7 @@ public class ServerFinderScreen extends Screen public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(textRenderer, "Server Finder", width / 2, 20, 16777215); @@ -248,7 +247,8 @@ public class ServerFinderScreen extends Screen context.drawTextWithShadow(textRenderer, "Working: " + working, width / 2 - 100, height / 4 + 94, 10526880); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/serverfinder/WurstServerPinger.java b/src/main/java/net/wurstclient/serverfinder/WurstServerPinger.java index 387fad20..64de3bdf 100644 --- a/src/main/java/net/wurstclient/serverfinder/WurstServerPinger.java +++ b/src/main/java/net/wurstclient/serverfinder/WurstServerPinger.java @@ -12,6 +12,7 @@ import java.util.concurrent.atomic.AtomicInteger; import net.minecraft.client.network.MultiplayerServerListPinger; import net.minecraft.client.network.ServerInfo; +import net.minecraft.client.network.ServerInfo.ServerType; public class WurstServerPinger { @@ -27,7 +28,7 @@ public class WurstServerPinger public void ping(String ip, int port) { - server = new ServerInfo("", ip + ":" + port, false); + server = new ServerInfo("", ip + ":" + port, ServerType.OTHER); new Thread(() -> pingInCurrentThread(ip, port), "Wurst Server Pinger #" + threadNumber.incrementAndGet()).start(); diff --git a/src/main/java/net/wurstclient/settings/EspBoxSizeSetting.java b/src/main/java/net/wurstclient/settings/EspBoxSizeSetting.java new file mode 100644 index 00000000..dce32108 --- /dev/null +++ b/src/main/java/net/wurstclient/settings/EspBoxSizeSetting.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings; + +public final class EspBoxSizeSetting + extends EnumSetting +{ + public EspBoxSizeSetting(String description) + { + super("Box size", description, BoxSize.values(), BoxSize.FANCY); + } + + public EspBoxSizeSetting(String name, String description, BoxSize selected) + { + super(name, description, BoxSize.values(), selected); + } + + public float getExtraSize() + { + return getSelected().extraSize; + } + + public enum BoxSize + { + ACCURATE("Accurate", 0), + FANCY("Fancy", 0.1F); + + private final String name; + private final float extraSize; + + private BoxSize(String name, float extraSize) + { + this.name = name; + this.extraSize = extraSize; + } + + public float getExtraSize() + { + return extraSize; + } + + @Override + public String toString() + { + return name; + } + } +} diff --git a/src/main/java/net/wurstclient/settings/EspStyleSetting.java b/src/main/java/net/wurstclient/settings/EspStyleSetting.java index 73dd64b9..f06da31b 100644 --- a/src/main/java/net/wurstclient/settings/EspStyleSetting.java +++ b/src/main/java/net/wurstclient/settings/EspStyleSetting.java @@ -24,6 +24,16 @@ public final class EspStyleSetting extends EnumSetting super(name, description, EspStyle.values(), selected); } + public boolean hasBoxes() + { + return getSelected().boxes; + } + + public boolean hasLines() + { + return getSelected().lines; + } + public enum EspStyle { BOXES("Boxes only", true, false), diff --git a/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java index 71a02391..0506b057 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java @@ -30,25 +30,50 @@ public final class AnchorAuraFilterList extends EntityFilterList + damageWarning, false)); - builder.add(new FilterMonstersSetting( - "Won't target zombies, creepers, etc. when auto-placing anchors." - + damageWarning, + builder.add(new FilterHostileSetting("Won't target hostile mobs like" + + " zombies and creepers when auto-placing anchors." + + damageWarning, true)); + + builder.add(new FilterNeutralSetting("Won't target neutral mobs like" + + " endermen and wolves when auto-placing anchors." + damageWarning, + AttackDetectingEntityFilter.Mode.ON)); + + builder.add(new FilterPassiveSetting("Won't target animals like pigs" + + " and cows, ambient mobs like bats, and water mobs like fish," + + " squid and dolphins when auto-placing anchors." + damageWarning, true)); - builder.add(new FilterAnimalsSetting( - "Won't target pigs, cows, etc. when auto-placing anchors." - + damageWarning, + builder.add(new FilterPassiveWaterSetting("Won't target passive water" + + " mobs like fish, squid, dolphins and axolotls when auto-placing" + + " anchors." + damageWarning, true)); + + builder.add(new FilterBatsSetting("Won't target bats and any other" + + " \"ambient\" mobs when auto-placing anchors." + damageWarning, true)); - builder.add(new FilterTradersSetting( - "Won't target villagers, wandering traders, etc. when auto-placing anchors." - + damageWarning, + builder.add(new FilterSlimesSetting("Won't target slimes when" + + " auto-placing anchors." + damageWarning, true)); + + builder.add(new FilterVillagersSetting("Won't target villagers and" + + " wandering traders when auto-placing anchors." + damageWarning, true)); - builder.add(new FilterGolemsSetting( - "Won't target iron golems, snow golems and shulkers when auto-placing anchors." - + damageWarning, - true)); + builder.add(new FilterZombieVillagersSetting("Won't target zombified" + + " villagers when auto-placing anchors." + damageWarning, true)); + + builder.add(new FilterGolemsSetting("Won't target iron golems and snow" + + " golems when auto-placing anchors." + damageWarning, true)); + + builder.add(new FilterPiglinsSetting( + "Won't target piglins when auto-placing anchors.", + AttackDetectingEntityFilter.Mode.ON)); + + builder.add(new FilterZombiePiglinsSetting("Won't target" + + " zombified piglins when auto-placing anchors." + damageWarning, + AttackDetectingEntityFilter.Mode.ON)); + + builder.add(new FilterShulkersSetting("Won't target shulkers when" + + " auto-placing anchors." + damageWarning, true)); builder.add(new FilterAllaysSetting( "Won't target allays when auto-placing anchors." + damageWarning, diff --git a/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java index 754f8d59..993c5dd8 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java @@ -30,25 +30,50 @@ public final class CrystalAuraFilterList extends EntityFilterList + damageWarning, false)); - builder.add(new FilterMonstersSetting( - "Won't target zombies, creepers, etc. when auto-placing crystals." - + damageWarning, + builder.add(new FilterHostileSetting("Won't target hostile mobs like" + + " zombies and creepers when auto-placing crystals." + + damageWarning, true)); + + builder.add(new FilterNeutralSetting("Won't target neutral mobs like" + + " endermen and wolves when auto-placing crystals." + + damageWarning, AttackDetectingEntityFilter.Mode.ON)); + + builder.add(new FilterPassiveSetting("Won't target animals like pigs" + + " and cows, ambient mobs like bats, and water mobs like fish," + + " squid and dolphins when auto-placing crystals." + damageWarning, true)); - builder.add(new FilterAnimalsSetting( - "Won't target pigs, cows, etc. when auto-placing crystals." - + damageWarning, + builder.add(new FilterPassiveWaterSetting("Won't target passive water" + + " mobs like fish, squid, dolphins and axolotls when auto-placing" + + " crystals." + damageWarning, true)); + + builder.add(new FilterBatsSetting("Won't target bats and any other" + + " \"ambient\" mobs when auto-placing crystals." + damageWarning, true)); - builder.add(new FilterTradersSetting( - "Won't target villagers, wandering traders, etc. when auto-placing crystals." - + damageWarning, + builder.add(new FilterSlimesSetting("Won't target slimes when" + + " auto-placing crystals." + damageWarning, true)); + + builder.add(new FilterVillagersSetting("Won't target villagers and" + + " wandering traders when auto-placing crystals." + damageWarning, true)); - builder.add(new FilterGolemsSetting( - "Won't target iron golems, snow golems and shulkers when auto-placing crystals." - + damageWarning, - true)); + builder.add(new FilterZombieVillagersSetting("Won't target zombified" + + " villagers when auto-placing crystals." + damageWarning, true)); + + builder.add(new FilterGolemsSetting("Won't target iron golems and snow" + + " golems when auto-placing crystals." + damageWarning, true)); + + builder.add(new FilterPiglinsSetting("Won't target piglins when" + + " auto-placing crystals." + damageWarning, + AttackDetectingEntityFilter.Mode.ON)); + + builder.add(new FilterZombiePiglinsSetting("Won't target" + + " zombified piglins when auto-placing crystals." + damageWarning, + AttackDetectingEntityFilter.Mode.ON)); + + builder.add(new FilterShulkersSetting("Won't target shulkers when" + + " auto-placing crystals." + damageWarning, true)); builder.add(new FilterAllaysSetting( "Won't target allays when auto-placing crystals." + damageWarning, diff --git a/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java index 8077a407..e3c3d0ab 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java @@ -50,19 +50,39 @@ public class EntityFilterList return stream; } + public final boolean testOne(Entity entity) + { + for(EntityFilter filter : entityFilters) + if(filter.isFilterEnabled() && !filter.test(entity)) + return false; + + return true; + } + public static EntityFilterList genericCombat() { return new EntityFilterList(FilterPlayersSetting.genericCombat(false), FilterSleepingSetting.genericCombat(false), FilterFlyingSetting.genericCombat(0), - FilterMonstersSetting.genericCombat(false), - FilterPigmenSetting.genericCombat(false), - FilterEndermenSetting.genericCombat(false), - FilterAnimalsSetting.genericCombat(false), + FilterHostileSetting.genericCombat(false), + FilterNeutralSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterPassiveSetting.genericCombat(false), + FilterPassiveWaterSetting.genericCombat(false), FilterBabiesSetting.genericCombat(false), + FilterBatsSetting.genericCombat(false), + FilterSlimesSetting.genericCombat(false), FilterPetsSetting.genericCombat(false), - FilterTradersSetting.genericCombat(false), + FilterVillagersSetting.genericCombat(false), + FilterZombieVillagersSetting.genericCombat(false), FilterGolemsSetting.genericCombat(false), + FilterPiglinsSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterZombiePiglinsSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterEndermenSetting + .genericCombat(AttackDetectingEntityFilter.Mode.OFF), + FilterShulkersSetting.genericCombat(false), FilterAllaysSetting.genericCombat(false), FilterInvisibleSetting.genericCombat(false), FilterNamedSetting.genericCombat(false), diff --git a/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java index e6feb129..2a834efd 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java @@ -33,28 +33,49 @@ public final class FollowFilterList extends EntityFilterList "Won't follow players that are at least the given distance above ground.", 0)); - builder.add(new FilterMonstersSetting( - "Won't follow zombies, creepers, etc.", true)); + builder.add(new FilterHostileSetting( + "Won't follow hostile mobs like zombies and creepers.", true)); - builder - .add(new FilterPigmenSetting("Won't follow zombie pigmen.", true)); + builder.add(FilterNeutralSetting.onOffOnly( + "Won't follow neutral mobs like endermen and wolves.", true)); - builder.add(new FilterEndermenSetting("Won't follow endermen.", true)); + builder.add(new FilterPassiveSetting("Won't follow animals like pigs" + + " and cows, ambient mobs like bats, and water mobs like" + + " fish, squid and dolphins.", true)); - builder.add( - new FilterAnimalsSetting("Won't follow pigs, cows, etc.", true)); + builder.add(new FilterPassiveWaterSetting("Won't follow passive water" + + " mobs like fish, squid, dolphins and axolotls.", true)); builder.add(new FilterBabiesSetting( "Won't follow baby pigs, baby villagers, etc.", true)); + builder.add(new FilterBatsSetting("Won't follow bats and any other" + + " \"ambient\" mobs that might be added by mods.", true)); + + builder.add(new FilterSlimesSetting("Won't follow slimes.", true)); + builder.add(new FilterPetsSetting( "Won't follow tamed wolves, tamed horses, etc.", true)); - builder.add(new FilterTradersSetting( - "Won't follow villagers, wandering traders, etc.", true)); + builder.add(new FilterVillagersSetting( + "Won't follow villagers and wandering traders.", true)); + + builder.add(new FilterZombieVillagersSetting( + "Won't follow zombified villagers.", true)); builder.add(new FilterGolemsSetting( - "Won't follow iron golems, snow golems and shulkers.", true)); + "Won't follow iron golems and snow golems.", true)); + + builder + .add(FilterPiglinsSetting.onOffOnly("Won't follow piglins.", true)); + + builder.add(FilterZombiePiglinsSetting + .onOffOnly("Won't follow zombified piglins.", true)); + + builder.add( + FilterEndermenSetting.onOffOnly("Won't follow endermen.", true)); + + builder.add(new FilterShulkersSetting("Won't follow shulkers.", true)); builder.add(new FilterAllaysSetting("Won't follow allays.", true)); diff --git a/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java index 88292145..ac0e0bbd 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java @@ -33,27 +33,49 @@ public final class RemoteViewFilterList extends EntityFilterList "Won't view players that are at least the given distance above ground.", 0)); - builder.add(new FilterMonstersSetting( - "Won't view zombies, creepers, etc.", true)); + builder.add(new FilterHostileSetting( + "Won't view hostile mobs like zombies and creepers.", true)); - builder.add(new FilterPigmenSetting("Won't view zombie pigmen.", true)); + builder.add(FilterNeutralSetting.onOffOnly( + "Won't view neutral mobs like endermen and wolves.", true)); - builder.add(new FilterEndermenSetting("Won't view endermen.", true)); + builder.add(new FilterPassiveSetting("Won't view animals like pigs and" + + " cows, ambient mobs like bats, and water mobs like fish, squid" + + " and dolphins.", true)); - builder - .add(new FilterAnimalsSetting("Won't view pigs, cows, etc.", true)); + builder.add(new FilterPassiveWaterSetting("Won't view passive water" + + " mobs like fish, squid, dolphins and axolotls.", true)); builder.add(new FilterBabiesSetting( "Won't view baby pigs, baby villagers, etc.", true)); + builder.add(new FilterBatsSetting("Won't view bats and any other" + + " \"ambient\" mobs that might be added by mods.", true)); + + builder.add(new FilterSlimesSetting("Won't view slimes.", true)); + builder.add(new FilterPetsSetting( "Won't view tamed wolves, tamed horses, etc.", true)); - builder.add(new FilterTradersSetting( - "Won't view villagers, wandering traders, etc.", true)); + builder.add(new FilterVillagersSetting( + "Won't view villagers and wandering traders.", true)); + + builder.add(new FilterZombieVillagersSetting( + "Won't view zombified villagers.", true)); builder.add(new FilterGolemsSetting( - "Won't view iron golems, snow golems and shulkers.", true)); + "Won't view iron golems and snow golems.", true)); + + builder + .add(FilterPiglinsSetting.onOffOnly("Won't view piglins.", true)); + + builder.add(FilterZombiePiglinsSetting + .onOffOnly("Won't view zombified piglins.", true)); + + builder + .add(FilterEndermenSetting.onOffOnly("Won't view endermen.", true)); + + builder.add(new FilterShulkersSetting("Won't view shulkers.", true)); builder.add(new FilterAllaysSetting("Won't view allays.", true)); diff --git a/src/main/java/net/wurstclient/settings/filters/AttackDetectingEntityFilter.java b/src/main/java/net/wurstclient/settings/filters/AttackDetectingEntityFilter.java new file mode 100644 index 00000000..96f0426e --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/AttackDetectingEntityFilter.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import java.util.function.Supplier; + +import net.minecraft.entity.Entity; +import net.wurstclient.settings.CheckboxSetting; +import net.wurstclient.settings.EnumSetting; +import net.wurstclient.settings.Setting; +import net.wurstclient.settings.filterlists.EntityFilterList.EntityFilter; + +public abstract class AttackDetectingEntityFilter implements EntityFilter +{ + private final Setting setting; + private final Supplier mode; + + protected AttackDetectingEntityFilter(String name, String description, + Mode selected, boolean checked) + { + if(selected == null) + { + CheckboxSetting cbSetting = + new CheckboxSetting(name, description, checked); + setting = cbSetting; + mode = () -> cbSetting.isChecked() ? Mode.ON : Mode.OFF; + + }else + { + EnumSetting enumSetting = + new EnumSetting<>(name, description, Mode.values(), selected); + setting = enumSetting; + mode = () -> enumSetting.getSelected(); + } + } + + public abstract boolean onTest(Entity e); + + public abstract boolean ifCalmTest(Entity e); + + @Override + public final boolean test(Entity e) + { + return mode.get() == Mode.IF_CALM ? ifCalmTest(e) : onTest(e); + } + + @Override + public final boolean isFilterEnabled() + { + return mode.get() != Mode.OFF; + } + + @Override + public final Setting getSetting() + { + return setting; + } + + public enum Mode + { + ON("On"), + IF_CALM("If calm"), + OFF("Off"); + + private final String name; + + private Mode(String name) + { + this.name = name; + } + + @Override + public String toString() + { + return name; + } + } +} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java index 0627467f..43322339 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java @@ -27,4 +27,9 @@ public final class FilterAllaysSetting extends EntityFilterCheckbox { return new FilterAllaysSetting("Won't attack allays.", checked); } + + public static FilterAllaysSetting genericVision(boolean checked) + { + return new FilterAllaysSetting("Won't show allays.", checked); + } } diff --git a/src/main/java/net/wurstclient/settings/filters/FilterAnimalsSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterAnimalsSetting.java deleted file mode 100644 index e5961cd9..00000000 --- a/src/main/java/net/wurstclient/settings/filters/FilterAnimalsSetting.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.settings.filters; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.mob.AmbientEntity; -import net.minecraft.entity.mob.WaterCreatureEntity; -import net.minecraft.entity.passive.AnimalEntity; - -public final class FilterAnimalsSetting extends EntityFilterCheckbox -{ - public FilterAnimalsSetting(String description, boolean checked) - { - super("Filter animals", description, checked); - } - - @Override - public boolean test(Entity e) - { - return !(e instanceof AnimalEntity || e instanceof AmbientEntity - || e instanceof WaterCreatureEntity); - } - - public static FilterAnimalsSetting genericCombat(boolean checked) - { - return new FilterAnimalsSetting("Won't attack pigs, cows, etc.", - checked); - } -} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterArmorStandsSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterArmorStandsSetting.java index eb570604..cf067edf 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterArmorStandsSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterArmorStandsSetting.java @@ -28,4 +28,10 @@ public final class FilterArmorStandsSetting extends EntityFilterCheckbox return new FilterArmorStandsSetting("Won't attack armor stands.", checked); } + + public static FilterArmorStandsSetting genericVision(boolean checked) + { + return new FilterArmorStandsSetting("Won't show armor stands.", + checked); + } } diff --git a/src/main/java/net/wurstclient/settings/filters/FilterBabiesSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterBabiesSetting.java index b37ef491..98d2bfe1 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterBabiesSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterBabiesSetting.java @@ -9,18 +9,30 @@ package net.wurstclient.settings.filters; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.PassiveEntity; +import net.minecraft.entity.passive.TadpoleEntity; public final class FilterBabiesSetting extends EntityFilterCheckbox { + private static final String EXCEPTIONS_TEXT = "\n\nThis filter does not" + + " affect baby zombies and other hostile baby mobs."; + public FilterBabiesSetting(String description, boolean checked) { - super("Filter babies", description, checked); + super("Filter babies", description + EXCEPTIONS_TEXT, checked); } @Override public boolean test(Entity e) { - return !(e instanceof PassiveEntity && ((PassiveEntity)e).isBaby()); + // filter out passive entity babies + if(e instanceof PassiveEntity pe && pe.isBaby()) + return false; + + // filter out tadpoles + if(e instanceof TadpoleEntity) + return false; + + return true; } public static FilterBabiesSetting genericCombat(boolean checked) diff --git a/src/main/java/net/wurstclient/settings/filters/FilterBatsSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterBatsSetting.java new file mode 100644 index 00000000..734c7539 --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterBatsSetting.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.mob.AmbientEntity; + +public final class FilterBatsSetting extends EntityFilterCheckbox +{ + public FilterBatsSetting(String description, boolean checked) + { + super("Filter bats", description, checked); + } + + @Override + public boolean test(Entity e) + { + return !(e instanceof AmbientEntity); + } + + public static FilterBatsSetting genericCombat(boolean checked) + { + return new FilterBatsSetting("Won't attack bats and any other" + + " \"ambient\" mobs that might be added by mods.", checked); + } + + public static FilterBatsSetting genericVision(boolean checked) + { + return new FilterBatsSetting("Won't show bats and any other" + + " \"ambient\" mobs that might be added by mods.", checked); + } +} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterEndermenSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterEndermenSetting.java index db60e127..ddf0f9e5 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterEndermenSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterEndermenSetting.java @@ -10,21 +10,55 @@ package net.wurstclient.settings.filters; import net.minecraft.entity.Entity; import net.minecraft.entity.mob.EndermanEntity; -public final class FilterEndermenSetting extends EntityFilterCheckbox +public final class FilterEndermenSetting extends AttackDetectingEntityFilter { - public FilterEndermenSetting(String description, boolean checked) + private FilterEndermenSetting(String description, Mode selected, + boolean checked) { - super("Filter endermen", description, checked); + super("Filter endermen", description, selected, checked); + } + + public FilterEndermenSetting(String description, Mode selected) + { + this(description, selected, false); } @Override - public boolean test(Entity e) + public boolean onTest(Entity e) { return !(e instanceof EndermanEntity); } - public static FilterEndermenSetting genericCombat(boolean checked) + @Override + public boolean ifCalmTest(Entity e) { - return new FilterEndermenSetting("Won't attack endermen.", checked); + return !(e instanceof EndermanEntity ee) || ee.isAttacking(); + } + + public static FilterEndermenSetting genericCombat(Mode selected) + { + return new FilterEndermenSetting("When set to \u00a7lOn\u00a7r," + + " endermen won't be attacked at all.\n\n" + + "When set to \u00a7lIf calm\u00a7r, endermen won't be attacked" + + " until they attack first. Be warned that this filter cannot" + + " detect if the endermen are attacking you or someone else.\n\n" + + "When set to \u00a7lOff\u00a7r, this filter does nothing and" + + " endermen can be attacked.", selected); + } + + public static FilterEndermenSetting genericVision(Mode selected) + { + return new FilterEndermenSetting("When set to \u00a7lOn\u00a7r," + + " endermen won't be shown at all.\n\n" + + "When set to \u00a7lIf calm\u00a7r, endermen won't be shown" + + " until they attack something.\n\n" + + "When set to \u00a7lOff\u00a7r, this filter does nothing and" + + " endermen can be shown.", selected); + } + + public static FilterEndermenSetting onOffOnly(String description, + boolean onByDefault) + { + return new FilterEndermenSetting(description, null, onByDefault); } } diff --git a/src/main/java/net/wurstclient/settings/filters/FilterGolemsSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterGolemsSetting.java index 0215857c..61dd05d8 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterGolemsSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterGolemsSetting.java @@ -8,6 +8,7 @@ package net.wurstclient.settings.filters; import net.minecraft.entity.Entity; +import net.minecraft.entity.mob.ShulkerEntity; import net.minecraft.entity.passive.GolemEntity; public final class FilterGolemsSetting extends EntityFilterCheckbox @@ -20,12 +21,18 @@ public final class FilterGolemsSetting extends EntityFilterCheckbox @Override public boolean test(Entity e) { - return !(e instanceof GolemEntity); + return !(e instanceof GolemEntity) || e instanceof ShulkerEntity; } public static FilterGolemsSetting genericCombat(boolean checked) { return new FilterGolemsSetting( - "Won't attack iron golems, snow golems and shulkers.", checked); + "Won't attack iron golems and snow golems.", checked); + } + + public static FilterGolemsSetting genericVision(boolean checked) + { + return new FilterGolemsSetting( + "Won't show iron golems and snow golems.", checked); } } diff --git a/src/main/java/net/wurstclient/settings/filters/FilterHostileSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterHostileSetting.java new file mode 100644 index 00000000..c6d44d5c --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterHostileSetting.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.mob.Angerable; +import net.minecraft.entity.mob.Monster; +import net.minecraft.entity.mob.PiglinEntity; + +public final class FilterHostileSetting extends EntityFilterCheckbox +{ + private static final String EXCEPTIONS_TEXT = "\n\nThis filter does not" + + " affect endermen, non-brute piglins, and zombified piglins."; + + public FilterHostileSetting(String description, boolean checked) + { + super("Filter hostile mobs", description + EXCEPTIONS_TEXT, checked); + } + + @Override + public boolean test(Entity e) + { + // never filter out neutral mobs (including piglins) + if(e instanceof Angerable || e instanceof PiglinEntity) + return false; + + return !(e instanceof Monster); + } + + public static FilterHostileSetting genericCombat(boolean checked) + { + return new FilterHostileSetting( + "Won't attack hostile mobs like zombies and creepers.", checked); + } + + public static FilterHostileSetting genericVision(boolean checked) + { + return new FilterHostileSetting( + "Won't show hostile mobs like zombies and creepers.", checked); + } +} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterInvisibleSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterInvisibleSetting.java index 65699b12..67ef6746 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterInvisibleSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterInvisibleSetting.java @@ -27,4 +27,10 @@ public final class FilterInvisibleSetting extends EntityFilterCheckbox return new FilterInvisibleSetting("Won't attack invisible entities.", checked); } + + public static FilterInvisibleSetting genericVision(boolean checked) + { + return new FilterInvisibleSetting("Won't show invisible entities.", + checked); + } } diff --git a/src/main/java/net/wurstclient/settings/filters/FilterMonstersSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterMonstersSetting.java deleted file mode 100644 index 8f07b5d0..00000000 --- a/src/main/java/net/wurstclient/settings/filters/FilterMonstersSetting.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.settings.filters; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.mob.Monster; - -public final class FilterMonstersSetting extends EntityFilterCheckbox -{ - public FilterMonstersSetting(String description, boolean checked) - { - super("Filter monsters", description, checked); - } - - @Override - public boolean test(Entity e) - { - return !(e instanceof Monster); - } - - public static FilterMonstersSetting genericCombat(boolean checked) - { - return new FilterMonstersSetting("Won't attack zombies, creepers, etc.", - checked); - } -} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterNamedSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterNamedSetting.java index 02ec0bd6..3d830d51 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterNamedSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterNamedSetting.java @@ -27,4 +27,10 @@ public final class FilterNamedSetting extends EntityFilterCheckbox return new FilterNamedSetting("Won't attack name-tagged entities.", checked); } + + public static FilterNamedSetting genericVision(boolean checked) + { + return new FilterNamedSetting("Won't show name-tagged entities.", + checked); + } } diff --git a/src/main/java/net/wurstclient/settings/filters/FilterNeutralSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterNeutralSetting.java new file mode 100644 index 00000000..48c94dc6 --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterNeutralSetting.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.mob.Angerable; +import net.minecraft.entity.mob.MobEntity; +import net.minecraft.entity.mob.PiglinEntity; +import net.minecraft.entity.passive.PufferfishEntity; + +public final class FilterNeutralSetting extends AttackDetectingEntityFilter +{ + private FilterNeutralSetting(String description, Mode selected, + boolean checked) + { + super("Filter neutral mobs", description, selected, checked); + } + + public FilterNeutralSetting(String description, Mode selected) + { + this(description, selected, false); + } + + @Override + public boolean onTest(Entity e) + { + return !(e instanceof Angerable || e instanceof PufferfishEntity + || e instanceof PiglinEntity); + } + + @Override + public boolean ifCalmTest(Entity e) + { + // special case for pufferfish + if(e instanceof PufferfishEntity pfe) + return pfe.getPuffState() > 0; + + if(e instanceof Angerable || e instanceof PiglinEntity) + if(e instanceof MobEntity me) + return me.isAttacking(); + + return true; + } + + public static FilterNeutralSetting genericCombat(Mode selected) + { + return new FilterNeutralSetting("When set to \u00a7lOn\u00a7r," + + " neutral mobs won't be attacked at all.\n\n" + + "When set to \u00a7lIf calm\u00a7r, neutral mobs won't be" + + " attacked until they attack first. Be warned that this filter" + + " cannot detect if the neutral mobs are attacking you or someone" + + " else.\n\n" + + "When set to \u00a7lOff\u00a7r, this filter does nothing and" + + " neutral mobs can be attacked.", selected); + } + + public static FilterNeutralSetting genericVision(Mode selected) + { + return new FilterNeutralSetting("When set to \u00a7lOn\u00a7r," + + " neutral mobs won't be shown at all.\n\n" + + "When set to \u00a7lIf calm\u00a7r, neutral mobs won't be shown" + + " until they attack something.\n\n" + + "When set to \u00a7lOff\u00a7r, this filter does nothing and" + + " neutral mobs can be shown.", selected); + } + + public static FilterNeutralSetting onOffOnly(String description, + boolean onByDefault) + { + return new FilterNeutralSetting(description, null, onByDefault); + } +} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterPassiveSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterPassiveSetting.java new file mode 100644 index 00000000..f0b9c8c0 --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterPassiveSetting.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.mob.AmbientEntity; +import net.minecraft.entity.mob.Angerable; +import net.minecraft.entity.mob.WaterCreatureEntity; +import net.minecraft.entity.passive.AnimalEntity; +import net.minecraft.entity.passive.PufferfishEntity; + +public final class FilterPassiveSetting extends EntityFilterCheckbox +{ + private static final String EXCEPTIONS_TEXT = "\n\nThis filter does not" + + " affect wolves, bees, polar bears, pufferfish, and villagers."; + + public FilterPassiveSetting(String description, boolean checked) + { + super("Filter passive mobs", description + EXCEPTIONS_TEXT, checked); + } + + @Override + public boolean test(Entity e) + { + // never filter out neutral mobs (including pufferfish) + if(e instanceof Angerable || e instanceof PufferfishEntity) + return true; + + return !(e instanceof AnimalEntity || e instanceof AmbientEntity + || e instanceof WaterCreatureEntity); + } + + public static FilterPassiveSetting genericCombat(boolean checked) + { + return new FilterPassiveSetting("Won't attack animals like pigs and" + + " cows, ambient mobs like bats, and water mobs like fish, squid" + + " and dolphins.", checked); + } + + public static FilterPassiveSetting genericVision(boolean checked) + { + return new FilterPassiveSetting("Won't show animals like pigs and" + + " cows, ambient mobs like bats, and water mobs like fish, squid" + + " and dolphins.", checked); + } +} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterPassiveWaterSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterPassiveWaterSetting.java new file mode 100644 index 00000000..86664dc3 --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterPassiveWaterSetting.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.mob.WaterCreatureEntity; +import net.minecraft.entity.passive.AxolotlEntity; +import net.minecraft.entity.passive.PufferfishEntity; + +public final class FilterPassiveWaterSetting extends EntityFilterCheckbox +{ + private static final String EXCEPTIONS_TEXT = + "\n\nThis filter does not affect guardians, drowned, and pufferfish."; + + public FilterPassiveWaterSetting(String description, boolean checked) + { + super("Filter passive water mobs", description + EXCEPTIONS_TEXT, + checked); + } + + @Override + public boolean test(Entity e) + { + // never filter out pufferfish + if(e instanceof PufferfishEntity) + return true; + + return !(e instanceof WaterCreatureEntity + || e instanceof AxolotlEntity); + } + + public static FilterPassiveWaterSetting genericCombat(boolean checked) + { + return new FilterPassiveWaterSetting("Won't attack passive water mobs" + + " like fish, squid, dolphins and axolotls.", checked); + } + + public static FilterPassiveWaterSetting genericVision(boolean checked) + { + return new FilterPassiveWaterSetting("Won't show passive water mobs" + + " like fish, squid, dolphins and axolotls.", checked); + } +} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterPetsSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterPetsSetting.java index 7dd99222..72c4409d 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterPetsSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterPetsSetting.java @@ -31,4 +31,10 @@ public final class FilterPetsSetting extends EntityFilterCheckbox return new FilterPetsSetting( "Won't attack tamed wolves, tamed horses, etc.", checked); } + + public static FilterPetsSetting genericVision(boolean checked) + { + return new FilterPetsSetting( + "Won't show tamed wolves, tamed horses, etc.", checked); + } } diff --git a/src/main/java/net/wurstclient/settings/filters/FilterPiglinsSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterPiglinsSetting.java new file mode 100644 index 00000000..005191ff --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterPiglinsSetting.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.mob.PiglinEntity; + +public final class FilterPiglinsSetting extends AttackDetectingEntityFilter +{ + private static final String EXCEPTIONS_TEXT = + "\n\nThis filter does not affect piglin brutes."; + + private FilterPiglinsSetting(String description, Mode selected, + boolean checked) + { + super("Filter piglins", description + EXCEPTIONS_TEXT, selected, + checked); + } + + public FilterPiglinsSetting(String description, Mode selected) + { + this(description, selected, false); + } + + @Override + public boolean onTest(Entity e) + { + return !(e instanceof PiglinEntity); + } + + @Override + public boolean ifCalmTest(Entity e) + { + return !(e instanceof PiglinEntity pe) || pe.isAttacking(); + } + + public static FilterPiglinsSetting genericCombat(Mode selected) + { + return new FilterPiglinsSetting("When set to \u00a7lOn\u00a7r," + + " piglins won't be attacked at all.\n\n" + + "When set to \u00a7lIf calm\u00a7r, piglins won't be attacked" + + " until they attack first. Be warned that this filter cannot" + + " detect if the piglins are attacking you or someone else.\n\n" + + "When set to \u00a7lOff\u00a7r, this filter does nothing and" + + " piglins can be attacked.", selected); + } + + public static FilterPiglinsSetting genericVision(Mode selected) + { + return new FilterPiglinsSetting("When set to \u00a7lOn\u00a7r," + + " piglins won't be shown at all.\n\n" + + "When set to \u00a7lIf calm\u00a7r, piglins won't be shown until" + + " they attack something.\n\n" + + "When set to \u00a7lOff\u00a7r, this filter does nothing and" + + " piglins can be shown.", selected); + } + + public static FilterPiglinsSetting onOffOnly(String description, + boolean onByDefault) + { + return new FilterPiglinsSetting(description, null, onByDefault); + } +} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterPigmenSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterPigmenSetting.java deleted file mode 100644 index 40b8d998..00000000 --- a/src/main/java/net/wurstclient/settings/filters/FilterPigmenSetting.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.settings.filters; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.mob.ZombifiedPiglinEntity; - -public final class FilterPigmenSetting extends EntityFilterCheckbox -{ - public FilterPigmenSetting(String description, boolean checked) - { - super("Filter pigmen", description, checked); - } - - @Override - public boolean test(Entity e) - { - return !(e instanceof ZombifiedPiglinEntity); - } - - public static FilterPigmenSetting genericCombat(boolean checked) - { - return new FilterPigmenSetting("Won't attack zombie pigmen.", checked); - } -} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterPlayersSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterPlayersSetting.java index 80a5921f..1c0bc4bb 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterPlayersSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterPlayersSetting.java @@ -27,4 +27,9 @@ public final class FilterPlayersSetting extends EntityFilterCheckbox { return new FilterPlayersSetting("Won't attack other players.", checked); } + + public static FilterPlayersSetting genericVision(boolean checked) + { + return new FilterPlayersSetting("Won't show other players.", checked); + } } diff --git a/src/main/java/net/wurstclient/settings/filters/FilterShulkersSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterShulkersSetting.java new file mode 100644 index 00000000..a6797d4a --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterShulkersSetting.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.mob.ShulkerEntity; + +public final class FilterShulkersSetting extends EntityFilterCheckbox +{ + public FilterShulkersSetting(String description, boolean checked) + { + super("Filter shulkers", description, checked); + } + + @Override + public boolean test(Entity e) + { + return !(e instanceof ShulkerEntity); + } + + public static FilterShulkersSetting genericCombat(boolean checked) + { + return new FilterShulkersSetting("Won't attack shulkers.", checked); + } + + public static FilterShulkersSetting genericVision(boolean checked) + { + return new FilterShulkersSetting("Won't show shulkers.", checked); + } +} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterSleepingSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterSleepingSetting.java index 470f9cba..b78d0c71 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterSleepingSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterSleepingSetting.java @@ -8,6 +8,7 @@ package net.wurstclient.settings.filters; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityPose; import net.minecraft.entity.player.PlayerEntity; public final class FilterSleepingSetting extends EntityFilterCheckbox @@ -20,16 +21,22 @@ public final class FilterSleepingSetting extends EntityFilterCheckbox @Override public boolean test(Entity e) { - if(!(e instanceof PlayerEntity)) + if(!(e instanceof PlayerEntity pe)) return true; - return !((PlayerEntity)e).isSleeping(); + return !pe.isSleeping() && pe.getPose() != EntityPose.SLEEPING; } public static FilterSleepingSetting genericCombat(boolean checked) { return new FilterSleepingSetting("Won't attack sleeping players.\n\n" - + "Useful for servers like Mineplex that place sleeping players on the ground to make them look like corpses.", + + "Useful for servers like Mineplex that place sleeping players on" + + " the ground to make them look like corpses.", checked); + } + + public static FilterSleepingSetting genericVision(boolean checked) + { + return new FilterSleepingSetting("Won't show sleeping players.", checked); } } diff --git a/src/main/java/net/wurstclient/settings/filters/FilterSlimesSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterSlimesSetting.java new file mode 100644 index 00000000..9783f59b --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterSlimesSetting.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.mob.MagmaCubeEntity; +import net.minecraft.entity.mob.SlimeEntity; + +public final class FilterSlimesSetting extends EntityFilterCheckbox +{ + private static final String EXCEPTIONS_TEXT = + "\n\nThis filter does not affect magma cubes."; + + public FilterSlimesSetting(String description, boolean checked) + { + super("Filter slimes", description + EXCEPTIONS_TEXT, checked); + } + + @Override + public boolean test(Entity e) + { + return !(e instanceof SlimeEntity) || e instanceof MagmaCubeEntity; + } + + public static FilterSlimesSetting genericCombat(boolean checked) + { + return new FilterSlimesSetting("Won't attack slimes.", checked); + } + + public static FilterSlimesSetting genericVision(boolean checked) + { + return new FilterSlimesSetting("Won't show slimes.", checked); + } +} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterTradersSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterTradersSetting.java deleted file mode 100644 index 08660308..00000000 --- a/src/main/java/net/wurstclient/settings/filters/FilterTradersSetting.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.settings.filters; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.passive.MerchantEntity; - -public final class FilterTradersSetting extends EntityFilterCheckbox -{ - public FilterTradersSetting(String description, boolean checked) - { - super("Filter traders", description, checked); - } - - @Override - public boolean test(Entity e) - { - return !(e instanceof MerchantEntity); - } - - public static FilterTradersSetting genericCombat(boolean checked) - { - return new FilterTradersSetting( - "Won't attack villagers, wandering traders, etc.", checked); - } -} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterVillagersSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterVillagersSetting.java new file mode 100644 index 00000000..31f6f649 --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterVillagersSetting.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.MerchantEntity; + +public final class FilterVillagersSetting extends EntityFilterCheckbox +{ + public FilterVillagersSetting(String description, boolean checked) + { + super("Filter villagers", description, checked); + } + + @Override + public boolean test(Entity e) + { + return !(e instanceof MerchantEntity); + } + + public static FilterVillagersSetting genericCombat(boolean checked) + { + return new FilterVillagersSetting( + "Won't attack villagers and wandering traders.", checked); + } + + public static FilterVillagersSetting genericVision(boolean checked) + { + return new FilterVillagersSetting( + "Won't show villagers and wandering traders.", checked); + } +} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterZombiePiglinsSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterZombiePiglinsSetting.java new file mode 100644 index 00000000..62fae589 --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterZombiePiglinsSetting.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.mob.ZombifiedPiglinEntity; + +public final class FilterZombiePiglinsSetting + extends AttackDetectingEntityFilter +{ + private FilterZombiePiglinsSetting(String description, Mode selected, + boolean checked) + { + super("Filter zombie piglins", description, selected, checked); + } + + public FilterZombiePiglinsSetting(String description, Mode selected) + { + this(description, selected, false); + } + + @Override + public boolean onTest(Entity e) + { + return !(e instanceof ZombifiedPiglinEntity); + } + + @Override + public boolean ifCalmTest(Entity e) + { + return !(e instanceof ZombifiedPiglinEntity zpe) || zpe.isAttacking(); + } + + public static FilterZombiePiglinsSetting genericCombat(Mode selected) + { + return new FilterZombiePiglinsSetting("When set to \u00a7lOn\u00a7r," + + " zombified piglins won't be attacked at all.\n\n" + + "When set to \u00a7lIf calm\u00a7r, zombified piglins won't be" + + " attacked until they attack first. Be warned that this filter" + + " cannot detect if the zombified piglins are attacking you or" + + " someone else.\n\n" + + "When set to \u00a7lOff\u00a7r, this filter does nothing and" + + " zombified piglins can be attacked.", selected); + } + + public static FilterZombiePiglinsSetting genericVision(Mode selected) + { + return new FilterZombiePiglinsSetting("When set to \u00a7lOn\u00a7r," + + " zombified piglins won't be shown at all.\n\n" + + "When set to \u00a7lIf calm\u00a7r, zombified piglins won't be" + + " shown until they attack something.\n\n" + + "When set to \u00a7lOff\u00a7r, this filter does nothing and" + + " zombified piglins can be shown.", selected); + } + + public static FilterZombiePiglinsSetting onOffOnly(String description, + boolean onByDefault) + { + return new FilterZombiePiglinsSetting(description, null, onByDefault); + } +} diff --git a/src/main/java/net/wurstclient/settings/filters/FilterZombieVillagersSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterZombieVillagersSetting.java new file mode 100644 index 00000000..205ba327 --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterZombieVillagersSetting.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.mob.ZombieVillagerEntity; + +public final class FilterZombieVillagersSetting extends EntityFilterCheckbox +{ + public FilterZombieVillagersSetting(String description, boolean checked) + { + super("Filter zombie villagers", description, checked); + } + + @Override + public boolean test(Entity e) + { + return !(e instanceof ZombieVillagerEntity); + } + + public static FilterZombieVillagersSetting genericCombat(boolean checked) + { + return new FilterZombieVillagersSetting( + "Won't attack zombified villagers.", checked); + } + + public static FilterZombieVillagersSetting genericVision(boolean checked) + { + return new FilterZombieVillagersSetting( + "Won't show zombified villagers.", checked); + } +} diff --git a/src/main/java/net/wurstclient/treebot/TreeBotUtils.java b/src/main/java/net/wurstclient/treebot/TreeBotUtils.java deleted file mode 100644 index 58cfad28..00000000 --- a/src/main/java/net/wurstclient/treebot/TreeBotUtils.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.treebot; - -import java.util.Arrays; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3i; -import net.minecraft.world.RaycastContext; -import net.wurstclient.WurstClient; -import net.wurstclient.util.BlockUtils; -import net.wurstclient.util.RotationUtils; - -public enum TreeBotUtils -{ - ; - - private static final List LOG_BLOCKS = - Arrays.asList(Blocks.OAK_LOG, Blocks.SPRUCE_LOG, Blocks.BIRCH_LOG, - Blocks.JUNGLE_LOG, Blocks.ACACIA_LOG, Blocks.DARK_OAK_LOG); - - private static final List LEAVES_BLOCKS = Arrays.asList( - Blocks.OAK_LEAVES, Blocks.SPRUCE_LEAVES, Blocks.BIRCH_LEAVES, - Blocks.JUNGLE_LEAVES, Blocks.ACACIA_LEAVES, Blocks.DARK_OAK_LEAVES); - - public static boolean isLog(BlockPos pos) - { - return LOG_BLOCKS.contains(BlockUtils.getBlock(pos)); - } - - public static boolean isLeaves(BlockPos pos) - { - return LEAVES_BLOCKS.contains(BlockUtils.getBlock(pos)); - } - - public static boolean hasLineOfSight(BlockPos pos) - { - return getLineOfSightSide(RotationUtils.getEyesPos(), pos) != null; - } - - public static Direction getLineOfSightSide(Vec3d eyesPos, BlockPos pos) - { - Direction[] sides = Direction.values(); - - Vec3d relCenter = BlockUtils.getBoundingBox(pos) - .offset(-pos.getX(), -pos.getY(), -pos.getZ()).getCenter(); - Vec3d center = Vec3d.of(pos).add(relCenter); - - Vec3d[] hitVecs = new Vec3d[sides.length]; - for(int i = 0; i < sides.length; i++) - { - Vec3i dirVec = sides[i].getVector(); - Vec3d relHitVec = new Vec3d(relCenter.x * dirVec.getX(), - relCenter.y * dirVec.getY(), relCenter.z * dirVec.getZ()); - hitVecs[i] = center.add(relHitVec); - } - - double[] distancesSq = new double[sides.length]; - boolean[] linesOfSight = new boolean[sides.length]; - - double distanceSqToCenter = eyesPos.squaredDistanceTo(center); - for(int i = 0; i < sides.length; i++) - { - distancesSq[i] = eyesPos.squaredDistanceTo(hitVecs[i]); - - // no need to raytrace the rear sides, - // they can't possibly have line of sight - if(distancesSq[i] >= distanceSqToCenter) - continue; - - linesOfSight[i] = hasLineOfSight(eyesPos, hitVecs[i]); - } - - Direction side = null; - for(int i = 0; i < sides.length; i++) - { - // require line of sight - if(!linesOfSight[i]) - continue; - - // start with the first side that has LOS - if(side == null) - { - side = sides[i]; - continue; - } - - // then pick the closest side - if(distancesSq[i] < distancesSq[side.ordinal()]) - side = sides[i]; - } - - // will be null if no LOS was found - return side; - } - - private static boolean hasLineOfSight(Vec3d from, Vec3d to) - { - RaycastContext context = - new RaycastContext(from, to, RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, WurstClient.MC.player); - - return WurstClient.MC.world.raycast(context) - .getType() == HitResult.Type.MISS; - } -} diff --git a/src/main/java/net/wurstclient/util/BlockBreaker.java b/src/main/java/net/wurstclient/util/BlockBreaker.java index 16398f6f..a1cf34ee 100644 --- a/src/main/java/net/wurstclient/util/BlockBreaker.java +++ b/src/main/java/net/wurstclient/util/BlockBreaker.java @@ -14,14 +14,12 @@ import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.Action; import net.minecraft.util.Hand; -import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.RaycastContext; import net.wurstclient.WurstClient; public enum BlockBreaker @@ -58,6 +56,18 @@ public enum BlockBreaker * sight to that hit vector. */ public static BlockBreakingParams getBlockBreakingParams(BlockPos pos) + { + return getBlockBreakingParams(RotationUtils.getEyesPos(), pos); + } + + /** + * Returns everything you need to break a block at the given position, such + * as which side to face, the exact hit vector to face that side, the + * squared distance to that hit vector, and whether or not there is line of + * sight to that hit vector. + */ + public static BlockBreakingParams getBlockBreakingParams(Vec3d eyes, + BlockPos pos) { Direction[] sides = Direction.values(); @@ -66,7 +76,6 @@ public enum BlockBreaker if(shape.isEmpty()) return null; - Vec3d eyesPos = RotationUtils.getEyesPos(); Box box = shape.getBoundingBox(); Vec3d halfSize = new Vec3d(box.maxX - box.minX, box.maxY - box.minY, box.maxZ - box.minZ).multiply(0.5); @@ -81,24 +90,20 @@ public enum BlockBreaker hitVecs[i] = center.add(relHitVec); } - double distanceSqToCenter = eyesPos.squaredDistanceTo(center); + double distanceSqToCenter = eyes.squaredDistanceTo(center); double[] distancesSq = new double[sides.length]; boolean[] linesOfSight = new boolean[sides.length]; for(int i = 0; i < sides.length; i++) { - distancesSq[i] = eyesPos.squaredDistanceTo(hitVecs[i]); + distancesSq[i] = eyes.squaredDistanceTo(hitVecs[i]); // no need to raytrace the rear sides, // they can't possibly have line of sight if(distancesSq[i] >= distanceSqToCenter) continue; - linesOfSight[i] = MC.world - .raycast(new RaycastContext(eyesPos, hitVecs[i], - RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, MC.player)) - .getType() == HitResult.Type.MISS; + linesOfSight[i] = BlockUtils.hasLineOfSight(eyes, hitVecs[i]); } Direction side = sides[0]; diff --git a/src/main/java/net/wurstclient/util/BlockPlacer.java b/src/main/java/net/wurstclient/util/BlockPlacer.java index 829d9677..96121057 100644 --- a/src/main/java/net/wurstclient/util/BlockPlacer.java +++ b/src/main/java/net/wurstclient/util/BlockPlacer.java @@ -10,14 +10,12 @@ package net.wurstclient.util; import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.RaycastContext; import net.wurstclient.WurstClient; import net.wurstclient.mixinterface.IMinecraftClient; import net.wurstclient.util.BlockBreaker.BlockBreakingParams; @@ -124,11 +122,7 @@ public enum BlockPlacer if(distancesSq[i] <= distanceSqToPosVec) continue; - linesOfSight[i] = MC.world - .raycast(new RaycastContext(eyesPos, hitVecs[i], - RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, MC.player)) - .getType() == HitResult.Type.MISS; + linesOfSight[i] = BlockUtils.hasLineOfSight(eyesPos, hitVecs[i]); } // decide which side to use diff --git a/src/main/java/net/wurstclient/util/BlockUtils.java b/src/main/java/net/wurstclient/util/BlockUtils.java index 139b0a6c..f1b70f04 100644 --- a/src/main/java/net/wurstclient/util/BlockUtils.java +++ b/src/main/java/net/wurstclient/util/BlockUtils.java @@ -9,18 +9,25 @@ package net.wurstclient.util; import java.util.ArrayList; import java.util.stream.Stream; +import java.util.stream.StreamSupport; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.client.MinecraftClient; +import net.minecraft.entity.Entity; import net.minecraft.registry.Registries; import net.minecraft.util.Identifier; import net.minecraft.util.InvalidIdentifierException; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; +import net.minecraft.util.math.Vec3d; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.CollisionView; +import net.minecraft.world.RaycastContext; import net.wurstclient.WurstClient; public enum BlockUtils @@ -125,6 +132,45 @@ public enum BlockUtils return getState(pos).isOpaqueFullCube(MC.world, pos); } + public static BlockHitResult raycast(Vec3d from, Vec3d to) + { + RaycastContext context = + new RaycastContext(from, to, RaycastContext.ShapeType.COLLIDER, + RaycastContext.FluidHandling.NONE, MC.player); + + return MC.world.raycast(context); + } + + public static boolean hasLineOfSight(Vec3d from, Vec3d to) + { + return raycast(from, to).getType() == HitResult.Type.MISS; + } + + public static boolean hasLineOfSight(Vec3d to) + { + return raycast(RotationUtils.getEyesPos(), to) + .getType() == HitResult.Type.MISS; + } + + /** + * Returns a stream of all blocks that collide with the given box. + * + *

+ * Unlike {@link CollisionView#getBlockCollisions(Entity, Box)}, this method + * breaks the voxel shapes down into their bounding boxes and only returns + * those that actually intersect with the given box. It also assumes that + * the entity is the player. + */ + public static Stream getBlockCollisions(Box box) + { + Iterable blockCollisions = + MC.world.getBlockCollisions(MC.player, box); + + return StreamSupport.stream(blockCollisions.spliterator(), false) + .flatMap(shape -> shape.getBoundingBoxes().stream()) + .filter(shapeBox -> shapeBox.intersects(box)); + } + public static ArrayList getAllInBox(BlockPos from, BlockPos to) { ArrayList blocks = new ArrayList<>(); diff --git a/src/main/java/net/wurstclient/util/ChunkUtils.java b/src/main/java/net/wurstclient/util/ChunkUtils.java index cc8138c6..8eb1047f 100644 --- a/src/main/java/net/wurstclient/util/ChunkUtils.java +++ b/src/main/java/net/wurstclient/util/ChunkUtils.java @@ -55,7 +55,7 @@ public enum ChunkUtils if(packet instanceof ChunkDeltaUpdateS2CPacket p) return p.sectionPos.toChunkPos(); if(packet instanceof ChunkDataS2CPacket p) - return new ChunkPos(p.getX(), p.getZ()); + return new ChunkPos(p.getChunkX(), p.getChunkZ()); return null; } diff --git a/src/main/java/net/wurstclient/util/EntityUtils.java b/src/main/java/net/wurstclient/util/EntityUtils.java index 47918d06..50d6b950 100644 --- a/src/main/java/net/wurstclient/util/EntityUtils.java +++ b/src/main/java/net/wurstclient/util/EntityUtils.java @@ -35,7 +35,7 @@ public enum EntityUtils .filter(IS_ATTACKABLE); } - public static Predicate IS_ATTACKABLE = e -> e != null + public static final Predicate IS_ATTACKABLE = e -> e != null && !e.isRemoved() && (e instanceof LivingEntity && ((LivingEntity)e).getHealth() > 0 || e instanceof EndCrystalEntity @@ -46,11 +46,11 @@ public enum EntityUtils public static Stream getValidAnimals() { return StreamSupport.stream(MC.world.getEntities().spliterator(), true) - .filter(e -> e instanceof AnimalEntity).map(e -> (AnimalEntity)e) + .filter(AnimalEntity.class::isInstance).map(e -> (AnimalEntity)e) .filter(IS_VALID_ANIMAL); } - public static Predicate IS_VALID_ANIMAL = + public static final Predicate IS_VALID_ANIMAL = a -> a != null && !a.isRemoved() && a.getHealth() > 0; /** diff --git a/src/main/java/net/wurstclient/util/FakePlayerEntity.java b/src/main/java/net/wurstclient/util/FakePlayerEntity.java index 8f75312a..565f7af5 100644 --- a/src/main/java/net/wurstclient/util/FakePlayerEntity.java +++ b/src/main/java/net/wurstclient/util/FakePlayerEntity.java @@ -61,7 +61,7 @@ public class FakePlayerEntity extends OtherClientPlayerEntity private void spawn() { - world.addEntity(getId(), this); + world.addEntity(this); } public void despawn() diff --git a/src/main/java/net/wurstclient/util/GoogleTranslate.java b/src/main/java/net/wurstclient/util/GoogleTranslate.java index 8b68b3fa..b982b34b 100644 --- a/src/main/java/net/wurstclient/util/GoogleTranslate.java +++ b/src/main/java/net/wurstclient/util/GoogleTranslate.java @@ -18,9 +18,11 @@ import java.net.URLEncoder; import java.util.regex.Matcher; import java.util.regex.Pattern; -public class GoogleTranslate +public enum GoogleTranslate { - public String translate(String text, String langFrom, String langTo) + ; + + public static String translate(String text, String langFrom, String langTo) { String html = getHTML(text, langFrom, langTo); String translated = parseHTML(html); @@ -31,7 +33,7 @@ public class GoogleTranslate return translated; } - private String getHTML(String text, String langFrom, String langTo) + private static String getHTML(String text, String langFrom, String langTo) { URL url = createURL(text, langFrom, langTo); @@ -57,7 +59,7 @@ public class GoogleTranslate } } - private URL createURL(String text, String langFrom, String langTo) + private static URL createURL(String text, String langFrom, String langTo) { try { @@ -75,7 +77,7 @@ public class GoogleTranslate } } - private URLConnection setupConnection(URL url) throws IOException + private static URLConnection setupConnection(URL url) throws IOException { URLConnection connection = url.openConnection(); @@ -87,7 +89,7 @@ public class GoogleTranslate } @SuppressWarnings("deprecation") - private String parseHTML(String html) + private static String parseHTML(String html) { String regex = "class=\"result-container\">([^<]*)<\\/div>"; Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); diff --git a/src/main/java/net/wurstclient/util/InteractionSimulator.java b/src/main/java/net/wurstclient/util/InteractionSimulator.java new file mode 100644 index 00000000..0d79b302 --- /dev/null +++ b/src/main/java/net/wurstclient/util/InteractionSimulator.java @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.util; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.wurstclient.WurstClient; +import net.wurstclient.settings.SwingHandSetting.SwingHand; + +/** + * A utility class to turn right-clicking a block into a simple one-liner, + * without sacrificing anti-cheat resistance or customizability. + * + *

+ * Accurately replicates {@link MinecraftClient#doItemUse()} as of 1.20.2, while + * being much easier to read and adding convenient ways to change parts of the + * behavior. + */ +public enum InteractionSimulator +{ + ; + + private static final MinecraftClient MC = WurstClient.MC; + + /** + * @see #rightClickBlock(BlockHitResult, SwingHand) + */ + public static void rightClickBlock(BlockHitResult hitResult) + { + rightClickBlock(hitResult, SwingHand.CLIENT); + } + + /** + * Right-clicks the block at the given hit result, which may end up placing + * a block, interacting with an existing block, or using an equipped item. + * + *

+ * This method automatically decides which hand to use in order to match + * vanilla behavior as closely as possible. If you need to force a specific + * hand, use {@link #rightClickBlock(BlockHitResult, Hand, SwingHand)} + * instead. + * + *

+ * To fully match vanilla behavior, do the following before calling this + * method: + *

    + *
  1. Face the block and ensure that there are no other blocks or entities + * preventing line of sight.
  2. + *
  3. Ensure that {@code MC.interactionManager.isBreakingBlock()} returns + * {@code false}.
  4. + *
  5. Set the item use cooldown to 4 ticks. (Yes, even if subsequent checks + * fail and the interaction doesn't happen.)
  6. + *
  7. Ensure that {@code MC.player.isRiding()} returns {@code false}.
  8. + *
+ */ + public static void rightClickBlock(BlockHitResult hitResult, + SwingHand swing) + { + for(Hand hand : Hand.values()) + { + ItemStack stack = MC.player.getStackInHand(hand); + if(interactBlockAndSwing(hitResult, swing, hand, stack)) + return; + + if(interactItemAndSwing(stack, swing, hand)) + return; + } + } + + /** + * @see #rightClickBlock(BlockHitResult, Hand, SwingHand) + */ + public static void rightClickBlock(BlockHitResult hitResult, Hand hand) + { + rightClickBlock(hitResult, hand, SwingHand.CLIENT); + } + + /** + * Right-clicks the block at the given hit result, which may end up placing + * a block, interacting with an existing block, or using an equipped item. + * + *

+ * This method forces the specified hand to be used, which would not be + * possible in vanilla. For a more realistic right-click simulation, use + * {@link #rightClickBlock(BlockHitResult, SwingHand)} instead. + */ + public static void rightClickBlock(BlockHitResult hitResult, Hand hand, + SwingHand swing) + { + ItemStack stack = MC.player.getStackInHand(hand); + if(interactBlockAndSwing(hitResult, swing, hand, stack)) + return; + + interactItemAndSwing(stack, swing, hand); + } + + /** + * Calls {@code interactBlock()} and swings the hand if the game would + * normally do that. + * + * @return {@code true} if this call should consume the click and prevent + * any further block/item interactions + */ + private static boolean interactBlockAndSwing(BlockHitResult hitResult, + SwingHand swing, Hand hand, ItemStack stack) + { + // save old stack size and call interactBlock() + int oldCount = stack.getCount(); + ActionResult result = + MC.interactionManager.interactBlock(MC.player, hand, hitResult); + + // swing hand and reset equip animation + if(result.shouldSwingHand()) + { + swing.swing(hand); + + if(!stack.isEmpty() && (stack.getCount() != oldCount + || MC.interactionManager.hasCreativeInventory())) + MC.gameRenderer.firstPersonRenderer.resetEquipProgress(hand); + } + + return result != ActionResult.PASS; + } + + /** + * Calls {@code interactItem()} and swings the hand if the game would + * normally do that. + * + * @return {@code true} if this call should consume the click and prevent + * any further block/item interactions + */ + private static boolean interactItemAndSwing(ItemStack stack, + SwingHand swing, Hand hand) + { + // pass if hand is empty + if(stack.isEmpty()) + return false; + + // call interactItem() + ActionResult result = + MC.interactionManager.interactItem(MC.player, hand); + + // swing hand + if(result.shouldSwingHand()) + swing.swing(hand); + + // reset equip animation + if(result.isAccepted()) + { + MC.gameRenderer.firstPersonRenderer.resetEquipProgress(hand); + return true; + } + + return false; + } +} diff --git a/src/main/java/net/wurstclient/util/ItemUtils.java b/src/main/java/net/wurstclient/util/ItemUtils.java index bcd9d874..470b6847 100644 --- a/src/main/java/net/wurstclient/util/ItemUtils.java +++ b/src/main/java/net/wurstclient/util/ItemUtils.java @@ -7,7 +7,16 @@ */ package net.wurstclient.util; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ToolItem; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtElement; +import net.minecraft.nbt.NbtList; import net.minecraft.registry.Registries; import net.minecraft.util.Identifier; import net.minecraft.util.InvalidIdentifierException; @@ -46,4 +55,33 @@ public enum ItemUtils return null; } } + + public static float getAttackSpeed(ToolItem item) + { + return (float)item.getAttributeModifiers(EquipmentSlot.MAINHAND) + .get(EntityAttributes.GENERIC_ATTACK_SPEED).stream().findFirst() + .orElseThrow().getValue(); + } + + /** + * Adds the specified enchantment to the specified item stack. Unlike + * {@link ItemStack#addEnchantment(Enchantment, int)}, this method doesn't + * limit the level to 127. + */ + public static void addEnchantment(ItemStack stack, Enchantment enchantment, + int level) + { + Identifier id = EnchantmentHelper.getEnchantmentId(enchantment); + NbtList nbt = getOrCreateNbtList(stack, ItemStack.ENCHANTMENTS_KEY); + nbt.add(EnchantmentHelper.createNbt(id, level)); + } + + public static NbtList getOrCreateNbtList(ItemStack stack, String key) + { + NbtCompound nbt = stack.getOrCreateNbt(); + if(!nbt.contains(key, NbtElement.LIST_TYPE)) + nbt.put(key, new NbtList()); + + return nbt.getList(key, NbtElement.COMPOUND_TYPE); + } } diff --git a/src/main/java/net/wurstclient/util/ListWidget.java b/src/main/java/net/wurstclient/util/ListWidget.java index be6b52d5..95552f0e 100644 --- a/src/main/java/net/wurstclient/util/ListWidget.java +++ b/src/main/java/net/wurstclient/util/ListWidget.java @@ -325,11 +325,12 @@ public abstract class ListWidget extends AbstractParentElement } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double amount) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { if(!isVisible()) return false; - scrollAmount -= amount * itemHeight / 2.0D; + scrollAmount -= verticalAmount * itemHeight / 2.0D; return true; } diff --git a/src/main/java/net/wurstclient/util/OverlayRenderer.java b/src/main/java/net/wurstclient/util/OverlayRenderer.java index bc3d211c..df2230a9 100644 --- a/src/main/java/net/wurstclient/util/OverlayRenderer.java +++ b/src/main/java/net/wurstclient/util/OverlayRenderer.java @@ -38,7 +38,7 @@ public final class OverlayRenderer public void updateProgress() { prevProgress = progress; - progress = IMC.getInteractionManager().getCurrentBreakingProgress(); + progress = MC.interactionManager.currentBreakingProgress; if(progress < prevProgress) prevProgress = progress; diff --git a/src/main/java/net/wurstclient/util/RotationUtils.java b/src/main/java/net/wurstclient/util/RotationUtils.java index 3456bba4..f17bdfb7 100644 --- a/src/main/java/net/wurstclient/util/RotationUtils.java +++ b/src/main/java/net/wurstclient/util/RotationUtils.java @@ -14,7 +14,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.wurstclient.RotationFaker; import net.wurstclient.WurstClient; -import net.wurstclient.mixinterface.IClientPlayerEntity; public enum RotationUtils { @@ -29,16 +28,16 @@ public enum RotationUtils player.getZ()); } - public static Vec3d getClientLookVec() + public static Vec3d getClientLookVec(float partialTicks) { ClientPlayerEntity player = WurstClient.MC.player; float f = 0.017453292F; float pi = (float)Math.PI; - float f1 = MathHelper.cos(-player.getYaw() * f - pi); - float f2 = MathHelper.sin(-player.getYaw() * f - pi); - float f3 = -MathHelper.cos(-player.getPitch() * f); - float f4 = MathHelper.sin(-player.getPitch() * f); + float f1 = MathHelper.cos(-player.getYaw(partialTicks) * f - pi); + float f2 = MathHelper.sin(-player.getYaw(partialTicks) * f - pi); + float f3 = -MathHelper.cos(-player.getPitch(partialTicks) * f); + float f4 = MathHelper.sin(-player.getPitch(partialTicks) * f); return new Vec3d(f2 * f3, f4, f1 * f3); } @@ -90,9 +89,9 @@ public enum RotationUtils { Rotation needed = getNeededRotations(vec); - IClientPlayerEntity player = WurstClient.IMC.getPlayer(); - float lastReportedYaw = MathHelper.wrapDegrees(player.getLastYaw()); - float lastReportedPitch = MathHelper.wrapDegrees(player.getLastPitch()); + ClientPlayerEntity player = WurstClient.MC.player; + float lastReportedYaw = MathHelper.wrapDegrees(player.lastYaw); + float lastReportedPitch = MathHelper.wrapDegrees(player.lastPitch); float diffYaw = MathHelper.wrapDegrees(lastReportedYaw - needed.yaw); float diffPitch = @@ -106,9 +105,9 @@ public enum RotationUtils float yaw = MathHelper.wrapDegrees(rotation.getYaw()); float pitch = MathHelper.wrapDegrees(rotation.getPitch()); - IClientPlayerEntity player = WurstClient.IMC.getPlayer(); - float lastReportedYaw = MathHelper.wrapDegrees(player.getLastYaw()); - float lastReportedPitch = MathHelper.wrapDegrees(player.getLastPitch()); + ClientPlayerEntity player = WurstClient.MC.player; + float lastReportedYaw = MathHelper.wrapDegrees(player.lastYaw); + float lastReportedPitch = MathHelper.wrapDegrees(player.lastPitch); float diffYaw = MathHelper.wrapDegrees(lastReportedYaw - yaw); float diffPitch = MathHelper.wrapDegrees(lastReportedPitch - pitch); diff --git a/src/main/resources/assets/wurst/lang/cs_cz.json b/src/main/resources/assets/wurst/lang/cs_cz.json index 8040d9ed..ae1e5378 100644 --- a/src/main/resources/assets/wurst/lang/cs_cz.json +++ b/src/main/resources/assets/wurst/lang/cs_cz.json @@ -96,7 +96,7 @@ "description.wurst.hack.killpotion": "Vytvoří lektvar, který může zabít téměř cokoliv, včetně hráčů v kreativním režimu. Nefunguje na nemrtvé, protože jsou již mrtví.\n\nVyžaduje kreativní režim.", "description.wurst.hack.liquids": "Umožňuje umístit bloky do kapalin.", "description.wurst.hack.lsd": "Způsobuje halucinace.", - "description.wurst.hack.masstpa": "Odešle požadavek na TPA všem hráčům.\nZastaví, když někdo přijme.", + "description.wurst.hack.masstpa": "Odešle požadavek na TPA všem hráčům.", "description.wurst.hack.mileycyrus": "Neustálé twerkování.", "description.wurst.hack.mobesp": "Zvýrazní moby v okolí.", "description.wurst.hack.mobspawnesp": "Zvýrazní oblasti, kde se mohou mobové objevovat.\n§ežlutá§r - mobové se mohou oběvovat v noci\n§cred§r - mobové se mohou oběvovat vždy", diff --git a/src/main/resources/assets/wurst/lang/de_de.json b/src/main/resources/assets/wurst/lang/de_de.json index 48b5dd2c..f34eb72f 100644 --- a/src/main/resources/assets/wurst/lang/de_de.json +++ b/src/main/resources/assets/wurst/lang/de_de.json @@ -98,7 +98,7 @@ "description.wurst.hack.killpotion": "Generiert einen Trank, der fast alles töten kann, sogar Spieler im Kreativmodus. Funktioniert nicht bei untoten Mobs, weil die nach der Spiellogik bereits tot sind.\n\nFunktioniert nur im Kreativmodus.", "description.wurst.hack.liquids": "Ermöglicht dir, Blöcke direkt in bzw. an Flüssigkeiten zu platzieren.", "description.wurst.hack.lsd": "Verursacht Halluzinationen.", - "description.wurst.hack.masstpa": "Sendet TPA-Requests an alle Spieler.\nHört auf, sobald jemand akzeptiert.", + "description.wurst.hack.masstpa": "Sendet TPA-Requests an alle Spieler.", "description.wurst.hack.mileycyrus": "Lässt dich twerken.", "description.wurst.hack.mobesp": "Markiert Mobs in deiner Umgebung.", "description.wurst.hack.mobspawnesp": "Markiert Orte, an denen Mobs spawnen können.\n§eGelb§r - Mobs können nachts spawnen\n§cRot§r - Mobs können jederzeit spawnen", @@ -136,5 +136,6 @@ "button.wurst.nochatreports.signatures_status": "Signaturen: ", "description.wurst.nochatreports.message_is_reportable": "Diese Nachricht hat eine gültige Signatur und kann daher für betrügerische Chat-Reports missbraucht werden.", "gui.wurst.generic.allcaps_blocked": "BLOCKIERT", - "gui.wurst.generic.allcaps_allowed": "ERLAUBT" + "gui.wurst.generic.allcaps_allowed": "ERLAUBT", + "key.wurst.zoom": "Zoom" } \ No newline at end of file diff --git a/src/main/resources/assets/wurst/lang/en_us.json b/src/main/resources/assets/wurst/lang/en_us.json index 32551b43..6deb70f2 100644 --- a/src/main/resources/assets/wurst/lang/en_us.json +++ b/src/main/resources/assets/wurst/lang/en_us.json @@ -46,6 +46,7 @@ "description.wurst.hack.autotool": "Automatically equips the fastest applicable tool in your hotbar when you try to break a block.", "description.wurst.hack.autototem": "Automatically moves totems of undying to your off-hand.", "description.wurst.hack.autowalk": "Makes you walk automatically.", + "description.wurst.hack.barrieresp": "Allows you to see nearby barrier blocks.\n\nNote: Due to Minecraft bug MC-47607, this hack does not work if your \"Particles\" option is set to \"Minimal\".", "description.wurst.hack.basefinder": "Finds player bases by searching for man-made blocks.\nThe blocks that it finds will be highlighted in the selected color.\nGood for finding faction bases.", "description.wurst.hack.blink": "Suspends all motion updates while enabled.", "description.wurst.hack.boatfly": "Allows you to fly with boats and other vehicles.\nPress the sprint key to go down faster.", @@ -100,7 +101,7 @@ "description.wurst.hack.killpotion": "Generates a potion that can kill almost anything, including players in Creative mode. Does not work on undead mobs, since they are already dead.\n\nRequires Creative mode.", "description.wurst.hack.liquids": "Allows you to place blocks in liquids.", "description.wurst.hack.lsd": "Causes hallucinations.", - "description.wurst.hack.masstpa": "Sends a TPA request to all players.\nStops if someone accepts.", + "description.wurst.hack.masstpa": "Sends a TPA request to all players.", "description.wurst.hack.mileycyrus": "Makes you twerk.", "description.wurst.hack.mobesp": "Highlights nearby mobs.", "description.wurst.hack.mobspawnesp": "Highlights areas where mobs can spawn.\n§eyellow§r - mobs can spawn at night\n§cred§r - mobs can always spawn", @@ -189,5 +190,6 @@ "button.wurst.nochatreports.signatures_status": "Signatures: ", "description.wurst.nochatreports.message_is_reportable": "This message has a valid signature and is thus vulnerable to fraudulent chat reports.", "gui.wurst.generic.allcaps_blocked": "BLOCKED", - "gui.wurst.generic.allcaps_allowed": "ALLOWED" + "gui.wurst.generic.allcaps_allowed": "ALLOWED", + "key.wurst.zoom": "Zoom" } \ No newline at end of file diff --git a/src/main/resources/assets/wurst/lang/fr_fr.json b/src/main/resources/assets/wurst/lang/fr_fr.json index c9cb3691..bbd7be9e 100644 --- a/src/main/resources/assets/wurst/lang/fr_fr.json +++ b/src/main/resources/assets/wurst/lang/fr_fr.json @@ -93,7 +93,7 @@ "description.wurst.hack.killpotion": "Génère une potion qui peut presque tout tuer, y compris les joueurs en mode Créatif. Ne fonctionne pas sur les monstres morts-vivants, car ils sont déjà morts.\n\nNécessite le mode Créatif.", "description.wurst.hack.liquids": "Permet de placer des blocs dans des liquides.", "description.wurst.hack.lsd": "Provoque des hallucinations.", - "description.wurst.hack.masstpa": "Envoie une requête TPA à tous les joueurs.\nS'arrête si quelqu'un accepte.", + "description.wurst.hack.masstpa": "Envoie une requête TPA à tous les joueurs.", "description.wurst.hack.mileycyrus": "Vous fait twerker.", "description.wurst.hack.mobesp": "Met en évidence les monstres à proximité.", "description.wurst.hack.mobspawnesp": "Met en évidence les zones où les monstres peuvent apparaître.\n§ejaune§r - les monstres peuvent apparaître la nuit\n§crouge§r - les monstres peuvent toujours apparaître", @@ -180,5 +180,6 @@ "button.wurst.nochatreports.signatures_status": "Signatures: ", "description.wurst.nochatreports.message_is_reportable": "Ce message a une signature valide et est donc vulnérable aux signalements de chat frauduleux.", "gui.wurst.generic.allcaps_blocked": "BLOQUÉ", - "gui.wurst.generic.allcaps_allowed": "AUTORISÉ" + "gui.wurst.generic.allcaps_allowed": "AUTORISÉ", + "key.wurst.zoom": "Zoom" } \ No newline at end of file diff --git a/src/main/resources/assets/wurst/lang/it_it.json b/src/main/resources/assets/wurst/lang/it_it.json index 1d70da38..4c46f1fd 100644 --- a/src/main/resources/assets/wurst/lang/it_it.json +++ b/src/main/resources/assets/wurst/lang/it_it.json @@ -96,7 +96,7 @@ "description.wurst.hack.killpotion": "Genera una pozione che può uccidere quasi tutto, inclusi i giocatori in modalità Creativa. Non funziona sui mob non morti, poiché sono già morti.\n\nRichiede la modalità Creativa.", "description.wurst.hack.liquids": "Ti permette di piazzare blocchi nei liquidi.", "description.wurst.hack.lsd": "Causa allucinazioni da LSD.", - "description.wurst.hack.masstpa": "Manda una richiesta di teletrasporto a tutti i giocatori.\nSi ferma se qualcuno accetta.", + "description.wurst.hack.masstpa": "Manda una richiesta di teletrasporto a tutti i giocatori.", "description.wurst.hack.mileycyrus": "Ti fa twerkare.", "description.wurst.hack.mobesp": "Evidenzia i mob vicini.", "description.wurst.hack.mobspawnesp": "Evidenzia le aree dove i mob possono spawnare.\n§egiallo§r - I mob possono nascere durante la notte\n§crosso§r - i mob possono nascere sempre", diff --git a/src/main/resources/assets/wurst/lang/ja_jp.json b/src/main/resources/assets/wurst/lang/ja_jp.json index 643433c9..d90d1c41 100644 --- a/src/main/resources/assets/wurst/lang/ja_jp.json +++ b/src/main/resources/assets/wurst/lang/ja_jp.json @@ -1,9 +1,11 @@ { + "description.wurst.hack.aimassist": "近くの存在を狙うのに役立ちます。", "description.wurst.hack.airplace": "空中にブロックを設置できるようになる。", "description.wurst.hack.anchoraura": "リスポーンアンカーを自動で設置(任意)、チャージ、爆発させ、付近にいるエンティティを倒す。", "description.wurst.hack.antiafk": "離席を検知されないよう、辺りをランダムに歩き回る。\n最低3×3の広さの自由なスペースが必要。", "description.wurst.hack.antiblind": "盲目や暗闇の効果を防ぎます。\nOptiFineとの互換性はありません。", "description.wurst.hack.anticactus": "サボテンのダメージを無効化する。", + "description.wurst.hack.antientitypush": "プレイヤーやモブに押されるのを防ぎます。", "description.wurst.hack.antihunger": "歩行中に空腹度ゲージの減少を抑える。", "description.wurst.hack.antiknockback": "プレイヤーやモブからのノックバックを無効化する。", "description.wurst.hack.antispam": "同じ内容のメッセージにカウントを表示し、チャットスパムを防ぐ。", @@ -14,8 +16,10 @@ "description.wurst.setting.arrowdmg.trident_yeet_mode": "有効時、トライデントがより遠くまで飛ばせるようになる。ダメージ量や激流エンチャントには影響しない模様。\n\n§c§l注意: §rこのオプションを有効化した場合、トライデントをロストしやすくなる。", "description.wurst.hack.autoarmor": "防具を自動で管理する。", "description.wurst.hack.autobuild": "自動で建築を行う。\nブロックを一つ設置することで建築が開始される。", + "description.wurst.hack.autocomplete": "大規模な言語モデルを使用してチャット メッセージをオートコンプリートします。 API アクセスのある OpenAI アカウント、または oobabooga Web UI を使用してローカルにインストールされた言語モデルのいずれかが必要です。", "description.wurst.hack.autodrop": "必要のないアイテムを自動で捨てる。", "description.wurst.hack.autoleave": "残り体力が少なくなるとに自動的にサーバーから切断する。", + "description.wurst.hack.autolibrarian": "村人を自動的に訓練して、特定の魔法の本を販売する司書にします。 このハックを使用すると、すぐに取引ホール全体をセットアップできます。", "description.wurst.hack.autoeat": "必要であれば自動で食料を食べる。", "description.wurst.setting.autoeat.target_hunger": "食料から得られる満腹度を無駄にしないようにしつつ、満腹度をこのレベル以上に維持しようとする。", "description.wurst.setting.autoeat.min_hunger": "食料から得られる満腹度を無駄にしても、常に満腹度をこのレベル以上に維持しようとする。\n6.5 - 通常版のマインクラフトの食料では、満腹度が無駄になることはない。\n10.0 - 満腹度の無駄を無視して常に満腹度を満タンにする。", @@ -96,7 +100,7 @@ "description.wurst.hack.killpotion": "クリエイティブモードのプレイヤーを含む、ほぼすべての生き物を倒すことができるポーションを生成する。\nアンデッドのモブはすでに死んでいるため使用不可。\n\nクリエイティブモード必須。", "description.wurst.hack.liquids": "水面に直接ブロックを設置できるようになる。", "description.wurst.hack.lsd": "幻覚症状を引き起こす。", - "description.wurst.hack.masstpa": "すべてのプレイヤーにTPA(テレポート)リクエストを送信する。\n誰かに許可されると停止する。", + "description.wurst.hack.masstpa": "すべてのプレイヤーにTPA(テレポート)リクエストを送信する。", "description.wurst.hack.mileycyrus": "腰振りダンスをする。", "description.wurst.hack.mobesp": "付近のモブをハイライト表示する。", "description.wurst.hack.mobspawnesp": "モブがスポーンする可能性のあるエリアをハイライト表示する。\n§e黄色§r - モブが夜にスポーンする可能性あり\n§c赤色§r - モブが常時スポーンする可能性あり", @@ -132,6 +136,7 @@ "description.wurst.hack.rainbowui": "§cす§aべ§9て§cを§aカ§9ラ§cフ§aル§9に§cす§aる§9。", "description.wurst.hack.reach": "より遠くに手が届くようになる。", "description.wurst.hack.remoteview": "他人の視点でワールドを見ることができるようになる。\n.rv で特定のエンティティを対象として指定可能。", + "description.wurst.hack.restock": "インベントリから選択したアイテムを自動的に手に補充します。 FastPlace と併用するとより効果的です。", "description.wurst.hack.safewalk": "ブロックの端からの落下を防ぐ。", "description.wurst.hack.scaffoldwalk": "足元に自動でブロックを設置する。", "description.wurst.hack.search": "特定のブロックを虹色でハイライト表示し、探しやすくする。", @@ -184,4 +189,4 @@ "description.wurst.nochatreports.message_is_reportable": "このメッセージには有効な署名があるため、不正なチャット レポートに対して脆弱です。", "gui.wurst.generic.allcaps_blocked": "ブロックされました", "gui.wurst.generic.allcaps_allowed": "許可された" -} \ No newline at end of file +} diff --git a/src/main/resources/assets/wurst/lang/ko_kr.json b/src/main/resources/assets/wurst/lang/ko_kr.json new file mode 100644 index 00000000..22368ac6 --- /dev/null +++ b/src/main/resources/assets/wurst/lang/ko_kr.json @@ -0,0 +1,155 @@ +{ + "description.wurst.hack.aimassist": "주변 엔티티를 조준하는 데 도움을 줍니다.", + "description.wurst.hack.airplace": "공중에 블록을 배치할 수 있게 해줍니다.", + "description.wurst.hack.antiafk": "자리비움 검출기에서 숨기기 위해 무작위로 이동합니다.\n적어도 3x3 블록의 빈 공간이 필요합니다.", + "description.wurst.hack.antiblind": "실명 및 어둠 효과를 방지합니다.\nOptiFine과 호환되지 않습니다.", + "description.wurst.hack.anticactus": "선인장 대미지를 받지 않습니다.", + "description.wurst.hack.antientitypush": "다른 플레이어나 몹에게 밀려나는 것을 방지합니다.", + "description.wurst.hack.antihunger": "걷는 동안 배고픔 속도를 늦춥니다.", + "description.wurst.hack.antiknockback": "플레이어나 몹으로부터 넉백을 받지 않도록 합니다.", + "description.wurst.hack.antispam": "반복된 메시지에 카운터를 추가하여 채팅 스팸을 차단합니다.", + "description.wurst.hack.antiwaterpush": "물에 밀리는 것을 방지합니다.", + "description.wurst.setting.arrowdmg.packets": "전송할 패킷 수.\n패킷이 많을수록 공격력이 높아집니다.", + "description.wurst.hack.autoarmor": "자동으로 방어구를 관리합니다.", + "description.wurst.hack.autobuild": "자동으로 건물을 건설합니다.\n한 개의 블록을 놓으면 건설을 시작합니다.", + "description.wurst.hack.autocomplete": "대형 언어 모델을 사용하여 채팅 메시지를 자동 완성합니다. OpenAI 계정 API 접근 권한이나 지역적으로 설치된 oobabooga 웹 UI가 필요합니다.", + "description.wurst.hack.autodrop": "원하지 않는 아이템을 자동으로 버립니다.", + "description.wurst.hack.autoleave": "체력이 낮을 때 자동으로 서버에서 나갑니다.", + "description.wurst.hack.autolibrarian": "특정 인챈트된 책을 판매하는 마을 주민을 자동으로 훈련합니다. 이 핵을 사용하면 전체 거래 구간을 짧은 시간 내에 설정할 수 있습니다.", + "description.wurst.hack.autoeat": "음식을 필요할때 자동으로 섭취합니다.", + "description.wurst.setting.autoeat.target_hunger": "배고픔 게이지를 이 수준 이상으로 유지하려고 하지만 배고픔 점수를 낭비하지 않습니다.", + "description.wurst.setting.autoeat.min_hunger": "항상 이 수준 이상으로 배고픔 게이지를 유지하되, 음식 점수를 낭비하더라도 상관하지 않습니다.\n6.5 - 바닐라 음식 아이템으로는 낭비를 일으키지 않습니다.\n10.0 - 낭비를 무시하고 배고픔 게이지를 항상 가득 채웁니다.", + "description.wurst.setting.autoeat.injured_hunger": "부상당했을 때 이 수준 이상으로 배고픔 게이지를 채우며 음식 점수를 낭비하더라도 상관하지 않습니다.\n10.0 - 가장 빠른 회복\n9.0 - 가장 느린 회복\n<9.0 - 회복 없음\n<3.5 - 달리기 금지", + "description.wurst.setting.autoeat.injury_threshold": "작은 부상으로 인해 모든 음식이 낭비되는 것을 방지합니다. AutoEat은 최소한 만큼의 체력을 잃었을 때만 부상 상태로 간주합니다.", + "description.wurst.setting.autoeat.eat_while_walking": "걷는 동안 음식을 먹는 것은 속도를 늦춥니다. 권장하지 않습니다.", + "description.wurst.setting.autoeat.allow_poison": "독성 음식은 시간 경과에 따라 피해를 입힙니다.\n권장하지 않습니다.", + "description.wurst.hack.autofarm": "곡물, 당근, 감자, 비트, 호박, 수박, 선인장, 사탕수수, 켈프, 대나무, 네더 와트, 코코아 열매에 대해 자동으로 작물을 수확하고 다시 심습니다.", + "description.wurst.hack.autofish": "최고의 낚싯대를 사용하여 자동으로 물고기를 잡습니다. 물고기를 잡는 동안 더 좋은 낚싯대를 발견하면 자동으로 전환됩니다.", + "description.wurst.hack.automine": "시선을 정한 블록을 자동으로 채굴합니다.", + "description.wurst.hack.autopotion": "체력이 낮을 때 즉시 회복 물약을 자동으로 던집니다.", + "description.wurst.hack.autoreconnect": "서버에서 강제 퇴장당할 경우 자동으로 재접속합니다.", + "description.wurst.hack.autorespawn": "죽을 경우 자동으로 리스폰합니다.", + "description.wurst.hack.autosign": "원하는 글을 모든 표지판에 즉시 작성합니다. 활성화된 후 첫 번째 표지판에 일반적으로 글을 작성하여 모든 다른 표지판에 적용할 수 있습니다.", + "description.wurst.hack.autosoup": "체력이 낮을 때 자동으로 수프를 먹습니다.\n\n§l참고:§r 이 해킹 기능은 배고픔을 무시하고 수프를 직접 먹으면 체력이 회복된다고 가정합니다. 만약 이 기능이 서버에서 설정되어 있지 않다면 AutoEat을 사용하세요.", + "description.wurst.hack.autosprint": "자동으로 달립니다.", + "description.wurst.hack.autosteal": "여는 모든 상자와 셜커 상자에서 모든 것을 자동으로 훔칩니다.", + "description.wurst.hack.autoswim": "수영 애니메이션을 자동으로 실행합니다.", + "description.wurst.hack.autoswitch": "항상 손에 들고 있는 아이템을 전환합니다.\n\n§l팁:§r 이 기능은 다양한 색의 양털 또는 콘크리트 블록을 핫바에 넣고 BuildRandom과 함께 사용하는 것이 좋습니다.", + "description.wurst.hack.autowalk": "자동으로 걷게 해줍니다.", + "description.wurst.hack.basefinder": "인공 블록을 검색하여 베이스를 찾습니다.\n찾은 블록은 선택한 색상으로 강조됩니다.\nFaction 기지를 찾는 데 유용합니다.", + "description.wurst.hack.buildrandom": "주변에 무작위로 블록을 배치합니다.", + "description.wurst.hack.bunnyhop": "자동으로 점프합니다.", + "description.wurst.hack.cameradistance": "카메라 거리를 3인칭에서 변경할 수 있습니다.", + "description.wurst.hack.cameranoclip": "카메라가 벽을 통과할 수 있습니다(3인칭).", + "description.wurst.hack.cavefinder": "선택한 색상으로 동굴을 강조하여 찾도록 도와줍니다.", + "description.wurst.hack.chattranslator": "구글 번역을 이용하여 채팅을 번역합니다.", + "description.wurst.hack.chestesp": "주변의 상자를 강조합니다.", + "description.wurst.hack.clickaura": "클릭할 때 가장 가까운 유효한 엔티티를 자동으로 공격합니다.\n\n§c§l경고:§r ClickAura는 Killaura보다 더욱 의심스러워 보이며, 플러그인에 탐지되기 쉽습니다. 대신 Killaura나 TriggerBot을 사용하는 것이 좋습니다.", + "description.wurst.hack.creativeflight": "크리에이티브 모드와 같이 비행할 수 있습니다.\n\n§c§l경고:§r NoFall을 사용하지 않으면 낙하 대미지를 입을 수 있습니다.", + "description.wurst.hack.criticals": "모든 공격을 크리티컬로 변경합니다.", + "description.wurst.hack.derp": "머리를 무작위로 움직입니다.\n다른 플레이어에게만 보입니다.", + "description.wurst.hack.dolphin": "물 속에서 자동으로 위아래로 움직이도록 합니다.\n(돌고래처럼)", + "description.wurst.hack.excavator": "선택한 영역 내의 모든 블록을 자동으로 부숩니다.", + "description.wurst.hack.fancychat": "채팅 메시지에서 ASCII 문자를 화려한 유니코드 문자로 바꿉니다. 일부 서버에서 욕설 필터를 우회하는 데 사용할 수 있습니다. \n유니코드 문자를 차단하는 서버에서는 작동하지 않습니다.", + "description.wurst.hack.fastbreak": "블록을 더 빨리 부술 수 있습니다. \n팁: Nuker와 함께 사용할 수 있습니다.", + "description.wurst.hack.fastladder": "사다리를 더 빨리 올라갈 수 있습니다.", + "description.wurst.hack.fastplace": "블록을 5배 더 빨리 배치할 수 있습니다. \n팁: AutoBuild와 같은 다른 해킹을 가속화할 수 있습니다.", + "description.wurst.hack.feedaura": "주변의 동물에게 자동으로 사료를 줍니다.", + "description.wurst.hack.fightbot": "자동으로 주변을 돌아다니며 모든 것을 죽이는 봇입니다. \nMobArena에 적합합니다.", + "description.wurst.hack.fish": "수중 중력을 해제하여 물고기처럼 수영할 수 있습니다.", + "description.wurst.hack.flight": "비행이 가능합니다. \n\n§c§l경고:§r NoFall을 사용하지 않으면 낙하 피해를 입을 수 있습니다.", + "description.wurst.hack.follow": "가장 가까운 개체를 따라가는 봇입니다. \n매우 귀찮습니다. \n\n.follow를 사용하여 특정 개체를 따라갈 수 있습니다.", + "description.wurst.hack.forceop": "AuthMe 비밀번호를 크랙합니다. \nOP를 얻는 데 사용할 수 있습니다.", + "description.wurst.hack.glide": "낙하할 때 천천히 떨어집니다. \n\n§c§l경고:§r NoFall을 사용하지 않으면 낙하 피해를 입을 수 있습니다.", + "description.wurst.hack.handnoclip": "벽을 통해 특정 블록에 접근할 수 있습니다.", + "description.wurst.hack.headroll": "항상 고개를 끄덕입니다. \n다른 플레이어에게만 표시됩니다.", + "description.wurst.hack.healthtags": "플레이어의 체력을 이름표에 표시합니다.", + "description.wurst.hack.highjump": "더 높이 점프할 수 있게 해줍니다.\n\n§c§l주의:§r NoFall을 사용하지 않으면 낙하 피해를 입을 수 있습니다.", + "description.wurst.hack.infinichat": "채팅에서 256자 제한을 없애줍니다.\nNBT 데이터를 수정하는 긴 명령어에 유용합니다.\n\n§6§l주의:§r 대화를 위해 권장되지 않습니다. 대부분의 서버는 메시지를 256자로 제한합니다.", + "description.wurst.hack.instantbunker": "자신 주위에 작은 벙커를 만듭니다. 57개의 블록이 필요합니다.", + "description.wurst.setting.invwalk.allow_clickgui": "Wurst의 ClickGUI가 열려있는 동안에도 움직일 수 있게 해줍니다.", + "description.wurst.setting.invwalk.allow_other": "다른 게임 내 화면(상자, 말, 주민 거래 등)이 열려있는 동안에도 움직일 수 있게 해줍니다. 다만 텍스트 상자가 있는 경우에는 예외입니다.", + "description.wurst.hack.itemesp": "떨어진 아이템을 강조합니다.", + "description.wurst.hack.itemgenerator": "랜덤 아이템을 생성하여 땅에 드롭합니다.\n§o크리에이티브 모드 전용입니다.§r", + "description.wurst.hack.jesus": "물 위를 걸을 수 있게 해줍니다.\n이 핵은 약 2000년 전에 예수님이 사용했습니다.", + "description.wurst.hack.jetpack": "마치 제트팩을 가지고 있는 것처럼 날 수 있게 해줍니다.\n\n§c§l주의:§r NoFall을 사용하지 않으면 낙하 피해를 입을 수 있습니다.", + "description.wurst.hack.kaboom": "주변 블록을 폭발처럼 부숩니다.\n서버에 NoCheat+가 없다면 Nuker보다 훨씬 빠를 수 있습니다. 빠른 도구와 약한 블록과 함께 사용하는 것이 가장 효과적입니다.\n참고: 실제로 폭발하는 것은 아닙니다.", + "description.wurst.hack.killauralegit": "감지가 어려운 느린 Killaura입니다.\n일반적인 NoCheat+ 서버에서는 필요하지 않습니다!", + "description.wurst.hack.killaura": "자동으로 주변의 개체를 공격합니다.", + "description.wurst.hack.liquids": "액체 안에 블록을 배치할 수 있게 해줍니다.", + "description.wurst.hack.lsd": "환각을 유발합니다.", + "description.wurst.hack.masstpa": "모든 플레이어에게 TPA 요청을 보냅니다.", + "description.wurst.hack.mileycyrus": "트월킹을 할 수 있게 해줍니다.", + "description.wurst.hack.mobesp": "주변의 몹을 강조합니다.", + "description.wurst.hack.multiaura": "여러 개체를 동시에 공격하는 더 빠른 Killaura입니다.", + "description.wurst.hack.nameprotect": "모든 플레이어 이름을 숨깁니다.", + "description.wurst.hack.nametags": "네임태그의 크기를 크게 변경하여 항상 읽을 수 있게 해줍니다. 또한 웅크리는 플레이어의 네임태그를 볼 수 있게 해줍니다.", + "description.wurst.hack.navigator": "시간이 지남에 따라 사용자의 선호도를 학습하는 검색 가능한 GUI입니다.", + "description.wurst.hack.newchunks": "자신 주변에 최근에 생성된 청크를 강조합니다.", + "description.wurst.hack.noclip": "블록을 자유롭게 통과할 수 있게 해줍니다.\n블록(예: 모래)이 머리 위로 떨어져야 활성화됩니다.\n\n§c§l주의:§r 블록을 통과하는 동안 피해를 입을 수 있습니다!", + "description.wurst.hack.nocomcrash": "Nocom 악용을 통해 서버를 지연시키고 충돌시킵니다.\nPaper 서버에서 작동하지 않습니다. Vanilla, Spigot 및 Fabric에서 테스트된 작동합니다. 일부 AntiCheats에 의해 비활성화될 수 있습니다.", + "description.wurst.hack.nofall": "낙하 피해를 방지합니다.", + "description.wurst.hack.nofireoverlay": "불에 탔을 때 오버레이를 제거합니다.\n\n§c§l주의:§r 이로 인해 알지 못하고 타죽을 수 있습니다.", + "description.wurst.hack.nohurtcam": "피해를 입었을 때 흔들림 효과를 제거합니다.", + "description.wurst.hack.nooverlay": "물과 용암의 오버레이를 제거합니다.", + "description.wurst.hack.nopumpkin": "호박을 머리에 쓸 때 오버레이를 제거합니다.", + "description.wurst.hack.noslowdown": "꿀, 영혼 모래 및 아이템 사용으로 인한 속도 감소 효과를 제거합니다.", + "description.wurst.hack.noweather": "클라이언트 측의 날씨, 시간 및 달의 위상을 변경할 수 있게 해줍니다.", + "description.wurst.hack.noweb": "거미줄에 갇히는 것을 제거합니다.", + "description.wurst.hack.nuker": "주변 블록을 자동으로 부숩니다.", + "description.wurst.hack.nukerlegit": "감지 플러그인을 우회하는 더 느린 Nuker입니다.\n일반적인 NoCheat+ 서버에서는 필요하지 않습니다!", + "description.wurst.hack.openwateresp": "'열린 물'에서 낚시를 하는지 여부를 보여주고 열린 물 계산에 사용되는 영역 주위에 상자를 그립니다.", + "description.wurst.hack.overlay": "블록을 채굴할 때마다 Nuker 애니메이션을 렌더링합니다.", + "description.wurst.hack.panic": "활성화된 모든 핵을 즉시 비활성화합니다.\n이 기능을 사용할 때 주의하세요!", + "description.wurst.hack.parkour": "블록 가장자리에 도달하면 자동으로 점프합니다.\n파쿠르와 점프'n'런에 유용합니다.", + "description.wurst.hack.portalgui": "포탈에서 GUI를 열 수 있게 해줍니다.", + "description.wurst.hack.potionsaver": "정지 상태에서는 모든 물약 효과를 유지합니다.", + "description.wurst.hack.prophuntesp": "블럭 숨바꼭질에서 가짜 블록을 볼 수 있게 해줍니다.\nMineplex서버의 블럭 숨바꼭질을 위해 제작되었으며, 다른 서버에서 작동하지 않을 수 있습니다.", + "description.wurst.hack.protect": "가장 가까운 개체를 따라가고 다른 개체로부터 보호하는 봇입니다.\n가장 가까운 개체 대신 특정 개체를 보호하려면 .protect 명령을 사용하세요.", + "description.wurst.hack.radar": "주변 개체의 위치를 보여줍니다.\n§c빨강색§r - 플레이어\n§6주황색§r - 몬스터\n§a초록색§r - 동물\n§7회색§r - 기타", + "description.wurst.hack.remoteview": "특정 플레이어의 시야를 공유합니다.\n.rv 명령을 사용하여 특정 개체를 대상으로 설정할 수 있습니다.", + "description.wurst.hack.safewalk": "블럭끝에서 떨어지지 않게 해줍니다.", + "description.wurst.hack.scaffoldwalk": "자동으로 발 아래에 블록을 배치합니다.", + "description.wurst.hack.search": "무지개 색상으로 강조하여 특정 블록을 찾는 데 도움을 줍니다.", + "description.wurst.hack.servercrasher": "1.15.x 버전 서버를 충돌시킬 수 있는 아이템을 생성합니다.\n§o크리에이티브 모드 전용.§r", + "description.wurst.hack.skinderp": "스킨의 커버를 무작위로 on/off 합니다.", + "description.wurst.hack.sneak": "웅크리게 합니다.", + "description.wurst.hack.speedhack": "달리기와 점프로 할 때보다 약 2.5배 더 빠르게 달릴 수 있게 해줍니다.\n\n§6§l주의:§r NoCheat+ 버전 3.13.2에서 패치되었습니다. 이전 버전의 NoCheat+에서만 우회됩니다.\n서버의 NoCheat+ 버전을 확인하려면 §l/ncp version§r을 입력하세요.", + "description.wurst.hack.speednuker": "NoCheat+를 우회할 수 없는 더 빠른 버전의 Nuker입니다.", + "description.wurst.hack.spider": "거미처럼 벽을 타고 올라갈 수 있게 해줍니다.", + "description.wurst.hack.step": "모든 블럭을 계단처럼 올라갑니다.", + "description.wurst.hack.tillaura": "자동으로 흙, 잔디 등을 경작화 시킵니다.\nKillaura와 혼동하지 마세요.", + "description.wurst.hack.timer": "개인의 시간 선을 조절합니다.\n단, 서버의 영향을 미치진 않습니다.", + "description.wurst.hack.toomanyhax": "원치 않는 기능을 차단합니다.\n잘못된 핵을 우연히 활성화하여 밴을 당하는 것을 방지할 수 있습니다.\n'핵을 조금만 사용하는' 사람들을 위한 기능입니다.\n\n§6.toomanyhax§r 명령을 사용하여 어떤 기능을 차단할지 선택할 수 있습니다.\n자세한 내용은 §6.help toomanyhax§r를 입력하세요.", + "description.wurst.hack.tp-aura": "가까운 유효한 개체로 텔레포트 하면서 가장 자동으로 공격합니다.", + "description.wurst.hack.trajectories": "화살과 던져지는 아이템의 비행 경로를 예측해 줍니다.", + "description.wurst.hack.treebot": "자동으로 주위를 돌아다니며 나무를 베어줍니다.\n현재는 작은 나무에만 사용 가능합니다.", + "description.wurst.hack.triggerbot": "바라보고 있는 개체를 자동으로 공격합니다.", + "description.wurst.hack.tunneller": "터널을 자동으로 만들어 줍니다.\n\n§c§l주의:§r 이 봇은 용암 및 기타 위험을 피하려고 노력하지만, 죽지 않는다는 보장은 없습니다. 잃어도 괜찮은 장비를 가지고 보내세요.", + "description.wurst.hack.x-ray": "벽을 통해 광물을 볼 수 있게 해줍니다.", + "description.wurst.other_feature.nochatreports": "1.19 버전부터 채팅 메시지에 첨부되는 암호화 서명을 비활성화합니다.\n\n§c§l주의: §c채팅에 §c인증을 §c첨부하여 §c메시지를 §c보내면 §c계정이 §c신고되어 §c멀티플레이어에서 §c글로벌 §c밴 §c처리될 §c수 §c있습니다!§r\n\n채팅에서 무해한 내용을 말한다고 해도, 서명된 메시지는 가짜 채팅 신고를 생성하여 계정이 불공정하게 밴 처리되는 경우가 있을 수 있습니다.\n\n채팅 서명을 다시 활성화하여 채팅을 하려면 계정이 아닌 가계정에서 플레이하는 것을 고려하세요.", + "button.wurst.nochatreports.disable_signatures": "서명 비활성화", + "button.wurst.nochatreports.re-enable_signatures": "서명 활성화", + "description.wurst.setting.generic.pause_attack_on_containers": "상자 화면(상자, 호퍼 등)이 열려 있을 때 공격하지 않습니다.\n상자와 비슷한 메뉴를 표시하는 미니게임 서버에 유용합니다.", + "description.wurst.altmanager.premium": "이 가계정은 비밀번호가 있으며 모든 서버에 접속할 수 있습니다.", + "description.wurst.altmanager.cracked": "이 가계정은 비밀번호가 없으며 크랙 서버에서만 작동합니다.", + "description.wurst.altmanager.failed": "이 가계정으로 마지막으로 로그인 시도한 때 작동하지 않았습니다.", + "description.wurst.altmanager.checked": "비밀번호가 이전에 작동한 적이 있습니다.", + "description.wurst.altmanager.unchecked": "이 가계정으로 로그인에 성공한 적이 없습니다.", + "description.wurst.altmanager.favorite": "이 가계정을 즐겨찾기로 표시했습니다.", + "description.wurst.altmanager.window": "이 버튼은 다른 창을 엽니다.", + "description.wurst.altmanager.window_freeze": "해당 창이 열려 있는 동안 게임이 응답하지 않는 것처럼 보일 수 있습니다.", + "description.wurst.altmanager.fullscreen": "§c전체 화면 모드를 해제하세요!", + "gui.wurst.altmanager.folder_error.title": "'.Wurst encryption' 폴더를 생성할 수 없습니다!", + "gui.wurst.altmanager.folder_error.message": "Wurst가 이 폴더에 액세스할 수 없게 블록한 것 같습니다.\nAltManager는 이 폴더 없이 가계정 목록을 암호화하거나 복호화할 수 없습니다.\nAltManager를 계속 사용할 수 있지만, 이제 만드는 가계정은 저장되지 않습니다.\n\n전체 오류는 다음과 같습니다:\n%s", + "gui.wurst.altmanager.empty.title": "가계정 목록이 비어 있습니다.", + "gui.wurst.altmanager.empty.message": "시작하기 위해 일부 무작위 알트 계정을 원하시나요?", + "gui.wurst.nochatreports.unsafe_server.title": "§4§l주의:§r 위험한 서버", + "gui.wurst.nochatreports.unsafe_server.message": "이 서버는 채팅 서명을 활성화해야 하므로 계정이 가짜 채팅 신고의 위험에 노출됩니다.\n\n채팅 서명을 차단하고 다시 연결한 경우 이 서버에서 채팅할 수 있습니다. 그렇다면 계정을 잃어도 상관없는 가계정으로 플레이하는 것을 고려하세요.\n\n이 서버가 소유한 경우 server.properties에서 'enforce-secure-profile'을 false로 설정하여 수정할 수 있습니다. 전형적인 Mojang의 스타일로, 이 설정은 이름이 의미하는 것과 반대로 작동합니다.", + "toast.wurst.nochatreports.unsafe_server.title": "채팅 메시지가 신고될 수 있습니다", + "toast.wurst.nochatreports.unsafe_server.message": "이 서버에서 전송한 메시지는 Mojang에게 신고될 수 있으며 계정이 모든 서버 밴 처리될 수 있습니다", + "button.wurst.nochatreports.signatures_status": "서명: ", + "description.wurst.nochatreports.message_is_reportable": "이 메시지에는 유효한 서명이 있으므로 가짜 채팅 신고에 취약합니다.", + "gui.wurst.generic.allcaps_blocked": "차단됨", + "gui.wurst.generic.allcaps_allowed": "허용됨" +} diff --git a/src/main/resources/assets/wurst/lang/pl_pl.json b/src/main/resources/assets/wurst/lang/pl_pl.json index e7f6fe2f..309eb1d8 100644 --- a/src/main/resources/assets/wurst/lang/pl_pl.json +++ b/src/main/resources/assets/wurst/lang/pl_pl.json @@ -96,7 +96,7 @@ "description.wurst.hack.killpotion": "Generuje miksturę, która może zabić prawie wszystko, w tym graczy w trybie kreatywnym. Nie działa na nieumarłych mobach, ponieważ są już martwe.\n\nWymaga trybu kreatywnego.", "description.wurst.hack.liquids": "Umożliwia umieszczanie bloków w płynach.", "description.wurst.hack.lsd": "Powoduje halucynacje.", - "description.wurst.hack.masstpa": "Wysyła prośbę TPA do wszystkich graczy.\nPrzestaje, jeśli ktoś zaakceptuje.", + "description.wurst.hack.masstpa": "Wysyła prośbę TPA do wszystkich graczy.", "description.wurst.hack.mileycyrus": "Sprawia, że twerkujesz.", "description.wurst.hack.mobesp": "Podświetla pobliskie moby.", "description.wurst.hack.mobspawnesp": "Podświetla obszary, w których moby mogą się odradzać.\n§eżółty§r - moby mogą odradzać się w nocy\n§cczerwony§r - moby mogą zawsze się odradzać", diff --git a/src/main/resources/assets/wurst/lang/ro_ro.json b/src/main/resources/assets/wurst/lang/ro_ro.json index 140edb9c..b4a508d1 100644 --- a/src/main/resources/assets/wurst/lang/ro_ro.json +++ b/src/main/resources/assets/wurst/lang/ro_ro.json @@ -93,7 +93,7 @@ "description.wurst.hack.killpotion": "Genereaza o potiune care poate ucide orice, inclusiv playerii in Creativ. Nu functioneaza pe mortaciuni, fiindca mortaciunile-s deja moarte.\n\nNecesita Creativ.", "description.wurst.hack.liquids": "Iti permite sa pui block-uri in lichide.", "description.wurst.hack.lsd": "Cauzeaza halucinatii.", - "description.wurst.hack.masstpa": "Trimite TPA request la toti playerii.\nSe opreste atunci cand cineva accepta.", + "description.wurst.hack.masstpa": "Trimite TPA request la toti playerii.", "description.wurst.hack.mileycyrus": "Faci twerk.", "description.wurst.hack.mobesp": "Contureaza mobii din apropiere.", "description.wurst.hack.mobspawnesp": "Contureaza zonele in care mobii se pot spawna.\n§egalben§r - mobii se pot spawna noaptea\n§crosu§r - mobii se pot spawna mereu", diff --git a/src/main/resources/assets/wurst/lang/ru_ru.json b/src/main/resources/assets/wurst/lang/ru_ru.json index ab2ff279..e2b14a8f 100644 --- a/src/main/resources/assets/wurst/lang/ru_ru.json +++ b/src/main/resources/assets/wurst/lang/ru_ru.json @@ -96,7 +96,7 @@ "description.wurst.hack.killpotion": "Создает зелье которое убивает практически кого угодно, даже тех кто в креативе. Не работает на нежити потому что они и так мертвы лол.\n\nДля работы требуется креатив.", "description.wurst.hack.liquids": "Позволяет ставить блоки прямо в жидкостях.", "description.wurst.hack.lsd": "Провоцирует тяжелые галлюцинации.", - "description.wurst.hack.masstpa": "Отправляет запрос на телепортацию всем игрокам.\nОстанавливается если кто-то примет.", + "description.wurst.hack.masstpa": "Отправляет запрос на телепортацию всем игрокам.", "description.wurst.hack.mileycyrus": "Заставляет Вас тверкать.", "description.wurst.hack.mobesp": "Подсвечивает мобов неподалеку.", "description.wurst.hack.mobspawnesp": "Показывает места в которых могут заспавниться мобы.\n§eжёлтым§r - мобы могут заспавниться ночью\n§cкрасным§r - мобы могут заспавниться когда угодно", @@ -183,5 +183,6 @@ "button.wurst.nochatreports.signatures_status": "Подписи: ", "description.wurst.nochatreports.message_is_reportable": "Это сообщение имеет действительную подпись и поэтому уязвимо для заведомо ложных чат-репортов.", "gui.wurst.generic.allcaps_blocked": "ЗАБЛОКИРОВАНО", - "gui.wurst.generic.allcaps_allowed": "РАЗРЕШЕНО" + "gui.wurst.generic.allcaps_allowed": "РАЗРЕШЕНО", + "key.wurst.zoom": "Приблизить" } \ No newline at end of file diff --git a/src/main/resources/assets/wurst/lang/uk_ua.json b/src/main/resources/assets/wurst/lang/uk_ua.json index 2622740d..ae3d46e4 100644 --- a/src/main/resources/assets/wurst/lang/uk_ua.json +++ b/src/main/resources/assets/wurst/lang/uk_ua.json @@ -92,7 +92,7 @@ "description.wurst.hack.killpotion": "Створює зілля вбиває практично будь-кого, навіть тих хто в креативі. Не працює на нежиті, бо вони мертві лол.\n\nДля роботи потрібен креатив.", "description.wurst.hack.liquids": "Дозволяє ставити блоки прямо на рідині.", "description.wurst.hack.lsd": "Провокує тяжкі галюцинації.", - "description.wurst.hack.masstpa": "Надсилає запит на телепортацію всім гравцям.\nЗупиняється, якщо хтось прийме.", + "description.wurst.hack.masstpa": "Надсилає запит на телепортацію всім гравцям.", "description.wurst.hack.mileycyrus": "Примушує вас тверкати.", "description.wurst.hack.mobesp": "Підсвічує мобів знову.", "description.wurst.hack.mobspawnesp": "Показує місця, у яких можуть народитися моби.\n§eжовтим§r - моби можуть народитися вночі\n§cчервоним§r - моби можуть народиться коли завгодно", diff --git a/src/main/resources/assets/wurst/lang/zh_cn.json b/src/main/resources/assets/wurst/lang/zh_cn.json index c80adc71..f531024e 100644 --- a/src/main/resources/assets/wurst/lang/zh_cn.json +++ b/src/main/resources/assets/wurst/lang/zh_cn.json @@ -96,7 +96,7 @@ "description.wurst.hack.killpotion": "生成一个能杀死绝大多数生物(包括创造模式的玩家)的药水,但对那些不死的生物或者已死生物无效。\n\n需要在创造模式下。", "description.wurst.hack.liquids": "取消无法把方块直接放置在水中的限制,允许你直接在水方块中放置方块。", "description.wurst.hack.lsd": "让你像吃了云南蘑菇一样。", - "description.wurst.hack.masstpa": "给每个人发送 TPA 请求。\n直到有人接受就会停止\n\n§c§l警告:§r当在国内服务器使用会因为 Wurst 无法判断中文返回消息而导致 TPA 请求继续。", + "description.wurst.hack.masstpa": "给每个人发送 TPA 请求。\n\n§c§l警告:§r当在国内服务器使用会因为 Wurst 无法判断中文返回消息而导致 TPA 请求继续。", "description.wurst.hack.mileycyrus": "类似疯狂按 Shift 潜行。", "description.wurst.hack.mobesp": "高亮附近的生物。", "description.wurst.hack.mobspawnesp": "高亮生物可以生成的区域。\n§e黄色§r 可以在夜间生成\n§c红色§r - 可以在任意时候生成", @@ -184,5 +184,6 @@ "button.wurst.nochatreports.signatures_status": "签名: ", "description.wurst.nochatreports.message_is_reportable": "此消息有一个有效的签名,因此容易受到欺诈性聊天报告的伤害。", "gui.wurst.generic.allcaps_blocked": "黑名单", - "gui.wurst.generic.allcaps_allowed": "已允许" + "gui.wurst.generic.allcaps_allowed": "已允许", + "key.wurst.zoom": "缩放" } \ No newline at end of file diff --git a/src/main/resources/assets/wurst/lang/zh_hk.json b/src/main/resources/assets/wurst/lang/zh_hk.json index 895f9b46..78bbbd0a 100644 --- a/src/main/resources/assets/wurst/lang/zh_hk.json +++ b/src/main/resources/assets/wurst/lang/zh_hk.json @@ -92,7 +92,7 @@ "description.wurst.hack.killpotion": "生成一個能殺死絕大多數生物嘅葯水,包括創造模式嘅玩家,但對唔死嘅生物抑或已死生物無效。\n\n需要喺創造模式下。", "description.wurst.hack.liquids": "解除限制,允許你喺水中直接放置方塊。", "description.wurst.hack.lsd": "產生食咗雲南蘑菇一樣嘅效果。", - "description.wurst.hack.masstpa": "畀每個人發送 傳送申請。\n直到有人接受就會停止\n\n§c§l警告:§r中文伺服器使用會因為 Wurst 判斷嘅係英文而導致 傳送申請 仍喺繼續。", + "description.wurst.hack.masstpa": "畀每個人發送 傳送申請。\n\n§c§l警告:§r中文伺服器使用會因為 Wurst 判斷嘅係英文而導致 傳送申請 仍喺繼續。", "description.wurst.hack.mileycyrus": "類似瘋狂按 Shift 潛行。", "description.wurst.hack.mobesp": "高亮附近嘅生物。", "description.wurst.hack.mobspawnesp": "高亮生物可以生成嘅區域。\n§e黃色§r 可以喺夜間生成\n§c紅色§r - 可以喺任意時候生成", @@ -164,5 +164,6 @@ "gui.wurst.altmanager.folder_error.title": "無法創建 「.Wurst encryption」 文件夾!", "gui.wurst.altmanager.folder_error.message": "你可能唔小心阻止 Wurst 訪問呢個文件夾。\n如果Wurst無法訪問, AltManager 將無法加密或解密你嘅帳號列表。\n你依然可以使用 AltManager,但你依家創建嘅任何帳號將冇辦法被保存。\n\n全部錯誤如下:\n%s", "gui.wurst.altmanager.empty.title": "你嘅帳號列表係空嘅。", - "gui.wurst.altmanager.empty.message": "你想唔想要啲隨機嘅帳號嚟開始?" + "gui.wurst.altmanager.empty.message": "你想唔想要啲隨機嘅帳號嚟開始?", + "key.wurst.zoom": "縮放" } \ No newline at end of file diff --git a/src/main/resources/assets/wurst/lang/zh_tw.json b/src/main/resources/assets/wurst/lang/zh_tw.json index d50a5d46..51354f24 100644 --- a/src/main/resources/assets/wurst/lang/zh_tw.json +++ b/src/main/resources/assets/wurst/lang/zh_tw.json @@ -96,7 +96,7 @@ "description.wurst.hack.killpotion": "生成一個能殺死絕大多數生物的藥水,包括創造模式的玩家,但對那些不死的生物或者已死生物無效。\n\n需要在創造模式下。", "description.wurst.hack.liquids": "取消限制,允許你在水面上直接放置方塊。", "description.wurst.hack.lsd": "產生和吃了雲南蘑菇一樣的漸變色暈眩效果。", - "description.wurst.hack.masstpa": "給每個人發送TPA請求。\n直到有人接受就會停止\n\n§c§l警告:§r國內服務器使用會因為Wurst判斷的是英文而導致TPA仍在繼續。", + "description.wurst.hack.masstpa": "給每個人發送TPA請求。\n\n§c§l警告:§r國內服務器使用會因為Wurst判斷的是英文而導致TPA仍在繼續。", "description.wurst.hack.mileycyrus": "類似全自動Shift蹲起。", "description.wurst.hack.mobesp": "高亮附近的生物。", "description.wurst.hack.mobspawnesp": "高亮那些生物可以生成的區域。\n§e黃色§r - 可以在夜間生成\n§c紅色§r - 可以在任意時候生成", @@ -183,5 +183,6 @@ "button.wurst.nochatreports.signatures_status": "簽名: ", "description.wurst.nochatreports.message_is_reportable": "此訊息具有有效簽名,因此容易受到欺詐性聊天檢舉的攻擊。", "gui.wurst.generic.allcaps_blocked": "封鎖", - "gui.wurst.generic.allcaps_allowed": "允許" + "gui.wurst.generic.allcaps_allowed": "允許", + "key.wurst.zoom": "縮放" } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 456d1aaa..49a4ad44 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,9 +29,9 @@ "accessWidener" : "wurst.accesswidener", "depends": { - "fabricloader": ">=0.14.19", - "fabric-api": ">=0.81.2", - "minecraft": "~1.20-beta.2", + "fabricloader": ">=0.14.22", + "fabric-api": ">=0.88.4", + "minecraft": "~1.20.2-beta.4", "java": ">=17" }, "suggests": { diff --git a/src/main/resources/wurst.accesswidener b/src/main/resources/wurst.accesswidener index 260ac1ba..83369db1 100644 --- a/src/main/resources/wurst.accesswidener +++ b/src/main/resources/wurst.accesswidener @@ -1,9 +1,22 @@ accessWidener v1 named accessible class net/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier -accessible field net/minecraft/client/toast/ToastManager toastQueue Ljava/util/Deque; -accessible field net/minecraft/client/network/ClientPlayNetworkHandler session Lnet/minecraft/network/encryption/ClientPlayerSession; -accessible field net/minecraft/client/network/ClientPlayNetworkHandler messagePacker Lnet/minecraft/network/message/MessageChain$Packer; -accessible field net/minecraft/network/packet/s2c/play/ChunkDeltaUpdateS2CPacket sectionPos Lnet/minecraft/util/math/ChunkSectionPos; +accessible class net/minecraft/client/texture/PlayerSkinProvider$Textures +accessible method net/minecraft/client/MinecraftClient doItemUse ()V +accessible method net/minecraft/client/render/GameRenderer loadPostProcessor (Lnet/minecraft/util/Identifier;)V +accessible method net/minecraft/entity/projectile/FishingBobberEntity isOpenOrWaterAround (Lnet/minecraft/util/math/BlockPos;)Z +accessible field net/minecraft/client/MinecraftClient itemUseCooldown I +accessible field net/minecraft/client/gui/hud/ChatHud visibleMessages Ljava/util/List; +accessible field net/minecraft/client/gui/screen/Screen drawables Ljava/util/List; accessible field net/minecraft/client/gui/screen/ingame/CreativeInventoryScreen selectedTab Lnet/minecraft/item/ItemGroup; +accessible field net/minecraft/client/network/ClientPlayNetworkHandler messagePacker Lnet/minecraft/network/message/MessageChain$Packer; +accessible field net/minecraft/client/network/ClientPlayNetworkHandler session Lnet/minecraft/network/encryption/ClientPlayerSession; +accessible field net/minecraft/client/network/ClientPlayerEntity lastPitch F +accessible field net/minecraft/client/network/ClientPlayerEntity lastYaw F +accessible field net/minecraft/client/network/ClientPlayerInteractionManager blockBreakingCooldown I +accessible field net/minecraft/client/network/ClientPlayerInteractionManager breakingBlock Z +accessible field net/minecraft/client/network/ClientPlayerInteractionManager currentBreakingProgress F +accessible field net/minecraft/client/toast/ToastManager toastQueue Ljava/util/Deque; +accessible field net/minecraft/entity/Entity movementMultiplier Lnet/minecraft/util/math/Vec3d; accessible field net/minecraft/entity/Entity stepHeight F -accessible field net/minecraft/client/gui/hud/ChatHud visibleMessages Ljava/util/List; \ No newline at end of file +accessible field net/minecraft/item/ArmorItem toughness F +accessible field net/minecraft/network/packet/s2c/play/ChunkDeltaUpdateS2CPacket sectionPos Lnet/minecraft/util/math/ChunkSectionPos; diff --git a/src/main/resources/wurst.mixins.json b/src/main/resources/wurst.mixins.json index 383cf6a2..79142f8e 100644 --- a/src/main/resources/wurst.mixins.json +++ b/src/main/resources/wurst.mixins.json @@ -6,33 +6,32 @@ "mixins": [ ], "client": [ - "AbstractBlockStateMixin", + "AbstractBlockStateMixin", "AbstractSignEditScreenMixin", "AllowedAddressResolverMixin", - "ArmorItemMixin", "BackgroundRendererMixin", - "BlockEntityRenderDispatcherMixin", - "BlockMixin", - "BlockModelRendererMixin", - "CactusBlockMixin", - "CameraMixin", - "ChatHudMixin", - "ChatInputSuggestorMixin", - "ChatScreenMixin", - "ChunkOcclusionGraphBuilderMixin", - "ClientConnectionMixin", + "BasicBakedModelMixin", + "BlockEntityRenderDispatcherMixin", + "BlockMixin", + "CactusBlockMixin", + "CameraMixin", + "ChatHudMixin", + "ChatInputSuggestorMixin", + "ChatScreenMixin", + "ChunkOcclusionGraphBuilderMixin", + "ClientCommonNetworkHandlerMixin", + "ClientConnectionMixin", "ClientPlayerEntityMixin", "ClientPlayerInteractionManagerMixin", "ClientPlayNetworkHandlerMixin", + "ClientWorldMixin", "CreativeInventoryScreenMixin", - "CustomPayloadC2SPacketAccessor", "DeathScreenMixin", "DirectConnectScreenMixin", "DisconnectedRealmsScreenMixin", "DisconnectedScreenMixin", "EntityMixin", "EntityRendererMixin", - "FishingBobberEntityMixin", "FluidRendererMixin", "GameMenuScreenMixin", "GameRendererMixin", @@ -42,10 +41,8 @@ "KeyBindingMixin", "KeyboardMixin", "LanguageManagerMixin", - "LightTextureManagerMixin", "LivingEntityRendererMixin", "MinecraftClientMixin", - "MiningToolItemMixin", "MouseMixin", "MultiplayerScreenMixin", "PackScreenMixin", @@ -54,15 +51,13 @@ "PowderSnowBlockMixin", "RenderTickCounterMixin", "ScreenMixin", - "ServerListMixin", "ShulkerBoxScreenMixin", "SimpleOptionMixin", "SodiumBlockOcclusionCacheMixin", + "SodiumFluidRendererMixin", "StatsScreenMixin", "StatusEffectInstanceMixin", - "SwordItemMixin", "TelemetryManagerMixin", - "TerrainRenderContextMixin", "TextVisitFactoryMixin", "TitleScreenMixin", "WorldMixin",