-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Abstraction of List Setting as well some changes in Notifications, Cr…
…iticals, and some other places.
- Loading branch information
1 parent
59082a6
commit 381c8a0
Showing
48 changed files
with
1,042 additions
and
1,564 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
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
55 changes: 0 additions & 55 deletions
55
src/main/java/dev/heliosclient/mixin/MixinBlockModelRenderer.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 |
---|---|---|
@@ -1,63 +1,8 @@ | ||
package dev.heliosclient.mixin; | ||
|
||
import dev.heliosclient.managers.ModuleManager; | ||
import dev.heliosclient.module.modules.render.Xray; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.client.render.BufferBuilder; | ||
import net.minecraft.client.render.VertexConsumer; | ||
import net.minecraft.client.render.block.BlockModelRenderer; | ||
import net.minecraft.client.render.model.BakedModel; | ||
import net.minecraft.client.render.model.BakedQuad; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.random.Random; | ||
import net.minecraft.world.BlockRenderView; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
/** | ||
* Credits: Meteor Client | ||
*/ | ||
@Mixin(BlockModelRenderer.class) | ||
public abstract class MixinBlockModelRenderer { | ||
|
||
@Unique | ||
private final ThreadLocal<Integer> alphas = new ThreadLocal<>(); | ||
|
||
@Inject(method = "render(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", at = @At("HEAD"), cancellable = true) | ||
private void onRender(BlockRenderView world, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrices, VertexConsumer vertexConsumer, boolean cull, Random random, long seed, int overlay, CallbackInfo info) { | ||
int alpha = (int) ModuleManager.get(Xray.class).alpha.value; | ||
|
||
if (alpha == 0) info.cancel(); | ||
else alphas.set(alpha); | ||
} | ||
|
||
@Inject(method = "renderQuad(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/client/util/math/MatrixStack$Entry;Lnet/minecraft/client/render/model/BakedQuad;FFFFIIIII)V", at = @At("TAIL")) | ||
private void onRenderQuad(BlockRenderView world, BlockState state, BlockPos pos, VertexConsumer vertexConsumer, MatrixStack.Entry matrixEntry, BakedQuad quad, float brightness0, float brightness1, float brightness2, float brightness3, int light0, int light1, int light2, int light3, int overlay, CallbackInfo ci) { | ||
int alpha = alphas.get(); | ||
if (alpha != -1) rewriteBuffer(vertexConsumer, alpha); | ||
} | ||
|
||
@Unique | ||
private void rewriteBuffer(VertexConsumer vertexConsumer, int alpha) { | ||
if (vertexConsumer instanceof BufferBuilder bufferBuilder) { | ||
AccessorBufferBuilder bufferBuilderAccessor = ((AccessorBufferBuilder) bufferBuilder); | ||
|
||
int prevOffset = bufferBuilderAccessor.getElementOffset(); | ||
|
||
if (prevOffset > 0) { | ||
int i = bufferBuilderAccessor.getVertexFormat().getVertexSizeByte(); | ||
|
||
for (int l = 1; l <= 4; l++) { | ||
bufferBuilderAccessor.setElementOffset(prevOffset - i * l); | ||
bufferBuilder.putByte(15, (byte) (alpha)); | ||
} | ||
|
||
bufferBuilderAccessor.setElementOffset(prevOffset); | ||
} | ||
} | ||
} | ||
} |
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
15 changes: 1 addition & 14 deletions
15
src/main/java/dev/heliosclient/mixin/MixinRenderLayers.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 |
---|---|---|
@@ -1,22 +1,9 @@ | ||
package dev.heliosclient.mixin; | ||
|
||
import dev.heliosclient.managers.ModuleManager; | ||
import dev.heliosclient.module.modules.render.Xray; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.client.render.RenderLayer; | ||
import net.minecraft.client.render.RenderLayers; | ||
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; | ||
|
||
@Mixin(RenderLayers.class) | ||
public abstract class MixinRenderLayers { | ||
@Inject(method = "getBlockLayer", at = @At("HEAD"), cancellable = true) | ||
private static void setBlockLayer(BlockState state, CallbackInfoReturnable<RenderLayer> info) { | ||
int alpha = (int) ModuleManager.get(Xray.class).alpha.value; | ||
if (ModuleManager.get(Xray.class).isActive() && !ModuleManager.get(Xray.class).shouldXray(state.getBlock()) && alpha > 0 && alpha < 255) { | ||
info.setReturnValue(RenderLayer.getTranslucent()); | ||
} | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/dev/heliosclient/mixin/PlayerInteractEntityC2SPacketMixin.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,21 @@ | ||
package dev.heliosclient.mixin; | ||
|
||
import dev.heliosclient.system.mixininterface.IPlayerInteractEntityC2SPacket; | ||
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
|
||
@Mixin(PlayerInteractEntityC2SPacket.class) | ||
public abstract class PlayerInteractEntityC2SPacketMixin implements IPlayerInteractEntityC2SPacket { | ||
@Shadow | ||
@Final | ||
private PlayerInteractEntityC2SPacket.InteractTypeHandler type; | ||
|
||
@Override | ||
@SuppressWarnings("all") | ||
public PlayerInteractEntityC2SPacket.InteractType getType() { | ||
return type.getType(); | ||
} | ||
} |
Oops, something went wrong.