From 6e478781aa7b664387d45160031208d454bfe2d1 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 28 Oct 2024 15:11:59 +0100 Subject: [PATCH 1/4] Fix visual glitch in NavigatorMainScreen --- .../net/wurstclient/navigator/NavigatorMainScreen.java | 3 +++ src/main/java/net/wurstclient/util/RenderUtils.java | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 8f00de2d12..ae5b9a449b 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -271,7 +271,10 @@ protected void onRender(DrawContext context, int mouseX, int mouseY, featureY); } + // CURSED: disableScissor() causes weird artifacts if you don't draw + // some text after it. RenderUtils.disableScissor(context); + context.drawText(textRenderer, ".", -100, -100, 0xFFFFFF, false); // tooltip if(tooltip != null) diff --git a/src/main/java/net/wurstclient/util/RenderUtils.java b/src/main/java/net/wurstclient/util/RenderUtils.java index 9dc19a5b96..522cd5dcff 100644 --- a/src/main/java/net/wurstclient/util/RenderUtils.java +++ b/src/main/java/net/wurstclient/util/RenderUtils.java @@ -48,8 +48,13 @@ public static void enableScissor(DrawContext context, int x1, int y1, } /** - * Disables the current scissor box, while avoiding the strange side-effects - * of Minecraft's own disableScissor() method. + * Disables the current scissor box, while avoiding most of the strange + * side-effects of Minecraft's own disableScissor() method. + * + *

