Skip to content

Commit

Permalink
Merge branch '1.21.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Dec 5, 2024
2 parents e4822ac + b7a4394 commit 49851e2
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 48 deletions.
12 changes: 1 addition & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ repositories {
// for more information about repositories.
}

// Override vulnerable dependencies until Minecraft updates to newer versions
configurations.all {
resolutionStrategy {
// v1.15.0, used by Minecraft 1.21.2 and 1.21.3, is vulnerable to CVE-2024-35255
force "com.microsoft.azure:msal4j:1.17.2"
// v4.1.97.Final, used by Minecraft 1.21 - 1.21.3, is vulnerable to CVE-2024-47535
force "io.netty:netty-common:4.1.115.Final"
}
}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
Expand Down Expand Up @@ -143,7 +133,7 @@ spotless {
}
json {
target "src/**/*.json"
gson().indentWithSpaces(2).version("2.10.1")
gson().indentWithSpaces(2).version("2.11.0")
}
}

Expand Down
40 changes: 20 additions & 20 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Fabric Properties
# check these at https://fabricmc.net/develop/ and
# https://modrinth.com/mod/fabric-api/versions
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.9

# Fabric API
fabric_version=0.110.0+1.21.3

# Mod Properties
mod_version = v7.46.4-MC1.21.3
maven_group = net.wurstclient
archives_base_name = Wurst-Client

# Dependencies
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Fabric Properties
# check these at https://fabricmc.net/develop/ and
# https://modrinth.com/mod/fabric-api/versions
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.1
loader_version=0.16.9

# Fabric API
fabric_version=0.110.5+1.21.4

# Mod Properties
mod_version = v7.46.4-MC1.21.4
maven_group = net.wurstclient
archives_base_name = Wurst-Client

# Dependencies
Empty file modified gradlew
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/main/java/net/wurstclient/WurstClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public enum WurstClient
public static IMinecraftClient IMC;

public static final String VERSION = "7.46.4";
public static final String MC_VERSION = "1.21.3";
public static final String MC_VERSION = "1.21.4";

private WurstAnalytics analytics;
private EventManager eventManager;
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/wurstclient/hacks/XRayHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ public int getOpacityColorMask()
return (int)(opacity.getValue() * 255) << 24 | 0xFFFFFF;
}

public float getOpacityFloat()
{
return opacity.getValueF();
}

/**
* Checks if OptiFine/OptiFabric is installed and returns a warning message
* if it is.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract class AbstractBlockRenderContextMixin

/**
* Applies X-Ray's opacity mask to the block color after all the normal
* coloring and shading is done.
* coloring and shading is done, if Indigo is running.
*/
@Inject(at = @At("RETURN"),
method = "shadeQuad(Lnet/fabricmc/fabric/impl/client/indigo/renderer/mesh/MutableQuadViewImpl;ZZZ)V")
Expand Down
79 changes: 79 additions & 0 deletions src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* 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.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;

import net.minecraft.block.BlockState;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.block.BlockModelRenderer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemConvertible;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.BlockRenderView;
import net.wurstclient.WurstClient;
import net.wurstclient.event.EventManager;
import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent;
import net.wurstclient.hacks.XRayHack;

@Mixin(BlockModelRenderer.class)
public abstract class BlockModelRendererMixin implements ItemConvertible
{
private static ThreadLocal<Float> currentOpacity =
ThreadLocal.withInitial(() -> 1F);

/**
* Makes X-Ray work when neither Sodium nor Indigo are running.
*/
@WrapOperation(at = @At(value = "INVOKE",
target = "Lnet/minecraft/block/Block;shouldDrawSide(Lnet/minecraft/block/BlockState;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/Direction;)Z"),
method = {
"renderSmooth(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V",
"renderFlat(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V"})
private static boolean onRenderSmoothOrFlat(BlockState state,
BlockState otherState, Direction side, Operation<Boolean> original,
BlockRenderView world, BakedModel model, BlockState state2,
BlockPos pos, MatrixStack matrices, VertexConsumer vertexConsumer,
boolean cull, Random random, long seed, int overlay)
{
ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, pos);
EventManager.fire(event);

XRayHack xray = WurstClient.INSTANCE.getHax().xRayHack;
if(!xray.isOpacityMode() || xray.isVisible(state.getBlock(), pos))
currentOpacity.set(1F);
else
currentOpacity.set(xray.getOpacityFloat());

if(event.isRendered() != null)
return event.isRendered();

return original.call(state, otherState, side);
}

