Skip to content

Commit d234586

Browse files
committed
Bring back barrier block mixin
1 parent 0beeb3a commit d234586

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

src/main/java/com/lambda/mixin/items/BarrierBlockMixin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import net.minecraft.block.BarrierBlock;
2222
import net.minecraft.block.BlockRenderType;
2323
import net.minecraft.block.BlockState;
24+
import net.minecraft.block.Blocks;
2425
import org.spongepowered.asm.mixin.Mixin;
2526
import org.spongepowered.asm.mixin.injection.At;
2627
import org.spongepowered.asm.mixin.injection.Inject;
@@ -33,10 +34,9 @@ public class BarrierBlockMixin {
3334
*/
3435
@Inject(method = "getRenderType", at = @At("RETURN"), cancellable = true)
3536
private void getRenderType(BlockState state, CallbackInfoReturnable<BlockRenderType> cir) {
36-
// FixMe: This mixins fucks up the loading process by calling the configurations too early and doesn't load the settings
37-
/*if (BlockESP.INSTANCE.isEnabled()
37+
if (BlockESP.INSTANCE.isEnabled()
3838
&& BlockESP.getBarrier()
3939
&& state.getBlock() == Blocks.BARRIER
40-
) cir.setReturnValue(BlockRenderType.MODEL);*/
40+
) cir.setReturnValue(BlockRenderType.MODEL);
4141
}
4242
}

src/main/java/com/lambda/mixin/network/ClientConnectionMixin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.spongepowered.asm.mixin.Final;
3535
import org.spongepowered.asm.mixin.Mixin;
3636
import org.spongepowered.asm.mixin.Shadow;
37+
import org.spongepowered.asm.mixin.Unique;
3738
import org.spongepowered.asm.mixin.injection.At;
3839
import org.spongepowered.asm.mixin.injection.Inject;
3940
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -62,7 +63,7 @@ private void sendingPacketPost(Packet<?> packet, final CallbackInfo callbackInfo
6263
EventFlow.post(new PacketEvent.Send.Post((Packet<? extends ServerPlayPacketListener>) packet));
6364
}
6465

65-
@SuppressWarnings("all")
66+
@SuppressWarnings("unchecked")
6667
@Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/packet/Packet;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;handlePacket(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;)V", shift = At.Shift.BEFORE), cancellable = true, require = 1)
6768
private void receivingPacket(
6869
ChannelHandlerContext channelHandlerContext,

src/main/kotlin/com/lambda/config/configurations/ConfigLoader.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ object ConfigLoader: Loadable {
2525
Configuration.configurations.forEach {
2626
it.tryLoad()
2727
}
28-
return "Loaded ${Configuration.configurations.size} configurations"
28+
return "Loading ${Configuration.configurations.size} configurations"
2929
}
3030
}

src/main/kotlin/com/lambda/module/modules/render/BlockESP.kt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,21 @@ object BlockESP : Module(
4343
description = "Render block ESP",
4444
tag = ModuleTag.RENDER,
4545
) {
46-
private var drawFaces: Boolean by setting("Draw Faces", true, "Draw faces of blocks").onValueSet(::rebuildMesh).onValueSet { _, to -> if (!to) drawOutlines = true }
47-
private var drawOutlines: Boolean by setting("Draw Outlines", true, "Draw outlines of blocks").onValueSet(::rebuildMesh).onValueSet { _, to -> if (!to) drawFaces = true }
48-
private val mesh by setting("Mesh", true, "Connect similar adjacent blocks").onValueSet(::rebuildMesh)
46+
// ToDo: Toggle searching, solve memory leak
47+
private val searchBlocks by setting("Search Blocks", true, "Search for blocks around the player")
48+
private val blocks by setting("Blocks", setOf(Blocks.BEDROCK), setOf(Blocks.BEDROCK), "Render blocks") { searchBlocks }.onValueSet(::rebuildMesh)
49+
private var drawFaces: Boolean by setting("Draw Faces", true, "Draw faces of blocks") { searchBlocks }.onValueSet(::rebuildMesh).onValueSet { _, to -> if (!to) drawOutlines = true }
50+
private var drawOutlines: Boolean by setting("Draw Outlines", true, "Draw outlines of blocks") { searchBlocks }.onValueSet(::rebuildMesh).onValueSet { _, to -> if (!to) drawFaces = true }
51+
private val mesh by setting("Mesh", true, "Connect similar adjacent blocks") { searchBlocks }.onValueSet(::rebuildMesh)
4952

50-
private val useBlockColor by setting("Use Block Color", false, "Use the color of the block instead").onValueSet(::rebuildMesh)
51-
private val faceColor by setting("Face Color", Color(100, 150, 255, 51), "Color of the surfaces") { drawFaces && !useBlockColor }.onValueSet(::rebuildMesh)
52-
private val outlineColor by setting("Outline Color", Color(100, 150, 255, 128), "Color of the outlines") { drawOutlines && !useBlockColor }.onValueSet(::rebuildMesh)
53+
private val useBlockColor by setting("Use Block Color", false, "Use the color of the block instead") { searchBlocks }.onValueSet(::rebuildMesh)
54+
private val faceColor by setting("Face Color", Color(100, 150, 255, 51), "Color of the surfaces") { searchBlocks && drawFaces && !useBlockColor }.onValueSet(::rebuildMesh)
55+
private val outlineColor by setting("Outline Color", Color(100, 150, 255, 128), "Color of the outlines") { searchBlocks && drawOutlines && !useBlockColor }.onValueSet(::rebuildMesh)
5356

54-
private val outlineMode by setting("Outline Mode", DirectionMask.OutlineMode.AND, "Outline mode").onValueSet(::rebuildMesh)
55-
56-
private val blocks by setting("Blocks", setOf(Blocks.BEDROCK), setOf(Blocks.BEDROCK), "Render blocks").onValueSet(::rebuildMesh)
57+
private val outlineMode by setting("Outline Mode", DirectionMask.OutlineMode.AND, "Outline mode") { searchBlocks }.onValueSet(::rebuildMesh)
5758

5859
@JvmStatic
59-
val barrier by setting("Solid Barrier Block", true, "Render barrier blocks")
60+
val barrier by setting("Solid Barrier Block", true, "Render barrier blocks").onValueChange { _, _ -> mc.worldRenderer.reload() }
6061

6162
// ToDo: I wanted to render this as a transparent / translucent block with a red tint.
6263
// Like the red stained glass block without the texture sprite.

0 commit comments

Comments
 (0)