Skip to content

Commit

Permalink
Document what each mixin does
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Oct 28, 2023
1 parent be90e04 commit 04b543c
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/net/wurstclient/mixin/BasicBakedModelMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
@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)
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/wurstclient/mixin/BlockMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
@Mixin(Block.class)
public abstract class BlockMixin implements ItemConvertible
{
/**
* This mixin allows X-Ray to show ores that would normally be obstructed by
* other blocks.
*/
@Inject(at = @At("HEAD"),
method = "shouldDrawSide(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;Lnet/minecraft/util/math/BlockPos;)Z",
cancellable = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
@Mixin(BlockModelRenderer.class)
public abstract class BlockModelRendererMixin
{
/**
* This mixin hides and shows blocks when using X-Ray with OptiFine
* installed.
*
* TODO: Does {@link BasicBakedModelMixin} make this mixin redundant?
*/
@Inject(at = @At("HEAD"),
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",
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/wurstclient/mixin/FluidRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
@Mixin(FluidRenderer.class)
public class FluidRendererMixin
{
/**
* This mixin hides and shows fluids when using X-Ray without Sodium
* installed.
*/
@Inject(at = @At("HEAD"),
method = "isSideCovered(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;FLnet/minecraft/block/BlockState;)Z",
cancellable = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
@Mixin(MultipartBakedModel.class)
public class MultipartBakedModelMixin
{
/**
* TODO: This mixin doesn't seem to do anything?
*/
@Inject(at = @At("HEAD"), method = "getQuads", cancellable = true)
private void getQuads(@Nullable BlockState state, @Nullable Direction face,
Random random, CallbackInfoReturnable<List<BakedQuad>> cir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
remap = false)
public class SodiumBlockOcclusionCacheMixin
{
/**
* This mixin hides and shows regular full blocks when using X-Ray with
* Sodium installed.
*/
@Inject(at = @At("HEAD"), method = "shouldDrawSide", cancellable = true)
public void shouldDrawSide(BlockState state, BlockView world, BlockPos pos,
Direction side, CallbackInfoReturnable<Boolean> cir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class TerrainRenderContextMixin
* <p>
* We could make this optional to stop the game from crashing, but then
* X-Ray would silently stop working and it would be much harder to debug.
*
* TODO: {@link BasicBakedModelMixin} makes this mixin redundant.
*/
@Inject(at = @At("HEAD"),
method = "tessellateBlock",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
@Mixin(WeightedBakedModel.class)
public class WeightedBakedModelMixin
{
/**
* TODO: This mixin doesn't seem to do anything?
*/
@Inject(at = @At("HEAD"), method = "getQuads", cancellable = true)
private void getQuads(@Nullable BlockState state, @Nullable Direction face,
Random random, CallbackInfoReturnable<List<BakedQuad>> cir)
Expand Down

0 comments on commit 04b543c

Please sign in to comment.