-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
Showing
10 changed files
with
115 additions
and
123 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
48 changes: 48 additions & 0 deletions
48
src/main/java/net/wurstclient/mixin/BasicBakedModelMixin.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,48 @@ | ||
/* | ||
* Copyright (c) 2014-2023 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 java.util.List; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
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.model.BakedQuad; | ||
import net.minecraft.client.render.model.BasicBakedModel; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.util.math.random.Random; | ||
import net.wurstclient.WurstClient; | ||
import net.wurstclient.event.EventManager; | ||
import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent; | ||
|
||
@Mixin(BasicBakedModel.class) | ||
public class BasicBakedModelMixin | ||
{ | ||
/** | ||
* This mixin hides blocks like grass and snow when using X-Ray. It works | ||
* with and without Sodium installed. | ||
*/ | ||
@Inject(at = @At("HEAD"), method = "getQuads", cancellable = true) | ||
private void getQuads(@Nullable BlockState state, @Nullable Direction face, | ||
Random random, CallbackInfoReturnable<List<BakedQuad>> cir) | ||
{ | ||
if(face != null || state == null | ||
|| !WurstClient.INSTANCE.getHax().xRayHack.isEnabled()) | ||
return; | ||
|
||
ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, null); | ||
EventManager.fire(event); | ||
|
||
if(Boolean.FALSE.equals(event.isRendered())) | ||
cir.setReturnValue(List.of()); | ||
} | ||
} |
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
67 changes: 0 additions & 67 deletions
67
src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java
This file was deleted.
Oops, something went wrong.
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/SodiumFluidRendererMixin.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-2023 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 = { | ||
// current target | ||
"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 SodiumFluidRendererMixin | ||
{ | ||
/** | ||
* This mixin hides and shows fluids when using X-Ray with 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<Boolean> 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()); | ||
} | ||
} |
48 changes: 0 additions & 48 deletions
48
src/main/java/net/wurstclient/mixin/TerrainRenderContextMixin.java
This file was deleted.
Oops, something went wrong.
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