diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 62f01a7f8d..42e26139a4 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -18,16 +18,25 @@ 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 diff --git a/.github/workflows/jsonsyntax.yml b/.github/workflows/jsonsyntax.yml index 2a5f77c761..e6f9a4da24 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 0000000000..aa21f4db85 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,37 @@ +name: "Close stale issues and pull requests" +on: + schedule: + - cron: "30 1 * * *" + +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: 60 + enable-statistics: true diff --git a/build.gradle b/build.gradle index 532612defe..f9c14b900d 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 f851a8e79e..26c3651a87 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,14 +6,14 @@ org.gradle.parallel=true # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api minecraft_version=1.20.2 -yarn_mappings=1.20.2+build.1 +yarn_mappings=1.20.2+build.4 loader_version=0.14.22 #Fabric api -fabric_version=0.89.0+1.20.2 +fabric_version=0.89.3+1.20.2 # Mod Properties -mod_version = v7.37-MC1.20.2 +mod_version = v7.37.1-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 249e5832f0..7f93135c49 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 fae08049a6..ac72c34e8a 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 a69d9cb6c2..0adc8e1a53 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 53a6b238d4..6689b85bee 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/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index b19e98e214..fd4fa86b4f 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -40,6 +40,7 @@ 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,7 +57,7 @@ public enum WurstClient public static MinecraftClient MC; public static IMinecraftClient IMC; - public static final String VERSION = "7.37"; + public static final String VERSION = "7.37.1"; public static final String MC_VERSION = "1.20.2"; private WurstAnalytics analytics; @@ -177,7 +178,7 @@ private Path createWurstFolder() 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/altmanager/AltRenderer.java b/src/main/java/net/wurstclient/altmanager/AltRenderer.java index 1d2745c439..05bb514cdb 100644 --- a/src/main/java/net/wurstclient/altmanager/AltRenderer.java +++ b/src/main/java/net/wurstclient/altmanager/AltRenderer.java @@ -123,9 +123,9 @@ public static void drawAltBody(DrawContext context, String name, int x, { bindSkinTexture(name); - boolean slim = - DefaultSkinHelper.getTexture(Uuids.getOfflinePlayerUuid(name)) - .model() == SkinTextures.Model.SLIM; + boolean slim = DefaultSkinHelper + .getSkinTextures(Uuids.getOfflinePlayerUuid(name)) + .model() == SkinTextures.Model.SLIM; GL11.glEnable(GL11.GL_BLEND); RenderSystem.setShaderColor(1, 1, 1, 1); @@ -255,9 +255,9 @@ public static void drawAltBack(DrawContext context, String name, int x, { bindSkinTexture(name); - boolean slim = - DefaultSkinHelper.getTexture(Uuids.getOfflinePlayerUuid(name)) - .model() == SkinTextures.Model.SLIM; + boolean slim = DefaultSkinHelper + .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/commands/FollowCmd.java b/src/main/java/net/wurstclient/commands/FollowCmd.java index 77c25c769f..428bec8910 100644 --- a/src/main/java/net/wurstclient/commands/FollowCmd.java +++ b/src/main/java/net/wurstclient/commands/FollowCmd.java @@ -39,7 +39,7 @@ public void call(String[] args) throws CmdException 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 f42501a4cb..0dedc5cc50 100644 --- a/src/main/java/net/wurstclient/commands/GoToCmd.java +++ b/src/main/java/net/wurstclient/commands/GoToCmd.java @@ -89,7 +89,7 @@ private BlockPos argsToEntityPos(String name) throws CmdError { 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 71b5d5d49c..98a2570aa1 100644 --- a/src/main/java/net/wurstclient/commands/PathCmd.java +++ b/src/main/java/net/wurstclient/commands/PathCmd.java @@ -129,7 +129,7 @@ private BlockPos argsToEntityPos(String name) throws CmdError { 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/ProtectCmd.java b/src/main/java/net/wurstclient/commands/ProtectCmd.java index 6a292b7c58..67e716cf7f 100644 --- a/src/main/java/net/wurstclient/commands/ProtectCmd.java +++ b/src/main/java/net/wurstclient/commands/ProtectCmd.java @@ -40,7 +40,7 @@ public void call(String[] args) throws CmdException 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 a99e7a72a3..d45a3fd4cf 100644 --- a/src/main/java/net/wurstclient/commands/TpCmd.java +++ b/src/main/java/net/wurstclient/commands/TpCmd.java @@ -67,7 +67,7 @@ private BlockPos argsToEntityPos(String name) throws CmdError { 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/hacks/AirPlaceHack.java b/src/main/java/net/wurstclient/hacks/AirPlaceHack.java index 224a649e43..08b952e05c 100644 --- a/src/main/java/net/wurstclient/hacks/AirPlaceHack.java +++ b/src/main/java/net/wurstclient/hacks/AirPlaceHack.java @@ -52,7 +52,7 @@ public void onRightClick(RightClickEvent event) if(!(hitResult instanceof BlockHitResult blockHitResult)) return; - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; if(MC.player.isRiding()) return; diff --git a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java index 5eca0dc6c6..824fa6922c 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.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 @@ private boolean rightClickBlock(BlockPos pos) 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 @@ private boolean placeAnchor(BlockPos pos) 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/AutoBuildHack.java b/src/main/java/net/wurstclient/hacks/AutoBuildHack.java index e9f53776f7..021d196c74 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.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 @@ private void buildNormally() return; } - if(!fastPlace.isChecked() && IMC.getItemUseCooldown() > 0) + if(!fastPlace.isChecked() && MC.itemUseCooldown > 0) return; placeNextBlock(); @@ -253,11 +252,8 @@ private boolean tryToPlace(BlockPos pos, Vec3d eyesPos, double rangeSq) 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 @@ private boolean tryToPlace(BlockPos pos, Vec3d eyesPos, double rangeSq) 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 9cb745a17c..9406254993 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -266,7 +266,7 @@ private boolean canBeReplanted(BlockPos pos) 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 @@ private boolean replant(List blocksToReplant) .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 3db5a69db7..10bf8d4b40 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFishHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFishHack.java @@ -146,7 +146,7 @@ public void onUpdate() if(castRodTimer > 0) return; - IMC.rightClick(); + MC.doItemUse(); castRodTimer = retryDelay.getValueI(); reelInTimer = 20 * patience.getValueI(); return; @@ -155,7 +155,7 @@ public void onUpdate() // 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/AutoLibrarianHack.java b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java index bf9fcc0765..028452b484 100644 --- a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java @@ -367,7 +367,7 @@ private void placeJobSite() private void openTradeScreen() { - if(IMC.getItemUseCooldown() > 0) + if(MC.itemUseCooldown > 0) return; ClientPlayerInteractionManager im = MC.interactionManager; @@ -404,13 +404,13 @@ private void openTradeScreen() 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 @@ private void setTargetVillager() 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/AutoSwordHack.java b/src/main/java/net/wurstclient/hacks/AutoSwordHack.java index 93a75b5e2f..b327a8dfe2 100644 --- a/src/main/java/net/wurstclient/hacks/AutoSwordHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoSwordHack.java @@ -12,18 +12,18 @@ 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.ItemUtils; @SearchTags({"auto sword"}) public final class AutoSwordHack extends Hack implements UpdateListener @@ -47,7 +47,6 @@ public final class AutoSwordHack extends Hack implements UpdateListener public AutoSwordHack() { super("AutoSword"); - setCategory(Category.COMBAT); addSetting(priority); @@ -144,17 +143,15 @@ private float getValue(Item item) 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/BonemealAuraHack.java b/src/main/java/net/wurstclient/hacks/BonemealAuraHack.java index 14ef79090d..abf5e59365 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.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 void onDisable() public void onUpdate() { // wait for right click timer - if(IMC.getItemUseCooldown() > 0) + if(MC.itemUseCooldown > 0) return; // get valid blocks @@ -244,11 +242,7 @@ private boolean rightClickBlockLegit(BlockPos pos) 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 @@ private boolean rightClickBlockLegit(BlockPos pos) // 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 b5cddf9e9a..8016c755a5 100644 --- a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java +++ b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java @@ -144,7 +144,7 @@ public void onUpdate() 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( @@ -187,7 +187,7 @@ private boolean tryToPlaceBlock(BlockPos pos) if(checkLOS.isChecked() && !params.lineOfSight()) return false; - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; facing.getSelected().face(params.hitVec()); lastPos = pos; diff --git a/src/main/java/net/wurstclient/hacks/ChestEspHack.java b/src/main/java/net/wurstclient/hacks/ChestEspHack.java index cc2ec14d08..e0e3ef41ac 100644 --- a/src/main/java/net/wurstclient/hacks/ChestEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ChestEspHack.java @@ -192,7 +192,7 @@ else if(entity instanceof ChestBoatEntity) public void onCameraTransformViewBobbing( CameraTransformViewBobbingEvent event) { - if(style.getSelected().hasLines()) + if(style.hasLines()) event.cancel(); } @@ -213,14 +213,14 @@ public void onRender(MatrixStack matrixStack, float partialTicks) ChestEspRenderer espRenderer = new ChestEspRenderer(matrixStack); - 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/CrystalAuraHack.java b/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java index 5c96eefab7..28cb935353 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.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 @@ private boolean placeCrystal(BlockPos pos) 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 @@ private ArrayList getNearbyCrystals() .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/FastBreakHack.java b/src/main/java/net/wurstclient/hacks/FastBreakHack.java index ca07f79442..1f5f2e3f5a 100644 --- a/src/main/java/net/wurstclient/hacks/FastBreakHack.java +++ b/src/main/java/net/wurstclient/hacks/FastBreakHack.java @@ -81,7 +81,7 @@ protected void onDisable() @Override public void onUpdate() { - IMC.getInteractionManager().setBlockHitDelay(0); + MC.interactionManager.blockBreakingCooldown = 0; } @Override diff --git a/src/main/java/net/wurstclient/hacks/FastPlaceHack.java b/src/main/java/net/wurstclient/hacks/FastPlaceHack.java index 2738b3172b..9620c03c52 100644 --- a/src/main/java/net/wurstclient/hacks/FastPlaceHack.java +++ b/src/main/java/net/wurstclient/hacks/FastPlaceHack.java @@ -36,6 +36,6 @@ public void onDisable() @Override public void onUpdate() { - IMC.setItemUseCooldown(0); + MC.itemUseCooldown = 0; } } diff --git a/src/main/java/net/wurstclient/hacks/FollowHack.java b/src/main/java/net/wurstclient/hacks/FollowHack.java index 3f58b33ab5..6a7ad57b19 100644 --- a/src/main/java/net/wurstclient/hacks/FollowHack.java +++ b/src/main/java/net/wurstclient/hacks/FollowHack.java @@ -150,7 +150,7 @@ public void onUpdate() { 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/GlideHack.java b/src/main/java/net/wurstclient/hacks/GlideHack.java index 702bc641a3..8d797e9071 100644 --- a/src/main/java/net/wurstclient/hacks/GlideHack.java +++ b/src/main/java/net/wurstclient/hacks/GlideHack.java @@ -85,7 +85,7 @@ public void onUpdate() // 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 14165f465e..eced4596b9 100644 --- a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java +++ b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java @@ -100,7 +100,7 @@ public void onEnable() // initialize building process blockIndex = 0; building = true; - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; } startTimer = 2; @@ -240,7 +240,7 @@ private void placeBlockSimple(BlockPos pos) .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 ebbafe43c7..5598b51f24 100644 --- a/src/main/java/net/wurstclient/hacks/InvWalkHack.java +++ b/src/main/java/net/wurstclient/hacks/InvWalkHack.java @@ -124,6 +124,6 @@ private boolean isCreativeSearchBarOpen(Screen screen) 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 b02bb3dea0..f1f715557a 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.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 void onUpdate() public void onCameraTransformViewBobbing( CameraTransformViewBobbingEvent event) { - if(style.getSelected().hasLines()) + if(style.hasLines()) event.cancel(); } @@ -111,7 +110,7 @@ public void onRender(MatrixStack matrixStack, float partialTicks) renderBoxes(matrixStack, partialTicks, region); - if(style.getSelected().hasLines()) + if(style.hasLines()) renderTracers(matrixStack, partialTicks, region); matrixStack.pop(); @@ -125,7 +124,7 @@ public void onRender(MatrixStack matrixStack, float partialTicks) 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 @@ private void renderBoxes(MatrixStack matrixStack, float partialTicks, .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, @@ -175,6 +174,7 @@ private void renderTracers(MatrixStack matrixStack, float partialTicks, bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION); + for(ItemEntity e : items) { Vec3d end = EntityUtils.getLerpedBox(e, partialTicks).getCenter() @@ -187,27 +187,7 @@ private void renderTracers(MatrixStack matrixStack, float partialTicks, .vertex(matrix, (float)end.x, (float)end.y, (float)end.z) .next(); } - 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; - } + tessellator.draw(); } } diff --git a/src/main/java/net/wurstclient/hacks/KillauraHack.java b/src/main/java/net/wurstclient/hacks/KillauraHack.java index 3bb4ebabe5..b330c1c117 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.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.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 void onUpdate() 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/LsdHack.java b/src/main/java/net/wurstclient/hacks/LsdHack.java index d5e6d96f41..f3c0d9aec5 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.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 void onEnable() 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/MobEspHack.java b/src/main/java/net/wurstclient/hacks/MobEspHack.java index 83bd1affc1..dbf573bec2 100644 --- a/src/main/java/net/wurstclient/hacks/MobEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobEspHack.java @@ -35,7 +35,7 @@ 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.util.EntityUtils; @@ -49,10 +49,9 @@ 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); @@ -99,7 +98,7 @@ public void onUpdate() Stream stream = StreamSupport.stream(MC.world.getEntities().spliterator(), false) - .filter(e -> e instanceof MobEntity).map(e -> (MobEntity)e) + .filter(MobEntity.class::isInstance).map(e -> (MobEntity)e) .filter(e -> !e.isRemoved() && e.getHealth() > 0); if(filterInvisible.isChecked()) @@ -112,7 +111,7 @@ public void onUpdate() public void onCameraTransformViewBobbing( CameraTransformViewBobbingEvent event) { - if(style.getSelected().hasLines()) + if(style.hasLines()) event.cancel(); } @@ -129,10 +128,10 @@ public void onRender(MatrixStack matrixStack, float partialTicks) 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,7 +145,7 @@ public void onRender(MatrixStack matrixStack, float partialTicks) 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) @@ -210,27 +209,5 @@ private void renderTracers(MatrixStack matrixStack, float partialTicks, } 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/OpenWaterEspHack.java b/src/main/java/net/wurstclient/hacks/OpenWaterEspHack.java index f300868d1b..a469c95e15 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.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 OpenWaterEspHack() 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 @@ private void drawOpenWater(MatrixStack matrixStack, 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 9d5d4f2498..1137f3eb88 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.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 void onUpdate() public void onCameraTransformViewBobbing( CameraTransformViewBobbingEvent event) { - if(style.getSelected().hasLines()) + if(style.hasLines()) event.cancel(); } @@ -130,10 +129,10 @@ public void onRender(MatrixStack matrixStack, float partialTicks) 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 void onRender(MatrixStack matrixStack, float partialTicks) private void renderBoxes(MatrixStack matrixStack, float partialTicks, RegionPos region) { - float extraSize = boxSize.getSelected().extraSize; + float extraSize = boxSize.getExtraSize(); for(PlayerEntity e : players) { @@ -225,25 +224,4 @@ private void renderTracers(MatrixStack matrixStack, float partialTicks, 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 b65df1ee83..9149100385 100644 --- a/src/main/java/net/wurstclient/hacks/ProtectHack.java +++ b/src/main/java/net/wurstclient/hacks/ProtectHack.java @@ -119,7 +119,7 @@ public void onEnable() { 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 cbaa477232..e500122422 100644 --- a/src/main/java/net/wurstclient/hacks/RadarHack.java +++ b/src/main/java/net/wurstclient/hacks/RadarHack.java @@ -45,12 +45,12 @@ 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), + FilterMonstersSetting.genericVision(false), + FilterAnimalsSetting.genericVision(false), + FilterInvisibleSetting.genericVision(false)); public RadarHack() { @@ -92,7 +92,7 @@ public void onUpdate() 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 bf0154bbf0..f47320c48d 100644 --- a/src/main/java/net/wurstclient/hacks/RemoteViewHack.java +++ b/src/main/java/net/wurstclient/hacks/RemoteViewHack.java @@ -54,7 +54,7 @@ public void onEnable() { 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) @@ -127,7 +127,7 @@ public void onToggledByCommand(String viewName) { 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 098bbd345c..ecb935dc38 100644 --- a/src/main/java/net/wurstclient/hacks/ScaffoldWalkHack.java +++ b/src/main/java/net/wurstclient/hacks/ScaffoldWalkHack.java @@ -163,7 +163,7 @@ private boolean placeBlock(BlockPos pos) 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/ThrowHack.java b/src/main/java/net/wurstclient/hacks/ThrowHack.java index 1cc5242fae..61e5f9e725 100644 --- a/src/main/java/net/wurstclient/hacks/ThrowHack.java +++ b/src/main/java/net/wurstclient/hacks/ThrowHack.java @@ -49,7 +49,7 @@ public void onDisable() @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 a0802d3b43..8650dfcb28 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.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 void onDisable() public void onUpdate() { // wait for right click timer - if(IMC.getItemUseCooldown() > 0) + if(MC.itemUseCooldown > 0) return; // check held item @@ -165,7 +161,8 @@ private boolean rightClickBlockLegit(BlockPos pos) if(distanceSqHitVec >= distanceSqPosVec) continue; - if(checkLOS.isChecked() && !hasLineOfSight(eyesPos, hitVec)) + if(checkLOS.isChecked() + && !BlockUtils.hasLineOfSight(eyesPos, hitVec)) continue; // face block @@ -174,7 +171,7 @@ private boolean rightClickBlockLegit(BlockPos pos) // 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 @@ private boolean rightClickBlockSimple(BlockPos pos) 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 @@ private boolean rightClickBlockSimple(BlockPos pos) 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 b9b821e047..4d910d9332 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.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 @@ private Trajectory getTrajectory(float partialTicks) : 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/TunnellerHack.java b/src/main/java/net/wurstclient/hacks/TunnellerHack.java index 7b456824b9..3e97cbddf0 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.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.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; @@ -807,7 +805,7 @@ public boolean canRun() // 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 @@ private void placeBlockSimple(BlockPos pos) return; // check timer - if(IMC.getItemUseCooldown() > 0) + if(MC.itemUseCooldown > 0) return; // place block @@ -889,7 +887,7 @@ private void placeBlockSimple(BlockPos pos) .sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); // reset timer - IMC.setItemUseCooldown(4); + MC.itemUseCooldown = 4; } private boolean breakBlock(BlockPos pos) @@ -923,7 +921,7 @@ private boolean breakBlock(BlockPos pos) 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 @@ private boolean breakBlock(BlockPos pos) 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/autofish/ShallowWaterWarningCheckbox.java b/src/main/java/net/wurstclient/hacks/autofish/ShallowWaterWarningCheckbox.java index 849324d59d..2944e4fd59 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 @@ 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 void reset() 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 c4fe0aad7d..5ea262b454 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 @@ 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 Enchantment getEnchantment() 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/mixin/ClientPlayerInteractionManagerMixin.java b/src/main/java/net/wurstclient/mixin/ClientPlayerInteractionManagerMixin.java index dc5139715d..d99dd469ed 100644 --- a/src/main/java/net/wurstclient/mixin/ClientPlayerInteractionManagerMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientPlayerInteractionManagerMixin.java @@ -46,8 +46,6 @@ public abstract class ClientPlayerInteractionManagerMixin @Shadow @Final private MinecraftClient client; - @Shadow - private int blockBreakingCooldown; @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getId()I", @@ -123,20 +121,14 @@ public void rightClickItem() } @Override - public void rightClickBlock(BlockPos pos, Direction side, Vec3d hitVec, - Hand hand) + public void rightClickBlock(BlockPos pos, Direction side, Vec3d hitVec) { BlockHitResult hitResult = new BlockHitResult(hitVec, side, pos, false); + Hand hand = Hand.MAIN_HAND; 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); - } - @Override public void sendPlayerActionC2SPacket(Action action, BlockPos blockPos, Direction direction) @@ -153,12 +145,6 @@ public void sendPlayerInteractBlockPacket(Hand hand, i -> new PlayerInteractBlockC2SPacket(hand, blockHitResult, i)); } - @Override - public void setBlockHitDelay(int delay) - { - blockBreakingCooldown = delay; - } - @Shadow private void sendSequencedPacket(ClientWorld world, SequencedPacketCreator packetCreator) 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 6b5e6129a8..0000000000 --- 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/GameRendererMixin.java b/src/main/java/net/wurstclient/mixin/GameRendererMixin.java index c7fe41970b..7171764c82 100644 --- a/src/main/java/net/wurstclient/mixin/GameRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/GameRendererMixin.java @@ -9,7 +9,6 @@ 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,7 +19,6 @@ import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; -import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; import net.wurstclient.WurstClient; import net.wurstclient.event.EventManager; @@ -28,10 +26,9 @@ 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, IGameRenderer +public abstract class GameRendererMixin implements AutoCloseable { private boolean cancelNextBobView; @@ -152,16 +149,4 @@ private void onTiltViewWhenHurt(MatrixStack matrices, float tickDelta, if(WurstClient.INSTANCE.getHax().noHurtcamHack.isEnabled()) ci.cancel(); } - - @Override - public void loadWurstShader(Identifier id) - { - loadPostProcessor(id); - } - - @Shadow - private void loadPostProcessor(Identifier id) - { - - } } diff --git a/src/main/java/net/wurstclient/mixin/LanguageManagerMixin.java b/src/main/java/net/wurstclient/mixin/LanguageManagerMixin.java index fc8a2a5ef3..5a5471b1e9 100644 --- a/src/main/java/net/wurstclient/mixin/LanguageManagerMixin.java +++ b/src/main/java/net/wurstclient/mixin/LanguageManagerMixin.java @@ -24,19 +24,19 @@ public abstract class LanguageManagerMixin implements SynchronousResourceReloader, ILanguageManager { - private TranslationStorage english; + private TranslationStorage wurstEnglish; @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/MinecraftClientMixin.java b/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java index 7f14300ed3..cf7bf2d64d 100644 --- a/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java +++ b/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java @@ -27,7 +27,6 @@ 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.session.ProfileKeys; import net.minecraft.client.session.ProfileKeysImpl; import net.minecraft.client.session.Session; @@ -41,7 +40,6 @@ 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; @@ -54,21 +52,13 @@ public abstract class MinecraftClientMixin @Final public File runDirectory; @Shadow - private int itemUseCooldown; - @Shadow public ClientPlayerInteractionManager interactionManager; @Shadow - @Final - private LanguageManager languageManager; - @Shadow public ClientPlayerEntity player; @Shadow public ClientWorld world; @Shadow @Final - private Session session; - @Shadow - @Final private YggdrasilAuthenticationService authenticationService; private Session wurstSession; @@ -176,24 +166,6 @@ private void onIsOptionalTelemetryEnabledByApi( !WurstClient.INSTANCE.getOtfs().noTelemetryOtf.isEnabled()); } - @Override - public void rightClick() - { - doItemUse(); - } - - @Override - public int getItemUseCooldown() - { - return itemUseCooldown; - } - - @Override - public void setItemUseCooldown(int itemUseCooldown) - { - this.itemUseCooldown = itemUseCooldown; - } - @Override public IClientPlayerEntity getPlayer() { @@ -212,12 +184,6 @@ public IClientPlayerInteractionManager getInteractionManager() return (IClientPlayerInteractionManager)interactionManager; } - @Override - public ILanguageManager getLanguageManager() - { - return (ILanguageManager)languageManager; - } - @Override public void setSession(Session session) { @@ -242,10 +208,4 @@ private UserApiService wurst_createUserApiService(String accessToken) 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 bef213a1a8..0000000000 --- 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/SwordItemMixin.java b/src/main/java/net/wurstclient/mixin/SwordItemMixin.java deleted file mode 100644 index a45cf400c9..0000000000 --- a/src/main/java/net/wurstclient/mixin/SwordItemMixin.java +++ /dev/null @@ -1,45 +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 - 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/mixinterface/IClientPlayerInteractionManager.java b/src/main/java/net/wurstclient/mixinterface/IClientPlayerInteractionManager.java index acc2a4024b..84868ca144 100644 --- a/src/main/java/net/wurstclient/mixinterface/IClientPlayerInteractionManager.java +++ b/src/main/java/net/wurstclient/mixinterface/IClientPlayerInteractionManager.java @@ -26,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, @@ -36,6 +33,4 @@ public void sendPlayerActionC2SPacket(PlayerActionC2SPacket.Action action, 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 02deac3ef7..0000000000 --- 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 6e28224e92..0000000000 --- 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 3ca321f73d..e0213f0b02 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 952ec86c03..1622cf051b 100644 --- a/src/main/java/net/wurstclient/mixinterface/IMinecraftClient.java +++ b/src/main/java/net/wurstclient/mixinterface/IMinecraftClient.java @@ -11,16 +11,8 @@ 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(); 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 85b1d5ef63..0000000000 --- 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/ISwordItem.java b/src/main/java/net/wurstclient/mixinterface/ISwordItem.java deleted file mode 100644 index f0deaafce3..0000000000 --- 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/settings/EspBoxSizeSetting.java b/src/main/java/net/wurstclient/settings/EspBoxSizeSetting.java new file mode 100644 index 0000000000..dce32108bf --- /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 73dd64b9b4..f06da31b22 100644 --- a/src/main/java/net/wurstclient/settings/EspStyleSetting.java +++ b/src/main/java/net/wurstclient/settings/EspStyleSetting.java @@ -24,6 +24,16 @@ public EspStyleSetting(String name, String description, EspStyle selected) 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/filters/FilterAllaysSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java index 0627467f59..4332233931 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 static FilterAllaysSetting genericCombat(boolean checked) { 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 index e5961cd9c4..05a341d912 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterAnimalsSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterAnimalsSetting.java @@ -31,4 +31,9 @@ public static FilterAnimalsSetting genericCombat(boolean checked) return new FilterAnimalsSetting("Won't attack pigs, cows, etc.", checked); } + + public static FilterAnimalsSetting genericVision(boolean checked) + { + return new FilterAnimalsSetting("Won't show 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 eb57060476..cf067edfad 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 static FilterArmorStandsSetting genericCombat(boolean checked) 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/FilterEndermenSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterEndermenSetting.java index db60e127db..7199a37459 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterEndermenSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterEndermenSetting.java @@ -27,4 +27,9 @@ public static FilterEndermenSetting genericCombat(boolean checked) { return new FilterEndermenSetting("Won't attack endermen.", checked); } + + public static FilterEndermenSetting genericVision(boolean checked) + { + return new FilterEndermenSetting("Won't show endermen.", checked); + } } diff --git a/src/main/java/net/wurstclient/settings/filters/FilterGolemsSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterGolemsSetting.java index 0215857cd3..d2d0c0be74 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterGolemsSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterGolemsSetting.java @@ -28,4 +28,10 @@ public static FilterGolemsSetting genericCombat(boolean checked) return new FilterGolemsSetting( "Won't attack iron golems, snow golems and shulkers.", checked); } + + public static FilterGolemsSetting genericVision(boolean checked) + { + return new FilterGolemsSetting( + "Won't show iron golems, snow golems and shulkers.", checked); + } } diff --git a/src/main/java/net/wurstclient/settings/filters/FilterInvisibleSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterInvisibleSetting.java index 65699b12fa..67ef67460b 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 static FilterInvisibleSetting genericCombat(boolean checked) 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 index 8f07b5d0c6..04c7511bca 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterMonstersSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterMonstersSetting.java @@ -28,4 +28,10 @@ public static FilterMonstersSetting genericCombat(boolean checked) return new FilterMonstersSetting("Won't attack zombies, creepers, etc.", checked); } + + public static FilterMonstersSetting genericVision(boolean checked) + { + return new FilterMonstersSetting("Won't show zombies, creepers, etc.", + checked); + } } diff --git a/src/main/java/net/wurstclient/settings/filters/FilterPetsSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterPetsSetting.java index 7dd99222b9..72c4409d21 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 static FilterPetsSetting genericCombat(boolean checked) 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/FilterPigmenSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterPigmenSetting.java index 40b8d998fe..d510595629 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterPigmenSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterPigmenSetting.java @@ -27,4 +27,9 @@ public static FilterPigmenSetting genericCombat(boolean checked) { return new FilterPigmenSetting("Won't attack zombie pigmen.", checked); } + + public static FilterPigmenSetting genericVision(boolean checked) + { + return new FilterPigmenSetting("Won't show 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 80a5921fac..1c0bc4bbef 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 static FilterPlayersSetting genericCombat(boolean checked) { 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/FilterSleepingSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterSleepingSetting.java index 470f9cba19..4c0682a65d 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterSleepingSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterSleepingSetting.java @@ -29,7 +29,13 @@ public boolean test(Entity e) 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/FilterTradersSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterTradersSetting.java index 08660308cb..5c7b07cca0 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterTradersSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterTradersSetting.java @@ -28,4 +28,10 @@ public static FilterTradersSetting genericCombat(boolean checked) return new FilterTradersSetting( "Won't attack villagers, wandering traders, etc.", checked); } + + public static FilterTradersSetting genericVision(boolean checked) + { + return new FilterTradersSetting( + "Won't show villagers, wandering traders, etc.", checked); + } } diff --git a/src/main/java/net/wurstclient/treebot/TreeBotUtils.java b/src/main/java/net/wurstclient/treebot/TreeBotUtils.java index 58cfad2833..fb609157d7 100644 --- a/src/main/java/net/wurstclient/treebot/TreeBotUtils.java +++ b/src/main/java/net/wurstclient/treebot/TreeBotUtils.java @@ -12,13 +12,10 @@ 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; @@ -79,7 +76,7 @@ public static Direction getLineOfSightSide(Vec3d eyesPos, BlockPos pos) if(distancesSq[i] >= distanceSqToCenter) continue; - linesOfSight[i] = hasLineOfSight(eyesPos, hitVecs[i]); + linesOfSight[i] = BlockUtils.hasLineOfSight(eyesPos, hitVecs[i]); } Direction side = null; @@ -104,14 +101,4 @@ public static Direction getLineOfSightSide(Vec3d eyesPos, BlockPos pos) // 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 16398f6f4f..47c84f134f 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.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 @@ -94,11 +92,7 @@ public static BlockBreakingParams getBlockBreakingParams(BlockPos pos) 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(eyesPos, 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 829d967764..96121057fe 100644 --- a/src/main/java/net/wurstclient/util/BlockPlacer.java +++ b/src/main/java/net/wurstclient/util/BlockPlacer.java @@ -10,14 +10,12 @@ 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 static BlockPlacingParams getBlockPlacingParams(BlockPos pos) 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 139b0a6c66..8cdfbb30f1 100644 --- a/src/main/java/net/wurstclient/util/BlockUtils.java +++ b/src/main/java/net/wurstclient/util/BlockUtils.java @@ -17,10 +17,14 @@ 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.RaycastContext; import net.wurstclient.WurstClient; public enum BlockUtils @@ -125,6 +129,26 @@ public static boolean isOpaqueFullCube(BlockPos pos) 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; + } + public static ArrayList getAllInBox(BlockPos from, BlockPos to) { ArrayList blocks = new ArrayList<>(); diff --git a/src/main/java/net/wurstclient/util/EntityUtils.java b/src/main/java/net/wurstclient/util/EntityUtils.java index 47918d06d0..68b00e7921 100644 --- a/src/main/java/net/wurstclient/util/EntityUtils.java +++ b/src/main/java/net/wurstclient/util/EntityUtils.java @@ -46,7 +46,7 @@ public static Stream getAttackableEntities() 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); } diff --git a/src/main/java/net/wurstclient/util/ItemUtils.java b/src/main/java/net/wurstclient/util/ItemUtils.java index bcd9d874c0..9750c9713a 100644 --- a/src/main/java/net/wurstclient/util/ItemUtils.java +++ b/src/main/java/net/wurstclient/util/ItemUtils.java @@ -7,7 +7,10 @@ */ package net.wurstclient.util; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.item.Item; +import net.minecraft.item.ToolItem; import net.minecraft.registry.Registries; import net.minecraft.util.Identifier; import net.minecraft.util.InvalidIdentifierException; @@ -46,4 +49,11 @@ public static Item getItemFromNameOrID(String nameOrId) return null; } } + + public static float getAttackSpeed(ToolItem item) + { + return (float)item.getAttributeModifiers(EquipmentSlot.MAINHAND) + .get(EntityAttributes.GENERIC_ATTACK_SPEED).stream().findFirst() + .orElseThrow().getValue(); + } } diff --git a/src/main/resources/wurst.accesswidener b/src/main/resources/wurst.accesswidener index 877f5bef60..83369db15f 100644 --- a/src/main/resources/wurst.accesswidener +++ b/src/main/resources/wurst.accesswidener @@ -1,6 +1,10 @@ accessWidener v1 named accessible class net/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier 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; @@ -8,6 +12,7 @@ accessible field net/minecraft/client/network/ClientPlayNetworkHandler messagePa 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; diff --git a/src/main/resources/wurst.mixins.json b/src/main/resources/wurst.mixins.json index 2b0aa69068..b650abf67c 100644 --- a/src/main/resources/wurst.mixins.json +++ b/src/main/resources/wurst.mixins.json @@ -31,7 +31,6 @@ "DisconnectedScreenMixin", "EntityMixin", "EntityRendererMixin", - "FishingBobberEntityMixin", "FluidRendererMixin", "GameMenuScreenMixin", "GameRendererMixin", @@ -44,7 +43,6 @@ "LightTextureManagerMixin", "LivingEntityRendererMixin", "MinecraftClientMixin", - "MiningToolItemMixin", "MouseMixin", "MultiplayerScreenMixin", "PackScreenMixin", @@ -58,7 +56,6 @@ "SodiumBlockOcclusionCacheMixin", "StatsScreenMixin", "StatusEffectInstanceMixin", - "SwordItemMixin", "TelemetryManagerMixin", "TerrainRenderContextMixin", "TextVisitFactoryMixin",