/**
* Applies X-Ray's opacity mask to the block color after all the normal
* coloring and shading is done, if neither Sodium nor Indigo are running.
*/
@ModifyConstant(
method = "renderQuad(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/client/util/math/MatrixStack$Entry;Lnet/minecraft/client/render/model/BakedQuad;FFFFIIIII)V",
constant = @Constant(floatValue = 1F))
private float modifyOpacity(float original)
{
return currentOpacity.get();
}
}
8 changes: 4 additions & 4 deletions src/main/java/net/wurstclient/mixin/BlockRenderInfoMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public abstract class BlockRenderInfoMixin
public BlockState blockState;

/**
* This mixin hides and shows regular blocks when using X-Ray without Sodium
* installed.
* This mixin hides and shows regular blocks when using X-Ray, if Indigo
* is running and Sodium is not installed.
*/
@Inject(at = @At("HEAD"), method = "shouldDrawFace", cancellable = true)
private void onShouldDrawFace(Direction face,
@Inject(at = @At("HEAD"), method = "shouldDrawSide", cancellable = true)
private void onShouldDrawSide(Direction face,
CallbackInfoReturnable<Boolean> cir)
{
ShouldDrawSideEvent event =
Expand Down
20 changes: 15 additions & 5 deletions src/main/java/net/wurstclient/mixin/HeldItemRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@
@Mixin(HeldItemRenderer.class)
public abstract class HeldItemRendererMixin
{
@Inject(at = {@At(value = "INVOKE",
/**
* This mixin is injected into the `BLOCK` case of the `item.getUseAction()`
* switch.
*/
@Inject(at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/render/item/HeldItemRenderer;applyEquipOffset(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/Arm;F)V",
ordinal = 4)}, method = "renderFirstPersonItem")
ordinal = 4),
method = "renderFirstPersonItem(Lnet/minecraft/client/network/AbstractClientPlayerEntity;FFLnet/minecraft/util/Hand;FLnet/minecraft/item/ItemStack;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V")
private void onApplyEquipOffsetBlocking(AbstractClientPlayerEntity player,
float tickDelta, float pitch, Hand hand, float swingProgress,
ItemStack item, float equipProgress, MatrixStack matrices,
Expand All @@ -38,9 +43,14 @@ private void onApplyEquipOffsetBlocking(AbstractClientPlayerEntity player,
.adjustShieldPosition(matrices, true);
}

@Inject(at = {@At(value = "INVOKE",
target = "Lnet/minecraft/client/render/item/HeldItemRenderer;applySwingOffset(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/Arm;F)V",
ordinal = 1)}, method = "renderFirstPersonItem")
/**
* This mixin is injected into the last `else` block of
* renderFirstPersonItem(), right after `else if(player.isUsingRiptide())`.
*/
@Inject(at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/render/item/HeldItemRenderer;swingArm(FFLnet/minecraft/client/util/math/MatrixStack;ILnet/minecraft/util/Arm;)V",
ordinal = 2),
method = "renderFirstPersonItem(Lnet/minecraft/client/network/AbstractClientPlayerEntity;FFLnet/minecraft/util/Hand;FLnet/minecraft/item/ItemStack;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V")
private void onApplySwingOffsetNotBlocking(
AbstractClientPlayerEntity player, float tickDelta, float pitch,
Hand hand, float swingProgress, ItemStack item, float equipProgress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.InGameOverlayRenderer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.wurstclient.WurstClient;

@Mixin(InGameOverlayRenderer.class)
public class InGameOverlayRendererMixin
{
@ModifyConstant(
method = "renderFireOverlay(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/util/math/MatrixStack;)V",
method = "renderFireOverlay(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;)V",
constant = @Constant(floatValue = -0.3F))
private static float getFireOffset(float original)
{
Expand All @@ -32,10 +33,11 @@ private static float getFireOffset(float original)
}

@Inject(at = @At("HEAD"),
method = "renderUnderwaterOverlay(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/util/math/MatrixStack;)V",
method = "renderUnderwaterOverlay(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;)V",
cancellable = true)
private static void onRenderUnderwaterOverlay(MinecraftClient client,
MatrixStack matrices, CallbackInfo ci)
MatrixStack matrices, VertexConsumerProvider vertexConsumerProvider,
CallbackInfo ci)
{
if(WurstClient.INSTANCE.getHax().noOverlayHack.isEnabled())
ci.cancel();
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
],
"accessWidener": "wurst.accesswidener",
"depends": {
"fabricloader": ">=0.16.3",
"fabric-api": ">=0.105.3",
"minecraft": "~1.21.2-alpha.24.40.a",
"fabricloader": ">=0.16.9",
"fabric-api": ">=0.110.5",
"minecraft": "~1.21.4-rc.3",
"java": ">=21"
},
"suggests": {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/wurst.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"BasicBakedModelMixin",
"BlockEntityRenderDispatcherMixin",
"BlockMixin",
"BlockModelRendererMixin",
"BlockRenderInfoMixin",
"CactusBlockMixin",
"CameraMixin",
Expand Down

0 comments on commit 49851e2

Please sign in to comment.