-
-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2424ae2
commit 101af58
Showing
9 changed files
with
137 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/net/wurstclient/mixin/AbstractBlockRenderContextMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* 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.Final; | ||
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.callback.CallbackInfo; | ||
|
||
import net.fabricmc.fabric.impl.client.indigo.renderer.mesh.MutableQuadViewImpl; | ||
import net.fabricmc.fabric.impl.client.indigo.renderer.render.AbstractBlockRenderContext; | ||
import net.fabricmc.fabric.impl.client.indigo.renderer.render.BlockRenderInfo; | ||
import net.wurstclient.WurstClient; | ||
import net.wurstclient.hacks.XRayHack; | ||
|
||
@Mixin(value = AbstractBlockRenderContext.class, remap = false) | ||
public abstract class AbstractBlockRenderContextMixin | ||
{ | ||
@Shadow | ||
@Final | ||
private BlockRenderInfo blockInfo; | ||
|
||
/** | ||
* Applies X-Ray's opacity mask to the block color after all the normal | ||
* coloring and shading is done. | ||
*/ | ||
@Inject(at = @At("RETURN"), | ||
method = "shadeQuad(Lnet/fabricmc/fabric/impl/client/indigo/renderer/mesh/MutableQuadViewImpl;ZZZ)V") | ||
private void onShadeQuad(MutableQuadViewImpl quad, boolean ao, | ||
boolean emissive, boolean vanillaShade, CallbackInfo ci) | ||
{ | ||
XRayHack xray = WurstClient.INSTANCE.getHax().xRayHack; | ||
if(!xray.isOpacityMode() || xray | ||
.isVisible(blockInfo.blockState.getBlock(), blockInfo.blockPos)) | ||
return; | ||
|
||
for(int i = 0; i < 4; i++) | ||
quad.color(i, quad.color(i) & xray.getOpacityColorMask()); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/net/wurstclient/mixin/RenderLayersMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import net.minecraft.block.BlockState; | ||
import net.minecraft.client.render.RenderLayer; | ||
import net.minecraft.client.render.RenderLayers; | ||
import net.wurstclient.WurstClient; | ||
|
||
@Mixin(RenderLayers.class) | ||
public abstract class RenderLayersMixin | ||
{ | ||
/** | ||
* Puts all blocks on the translucent layer if Opacity X-Ray is enabled. | ||
*/ | ||
@Inject(at = @At("HEAD"), | ||
method = "getBlockLayer(Lnet/minecraft/block/BlockState;)Lnet/minecraft/client/render/RenderLayer;", | ||
cancellable = true) | ||
private static void onGetBlockLayer(BlockState state, | ||
CallbackInfoReturnable<RenderLayer> cir) | ||
{ | ||
if(!WurstClient.INSTANCE.getHax().xRayHack.isOpacityMode()) | ||
return; | ||
|
||
cir.setReturnValue(RenderLayer.getTranslucent()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters