Skip to content

Commit 20704e2

Browse files
committed
Merge branch 'master' into feature/renderer
2 parents 3c062b3 + 3db1e98 commit 20704e2

File tree

12 files changed

+186
-7
lines changed

12 files changed

+186
-7
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.lambda.mixin.items;
2+
3+
import com.lambda.module.modules.render.BlockESP;
4+
import net.minecraft.block.BarrierBlock;
5+
import net.minecraft.block.BlockRenderType;
6+
import net.minecraft.block.BlockState;
7+
import net.minecraft.block.Blocks;
8+
import org.spongepowered.asm.mixin.Mixin;
9+
import org.spongepowered.asm.mixin.injection.At;
10+
import org.spongepowered.asm.mixin.injection.Inject;
11+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
12+
13+
@Mixin(BarrierBlock.class)
14+
public class BarrierBlockMixin {
15+
16+
@Inject(method = "getRenderType", at = @At(value = "RETURN"), cancellable = true)
17+
private void getRenderType(BlockState state, CallbackInfoReturnable<BlockRenderType> cir) {
18+
if (BlockESP.INSTANCE.isEnabled()
19+
&& BlockESP.getBarrier()
20+
&& state.getBlock() == Blocks.BARRIER
21+
) cir.setReturnValue(BlockRenderType.MODEL);
22+
}
23+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.lambda.mixin.render;
2+
3+
import com.lambda.module.modules.render.BlockESP;
4+
import net.minecraft.block.BlockState;
5+
import net.minecraft.block.Blocks;
6+
import net.minecraft.client.render.block.BlockRenderManager;
7+
import net.minecraft.client.render.model.BakedModel;
8+
import org.spongepowered.asm.mixin.Mixin;
9+
import org.spongepowered.asm.mixin.injection.At;
10+
import org.spongepowered.asm.mixin.injection.Inject;
11+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
12+
13+
@Mixin(BlockRenderManager.class)
14+
public abstract class BlockRenderManagerMixin {
15+
@Inject(method = "getModel", at = @At("HEAD"), cancellable = true)
16+
private void getModel(BlockState state, CallbackInfoReturnable<BakedModel> cir) {
17+
if (BlockESP.INSTANCE.isEnabled()
18+
&& BlockESP.getBarrier()
19+
&& state.getBlock() == Blocks.BARRIER
20+
) cir.setReturnValue(BlockESP.getModel());
21+
}
22+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.lambda.mixin.render;
2+
3+
import com.lambda.module.modules.render.NoRender;
4+
import net.minecraft.client.MinecraftClient;
5+
import net.minecraft.client.gui.hud.InGameOverlayRenderer;
6+
import net.minecraft.client.texture.Sprite;
7+
import net.minecraft.client.util.math.MatrixStack;
8+
import org.spongepowered.asm.mixin.Mixin;
9+
import org.spongepowered.asm.mixin.injection.At;
10+
import org.spongepowered.asm.mixin.injection.Inject;
11+
import org.spongepowered.asm.mixin.injection.ModifyArg;
12+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
13+
14+
@Mixin(InGameOverlayRenderer.class)
15+
public class InGameOverlayRendererMixin {
16+
@Inject(method = "renderFireOverlay", at = @At("HEAD"), cancellable = true)
17+
private static void onRenderFireOverlay(
18+
MinecraftClient mc,
19+
MatrixStack matrixStack,
20+
CallbackInfo ci
21+
) {
22+
if (NoRender.INSTANCE.isEnabled() && NoRender.getNoBurning()) ci.cancel();
23+
}
24+
25+
@ModifyArg(method = "renderFireOverlay", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;translate(FFF)V"), index = 1)
26+
private static float onRenderFireOverlayTranslate(float x) {
27+
if (NoRender.INSTANCE.isEnabled()) {
28+
return (float) NoRender.getFireOverlayYOffset();
29+
} else {
30+
return -0.3f;
31+
}
32+
}
33+
34+
@Inject(method = "renderUnderwaterOverlay", at = @At("HEAD"), cancellable = true)
35+
private static void onRenderUnderwaterOverlay(
36+
MinecraftClient mc,
37+
MatrixStack matrixStack,
38+
CallbackInfo ci
39+
) {
40+
if (NoRender.INSTANCE.isEnabled() && NoRender.getNoUnderwater()) ci.cancel();
41+
}
42+
43+
@Inject(method = "renderInWallOverlay", at = @At("HEAD"), cancellable = true)
44+
private static void onRenderInWallOverlay(
45+
Sprite sprite,
46+
MatrixStack matrices,
47+
CallbackInfo ci
48+
) {
49+
if (NoRender.INSTANCE.isEnabled() && NoRender.getNoInWall()) ci.cancel();
50+
}
51+
}

common/src/main/java/com/lambda/mixin/render/LightmapTextureManagerMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
@Mixin(LightmapTextureManager.class)
1414
public class LightmapTextureManagerMixin {
1515
@ModifyArg(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/NativeImage;setColor(III)V"), index = 2)
16-
private int updateModify(int x) {
16+
private int updateModify(int color) {
1717
if (Fullbright.INSTANCE.isEnabled() || XRay.INSTANCE.isEnabled()) {
1818
return 0xFFFFFFFF;
1919
}
20-
return x;
20+
return color;
2121
}
2222

2323
@Inject(method = "getDarknessFactor(F)F", at = @At("HEAD"), cancellable = true)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.lambda.mixin.render;
2+
3+
import com.lambda.module.modules.render.XRay;
4+
import net.minecraft.block.BlockState;
5+
import net.minecraft.client.render.RenderLayer;
6+
import net.minecraft.client.render.RenderLayers;
7+
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.injection.At;
9+
import org.spongepowered.asm.mixin.injection.Inject;
10+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
11+
12+
@Mixin(RenderLayers.class)
13+
public class RenderLayersMixin {
14+
@Inject(method = "getBlockLayer", at = @At("HEAD"), cancellable = true)
15+
private static void onGetBlockLayer(BlockState state, CallbackInfoReturnable<RenderLayer> cir) {
16+
if (XRay.INSTANCE.isDisabled()) return;
17+
18+
if (!XRay.isSelected(state)) cir.setReturnValue(RenderLayer.getTranslucent());
19+
}
20+
}

common/src/main/kotlin/com/lambda/friend/FriendManager.kt renamed to common/src/main/kotlin/com/lambda/core/FriendManager.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
package com.lambda.friend
1+
package com.lambda.core
22

33
import com.lambda.config.Configurable
44
import com.lambda.config.configurations.FriendConfig
5-
import com.lambda.core.Loadable
65
import com.mojang.authlib.GameProfile
76
import net.minecraft.server.network.ServerPlayerEntity
87
import java.util.UUID

common/src/main/kotlin/com/lambda/core/Loader.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package com.lambda.core
33
import com.lambda.Lambda
44
import com.lambda.Lambda.LOG
55
import com.lambda.command.CommandManager
6-
import com.lambda.config.configurations.GuiConfig
7-
import com.lambda.friend.FriendManager
86
import com.lambda.graphics.renderer.gui.font.LambdaFont
97
import com.lambda.gui.GuiConfigurable
108
import com.lambda.interaction.PlayerPacketManager

common/src/main/kotlin/com/lambda/module/Module.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ abstract class Module(
101101
val customTags = setting("Tags", emptySet<ModuleTag>(), visibility = { false })
102102

103103
var isEnabled by isEnabledSetting
104+
val isDisabled get() = !isEnabled
104105
override val isMuted: Boolean
105106
get() = !isEnabled && !alwaysListening
106107
val keybind by keybindSetting
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.lambda.module.modules.render
2+
3+
import com.lambda.Lambda.mc
4+
import com.lambda.module.Module
5+
import com.lambda.module.tag.ModuleTag
6+
import net.minecraft.client.render.model.BakedModel
7+
8+
object BlockESP : Module(
9+
name = "BlockESP",
10+
description = "Render block ESP",
11+
defaultTags = setOf(ModuleTag.RENDER)
12+
) {
13+
@JvmStatic val barrier by setting("Solid Barrier Block", true, "Render barrier blocks")
14+
15+
// ToDo: I wanted to render this as a transparent / translucent block with a red tint.
16+
// Like the red stained glass block without the texture sprite.
17+
// Creating a custom baked model for this would be needed but seems really hard to do.
18+
// mc.blockRenderManager.getModel(Blocks.RED_STAINED_GLASS.defaultState)
19+
@JvmStatic val model: BakedModel get() = mc.bakedModelManager.missingModel
20+
21+
init {
22+
onToggle {
23+
mc.worldRenderer.reload()
24+
}
25+
}
26+
}

common/src/main/kotlin/com/lambda/module/modules/render/NoRender.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ object NoRender : Module(
99
defaultTags = setOf(ModuleTag.RENDER)
1010
) {
1111
@JvmStatic val noDarkness by setting("No Darkness", true)
12+
@JvmStatic val noBurning by setting("No Burning Overlay", true)
13+
@JvmStatic val fireOverlayYOffset by setting("Fire Overlay Y Offset", -0.3, -0.8..0.0, 0.1) { !noBurning }
14+
@JvmStatic val noUnderwater by setting("No Underwater Overlay", true)
15+
@JvmStatic val noInWall by setting("No In Wall Overlay", true)
1216
}

0 commit comments

Comments
 (0)