diff --git a/gradle.properties b/gradle.properties index 5d3b3e3071..9a35c18934 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ loader_version=0.16.5 fabric_version=0.102.0+1.21 # Mod Properties -mod_version = v7.46-MC1.21 +mod_version = v7.46.1-MC1.21 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 323831d8b1..f04ed52627 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"; + public static final String VERSION = "7.46.1"; public static final String MC_VERSION = "1.21"; private WurstAnalytics analytics; diff --git a/src/main/java/net/wurstclient/altmanager/MicrosoftLoginManager.java b/src/main/java/net/wurstclient/altmanager/MicrosoftLoginManager.java index 2d4acab168..244da40080 100644 --- a/src/main/java/net/wurstclient/altmanager/MicrosoftLoginManager.java +++ b/src/main/java/net/wurstclient/altmanager/MicrosoftLoginManager.java @@ -104,7 +104,7 @@ public static void login(String email, String password) Session session = new Session(mcProfile.getName(), mcProfile.getUUID(), mcProfile.getAccessToken(), Optional.empty(), Optional.empty(), - Session.AccountType.MOJANG); + Session.AccountType.MSA); WurstClient.IMC.setSession(session); } diff --git a/src/main/java/net/wurstclient/hacks/AntiKnockbackHack.java b/src/main/java/net/wurstclient/hacks/AntiKnockbackHack.java index 99bdfd1dff..610775582c 100644 --- a/src/main/java/net/wurstclient/hacks/AntiKnockbackHack.java +++ b/src/main/java/net/wurstclient/hacks/AntiKnockbackHack.java @@ -21,19 +21,20 @@ public final class AntiKnockbackHack extends Hack implements KnockbackListener private final SliderSetting hStrength = new SliderSetting("Horizontal Strength", "How far to reduce horizontal knockback.\n" + + "-100% = double knockback\n" + "0% = normal knockback\n" + "100% = no knockback\n" + ">100% = reverse knockback", - 1, 0.01, 2, 0.01, ValueDisplay.PERCENTAGE); + 1, -1, 2, 0.01, ValueDisplay.PERCENTAGE); private final SliderSetting vStrength = new SliderSetting("Vertical Strength", - "How far to reduce vertical knockback.\n" + "100% = no knockback\n" - + ">100% = reverse knockback", - 1, 0.01, 2, 0.01, ValueDisplay.PERCENTAGE); + "How far to reduce vertical knockback.\n" + + "-100% = double knockback\n" + "0% = normal knockback\n" + + "100% = no knockback\n" + ">100% = reverse knockback", + 1, -1, 2, 0.01, ValueDisplay.PERCENTAGE); public AntiKnockbackHack() { super("AntiKnockback"); - setCategory(Category.COMBAT); addSetting(hStrength); addSetting(vStrength); diff --git a/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java b/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java index 50c6320935..f1434baedb 100644 --- a/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java +++ b/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java @@ -8,7 +8,6 @@ package net.wurstclient.mixin; import java.io.File; -import java.util.UUID; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -27,7 +26,6 @@ import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerInteractionManager; import net.minecraft.client.session.ProfileKeys; -import net.minecraft.client.session.ProfileKeysImpl; import net.minecraft.client.session.Session; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; @@ -59,7 +57,7 @@ public abstract class MinecraftClientMixin private YggdrasilAuthenticationService authenticationService; private Session wurstSession; - private ProfileKeysImpl wurstProfileKeys; + private ProfileKeys wurstProfileKeys; private MinecraftClientMixin(WurstClient wurst, String name) { @@ -213,10 +211,12 @@ public void setSession(Session session) { wurstSession = session; - UserApiService userApiService = authenticationService - .createUserApiService(session.getAccessToken()); - UUID uuid = wurstSession.getUuidOrNull(); + UserApiService userApiService = + session.getAccountType() == Session.AccountType.MSA + ? authenticationService.createUserApiService( + session.getAccessToken()) + : UserApiService.OFFLINE; wurstProfileKeys = - new ProfileKeysImpl(userApiService, uuid, runDirectory.toPath()); + ProfileKeys.create(userApiService, session, runDirectory.toPath()); } } diff --git a/src/main/java/net/wurstclient/mixin/SodiumOldBlockOcclusionCacheMixin.java b/src/main/java/net/wurstclient/mixin/SodiumOldBlockOcclusionCacheMixin.java new file mode 100644 index 0000000000..cf3083ebfd --- /dev/null +++ b/src/main/java/net/wurstclient/mixin/SodiumOldBlockOcclusionCacheMixin.java @@ -0,0 +1,46 @@ +/* + * 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.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.BlockView; +import net.wurstclient.event.EventManager; +import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent; + +@Pseudo +@Mixin(targets = { + // < Sodium 0.6.0-beta.1 + "me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache", + // < Sodium 0.5.0 + "me.jellysquid.mods.sodium.client.render.occlusion.BlockOcclusionCache"}, + remap = false) +public class SodiumOldBlockOcclusionCacheMixin +{ + /** + * This mixin hides and shows regular full blocks when using X-Ray with + * old versions of Sodium installed. + */ + @Inject(at = @At("HEAD"), method = "shouldDrawSide", cancellable = true) + public void shouldDrawSide(BlockState state, BlockView world, BlockPos pos, + Direction side, CallbackInfoReturnable cir) + { + ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, pos); + EventManager.fire(event); + + if(event.isRendered() != null) + cir.setReturnValue(event.isRendered()); + } +} diff --git a/src/main/java/net/wurstclient/mixin/SodiumOldFluidRendererMixin.java b/src/main/java/net/wurstclient/mixin/SodiumOldFluidRendererMixin.java new file mode 100644 index 0000000000..acf7b1bff5 --- /dev/null +++ b/src/main/java/net/wurstclient/mixin/SodiumOldFluidRendererMixin.java @@ -0,0 +1,48 @@ +/* + * 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.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.BlockRenderView; +import net.wurstclient.event.EventManager; +import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent; + +@Pseudo +@Mixin(targets = { + // < Sodium 0.6.0-beta.1 + "me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.FluidRenderer", + // < Sodium 0.4.9 + "me.jellysquid.mods.sodium.client.render.pipeline.FluidRenderer"}, + remap = false) +public class SodiumOldFluidRendererMixin +{ + /** + * This mixin hides and shows fluids when using X-Ray with old versions of + * Sodium installed. + */ + @Inject(at = @At("HEAD"), method = "isSideExposed", cancellable = true) + private void isSideExposed(BlockRenderView world, int x, int y, int z, + Direction dir, float height, CallbackInfoReturnable cir) + { + BlockPos pos = new BlockPos(x, y, z); + BlockState state = world.getBlockState(pos); + ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, pos); + EventManager.fire(event); + + if(event.isRendered() != null) + cir.setReturnValue(event.isRendered()); + } +} diff --git a/src/main/java/net/wurstclient/util/RotationUtils.java b/src/main/java/net/wurstclient/util/RotationUtils.java index 6b6f0b8d1e..fce4c56031 100644 --- a/src/main/java/net/wurstclient/util/RotationUtils.java +++ b/src/main/java/net/wurstclient/util/RotationUtils.java @@ -89,7 +89,12 @@ public static double getAngleToLastReportedLookVec(Vec3d vec) public static double getAngleToLastReportedLookVec(Rotation rotation) { ClientPlayerEntity player = MC.player; - Rotation lastReported = new Rotation(player.lastYaw, player.lastPitch); + + // lastYaw/Pitch do not get updated when the player is in a vehicle + Rotation lastReported = player.hasVehicle() + ? new Rotation(player.getYaw(), player.getPitch()) + : new Rotation(player.lastYaw, player.lastPitch); + return lastReported.getAngleTo(rotation); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 023db277a3..c881efd7ea 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -36,8 +36,7 @@ "breaks": { "wi_zoom": "*", "wi-zoom": "*", - "vulkanmod": "*", - "sodium": "<0.6.0-beta.1" + "vulkanmod": "*" }, "custom": { "modmenu": { diff --git a/src/main/resources/wurst.mixins.json b/src/main/resources/wurst.mixins.json index 342c496fe1..dfc3f747e0 100644 --- a/src/main/resources/wurst.mixins.json +++ b/src/main/resources/wurst.mixins.json @@ -60,6 +60,8 @@ "SimpleOptionMixin", "SodiumBlockOcclusionCacheMixin", "SodiumFluidRendererMixin", + "SodiumOldBlockOcclusionCacheMixin", + "SodiumOldFluidRendererMixin", "StatsScreenMixin", "StatusEffectInstanceMixin", "TelemetryManagerMixin",