+ * Note: You have to draw some text after calling this method, + * otherwise there will be some weird colors in the sky. It's unclear why + * this happens. */ public static void disableScissor(DrawContext context) { From 640a8cbd207c29113e02fc641ed146414d6a0d22 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 28 Oct 2024 15:43:12 +0100 Subject: [PATCH 2/4] Add HitboxCheckSetting to MobSpawnEspHack --- .../wurstclient/hacks/MobSpawnEspHack.java | 10 ++- .../hacks/mobspawnesp/HitboxCheckSetting.java | 89 +++++++++++++++++++ .../assets/wurst/translations/en_us.json | 4 + 3 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 src/main/java/net/wurstclient/hacks/mobspawnesp/HitboxCheckSetting.java diff --git a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java index bd2815cd4d..fe968026de 100644 --- a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java @@ -36,6 +36,7 @@ import net.wurstclient.events.RenderListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; +import net.wurstclient.hacks.mobspawnesp.HitboxCheckSetting; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.ChunkAreaSetting; import net.wurstclient.settings.ChunkAreaSetting.ChunkArea; @@ -68,6 +69,8 @@ public final class MobSpawnEspHack extends Hack private final CheckboxSetting depthTest = new CheckboxSetting("Depth test", true); + private final HitboxCheckSetting hitboxCheck = new HitboxCheckSetting(); + private final ChunkVertexBufferCoordinator coordinator = new ChunkVertexBufferCoordinator(this::isSpawnable, this::buildBuffer, drawDistance); @@ -84,6 +87,7 @@ public MobSpawnEspHack() addSetting(dayColor); addSetting(opacity); addSetting(depthTest); + addSetting(hitboxCheck); } @Override @@ -167,11 +171,9 @@ private boolean isSpawnable(BlockPos pos, BlockState state) if(!SpawnRestriction.isSpawnPosAllowed(EntityType.CREEPER, MC.world, pos)) return false; - + // Check for hitbox collisions - // (using a creeper because it's shorter than a zombie) - if(!MC.world.isSpaceEmpty(EntityType.CREEPER - .getSpawnBox(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5))) + if(!hitboxCheck.isSpaceEmpty(pos)) return false; // Check block light level diff --git a/src/main/java/net/wurstclient/hacks/mobspawnesp/HitboxCheckSetting.java b/src/main/java/net/wurstclient/hacks/mobspawnesp/HitboxCheckSetting.java new file mode 100644 index 0000000000..ac0edbe273 --- /dev/null +++ b/src/main/java/net/wurstclient/hacks/mobspawnesp/HitboxCheckSetting.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2014-2024 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.hacks.mobspawnesp; + +import java.util.function.Function; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.entity.EntityType; +import net.minecraft.util.math.BlockPos; +import net.wurstclient.WurstClient; +import net.wurstclient.settings.EnumSetting; +import net.wurstclient.util.text.WText; + +public final class HitboxCheckSetting + extends EnumSetting +{ + private static final MinecraftClient MC = WurstClient.MC; + private static final WText DESCRIPTION = + WText.translated("description.wurst.setting.mobspawnesp.hitbox_check") + .append(buildDescriptionSuffix()); + + public HitboxCheckSetting() + { + super("Hitbox check", DESCRIPTION, HitboxCheck.values(), + HitboxCheck.OFF); + } + + public boolean isSpaceEmpty(BlockPos pos) + { + return getSelected().check.apply(pos); + } + + private static synchronized boolean slowHitboxCheck(BlockPos pos) + { + return unstableHitboxCheck(pos); + } + + // "unstable" because isSpaceEmpty() is not thread-safe + private static boolean unstableHitboxCheck(BlockPos pos) + { + return MC.world.isSpaceEmpty(EntityType.CREEPER + .getSpawnBox(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5)); + } + + private static WText buildDescriptionSuffix() + { + WText text = WText.literal("\n\n"); + HitboxCheck[] values = HitboxCheck.values(); + + for(HitboxCheck value : values) + text.append("\u00a7l" + value.name + "\u00a7r - ") + .append(value.description).append("\n\n"); + + return text; + } + + public enum HitboxCheck + { + OFF("Off", pos -> true), + SLOW("Slow", HitboxCheckSetting::slowHitboxCheck), + UNSTABLE("Unstable", HitboxCheckSetting::unstableHitboxCheck); + + private static final String TRANSLATION_KEY_PREFIX = + "description.wurst.setting.mobspawnesp.hitbox_check."; + + private final String name; + private final WText description; + private final Function check; + + private HitboxCheck(String name, Function check) + { + this.name = name; + description = + WText.translated(TRANSLATION_KEY_PREFIX + name().toLowerCase()); + this.check = check; + } + + @Override + public String toString() + { + return name; + } + } +} diff --git a/src/main/resources/assets/wurst/translations/en_us.json b/src/main/resources/assets/wurst/translations/en_us.json index 3b81bbd6a6..f7bd4b676d 100644 --- a/src/main/resources/assets/wurst/translations/en_us.json +++ b/src/main/resources/assets/wurst/translations/en_us.json @@ -151,6 +151,10 @@ "description.wurst.hack.mileycyrus": "Makes you twerk.", "description.wurst.hack.mobesp": "Highlights nearby mobs.", "description.wurst.hack.mobspawnesp": "Highlights areas where mobs can spawn.", + "description.wurst.setting.mobspawnesp.hitbox_check": "Makes MobSpawnESP more accurate by ignoring dark spots that are too small for any mobs to spawn, but can also negatively affect performance and/or stability.", + "description.wurst.setting.mobspawnesp.hitbox_check.off": "No hitbox check.", + "description.wurst.setting.mobspawnesp.hitbox_check.slow": "Synchronized hitbox check. Shouldn't cause any crashes, but has a large impact on game performance.", + "description.wurst.setting.mobspawnesp.hitbox_check.unstable": "Fast but unstable hitbox check. This is known to crash the game sometimes.", "description.wurst.setting.mobspawnesp.night_color": "Color of the X at positions where mobs can spawn at night.", "description.wurst.setting.mobspawnesp.day_color": "Color of the X at positions where mobs can always spawn.", "description.wurst.hack.multiaura": "Faster Killaura that attacks multiple entities at once.", From c82b31a0e38d99c9fad11a4c5169d9a8878bd449 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 28 Oct 2024 15:44:09 +0100 Subject: [PATCH 3/4] Change version to 7.46.2 --- gradle.properties | 2 +- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 12a2b0f1be..001553307c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ loader_version=0.16.7 fabric_version=0.106.1+1.21.3 # Mod Properties -mod_version = v7.46.1-MC1.21.3 +mod_version = v7.46.2-MC1.21.3 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 050463d396..c2accd5557 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -50,7 +50,7 @@ public enum WurstClient public static MinecraftClient MC; public static IMinecraftClient IMC; - public static final String VERSION = "7.46.1"; + public static final String VERSION = "7.46.2"; public static final String MC_VERSION = "1.21.3"; private WurstAnalytics analytics; From 686877ea3388cda8334422344d237a285cf9c015 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 30 Oct 2024 17:51:33 +0100 Subject: [PATCH 4/4] Update Fabric stuff --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 001553307c..3bc92ec07b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,10 +7,10 @@ org.gradle.parallel=true # https://modrinth.com/mod/fabric-api/versions minecraft_version=1.21.3 yarn_mappings=1.21.3+build.2 -loader_version=0.16.7 +loader_version=0.16.9 # Fabric API -fabric_version=0.106.1+1.21.3 +fabric_version=0.107.0+1.21.3 # Mod Properties mod_version = v7.46.2-MC1.21.3