Skip to content

Commit 4f0b15b

Browse files
Update to latest Fabric API and Sodium
1 parent b17dc01 commit 4f0b15b

File tree

4 files changed

+37
-35
lines changed

4 files changed

+37
-35
lines changed

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ org.gradle.configuration-cache=true
77
# check these at https://fabricmc.net/develop/ and
88
# https://modrinth.com/mod/fabric-api/versions
99
minecraft_version=1.21.11
10-
yarn_mappings=1.21.11+build.2
11-
loader_version=0.18.2
10+
yarn_mappings=1.21.11+build.3
11+
loader_version=0.18.3
1212
loom_version=1.14-SNAPSHOT
1313

1414
# Fabric API
15-
fabric_version=0.139.4+1.21.11
15+
fabric_version=0.140.0+1.21.11
1616

1717
# Mod Properties
1818
mod_version=v7.51.3-MC1.21.11
@@ -26,5 +26,5 @@ mcx_repo_id=Wurst-Imperium/Wurst-MCX2
2626

2727
# Dependencies
2828
# check at https://modrinth.com/mod/sodium/versions?l=fabric&g=1.21.11
29-
sodium_version=mc1.21.11-0.8.0-fabric
29+
sodium_version=mc1.21.11-0.8.1-fabric
3030
do_mod_compat_test=true

src/gametest/java/net/wurstclient/gametest/tests/XRayHackTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static void testXRayHack(ClientGameTestContext context,
5757
waitForChunkReloading(context, world);
5858
assertScreenshotEquals(context, "xray_opacity",
5959
WurstTest.IS_MOD_COMPAT_TEST ? "https://i.imgur.com/hXdzoDB.png"
60-
: "https://i.imgur.com/ERrL7ko.png");
60+
: "https://i.imgur.com/oZqevTx.png");
6161

6262
// Exposed only + opacity
6363
runWurstCommand(context, "setcheckbox X-Ray only_show_exposed on");
@@ -67,7 +67,7 @@ public static void testXRayHack(ClientGameTestContext context,
6767
waitForChunkReloading(context, world);
6868
assertScreenshotEquals(context, "xray_exposed_only_opacity",
6969
WurstTest.IS_MOD_COMPAT_TEST ? "https://i.imgur.com/ZwIARSr.png"
70-
: "https://i.imgur.com/mCnP6LG.png");
70+
: "https://i.imgur.com/3DLxNuS.png");
7171

7272
// Clean up
7373
runCommand(server, "fill ~-5 ~-2 ~4 ~5 ~5 ~7 air");

src/main/java/net/wurstclient/mixin/indigo/AbstractTerrainRenderContextMixin.java

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,45 @@
77
*/
88
package net.wurstclient.mixin.indigo;
99

10+
import org.spongepowered.asm.mixin.Final;
1011
import org.spongepowered.asm.mixin.Mixin;
1112
import org.spongepowered.asm.mixin.Pseudo;
13+
import org.spongepowered.asm.mixin.Shadow;
14+
import org.spongepowered.asm.mixin.injection.At;
15+
import org.spongepowered.asm.mixin.injection.Inject;
16+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1217

13-
// import
14-
// net.fabricmc.fabric.impl.client.indigo.renderer.mesh.MutableQuadViewImpl;
15-
// import
16-
// net.fabricmc.fabric.impl.client.indigo.renderer.render.AbstractTerrainRenderContext;
17-
// import
18-
// net.fabricmc.fabric.impl.client.indigo.renderer.render.BlockRenderInfo;
18+
import net.fabricmc.fabric.impl.client.indigo.renderer.mesh.MutableQuadViewImpl;
19+
import net.fabricmc.fabric.impl.client.indigo.renderer.render.BlockRenderInfo;
20+
import net.wurstclient.WurstClient;
21+
import net.wurstclient.hacks.XRayHack;
1922

2023
@Pseudo
2124
@Mixin(
2225
targets = "net.fabricmc.fabric.impl.client.indigo.renderer.render.AbstractTerrainRenderContext",
2326
remap = false)
2427
public abstract class AbstractTerrainRenderContextMixin
2528
{
26-
// @Shadow
27-
// @Final
28-
// private BlockRenderInfo blockInfo;
29+
@Shadow
30+
@Final
31+
private BlockRenderInfo blockInfo;
2932

30-
// /**
31-
// * Applies X-Ray's opacity mask to the block color after all the normal
32-
// * coloring and shading is done, if Indigo is running.
33-
// */
34-
// @Inject(at = @At("RETURN"),
35-
// method =
36-
// "shadeQuad(Lnet/fabricmc/fabric/impl/client/indigo/renderer/mesh/MutableQuadViewImpl;ZZZ)V",
37-
// require = 0)
38-
// private void onShadeQuad(MutableQuadViewImpl quad, boolean ao,
39-
// boolean emissive, boolean vanillaShade, CallbackInfo ci)
40-
// {
41-
// XRayHack xray = WurstClient.INSTANCE.getHax().xRayHack;
42-
// if(!xray.isOpacityMode() || xray
43-
// .isVisible(blockInfo.blockState.getBlock(), blockInfo.blockPos))
44-
// return;
45-
46-
// for(int i = 0; i < 4; i++)
47-
// quad.color(i, quad.color(i) & xray.getOpacityColorMask());
48-
// }
33+
/**
34+
* Applies X-Ray's opacity mask to the block color after all the normal
35+
* coloring and shading is done, if Indigo is running.
36+
*/
37+
@Inject(at = @At("RETURN"),
38+
method = "shadeQuad(Lnet/fabricmc/fabric/impl/client/indigo/renderer/mesh/MutableQuadViewImpl;ZZZ)V",
39+
require = 0)
40+
private void onShadeQuad(MutableQuadViewImpl quad, boolean ao,
41+
boolean emissive, boolean vanillaShade, CallbackInfo ci)
42+
{
43+
XRayHack xray = WurstClient.INSTANCE.getHax().xRayHack;
44+
if(!xray.isOpacityMode() || xray
45+
.isVisible(blockInfo.blockState.getBlock(), blockInfo.blockPos))
46+
return;
47+
48+
for(int i = 0; i < 4; i++)
49+
quad.color(i, quad.color(i) & xray.getOpacityColorMask());
50+
}
4951
}

src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"accessWidener": "wurst.accesswidener",
2727
"depends": {
2828
"fabricloader": ">=0.17.3",
29-
"fabric-api": ">=0.139.1",
29+
"fabric-api": ">=0.140.0",
3030
"minecraft": "~1.21.11-beta.1",
3131
"java": ">=21"
3232
},

0 commit comments

Comments
 (0)