-
-
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.
Merge tag 'v7.46.1' into 1.21.2-pre2
- Loading branch information
Showing
10 changed files
with
119 additions
and
18 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
46 changes: 46 additions & 0 deletions
46
src/main/java/net/wurstclient/mixin/SodiumOldBlockOcclusionCacheMixin.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,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<Boolean> cir) | ||
{ | ||
ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, pos); | ||
EventManager.fire(event); | ||
|
||
if(event.isRendered() != null) | ||
cir.setReturnValue(event.isRendered()); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/net/wurstclient/mixin/SodiumOldFluidRendererMixin.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-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<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()); | ||
} | ||
} |
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