Skip to content

Commit

Permalink
feat: block outline changer (#3910)
Browse files Browse the repository at this point in the history
  • Loading branch information
1zun4 committed Sep 9, 2024
1 parent 65d5a51 commit 4c45003
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;

import static org.lwjgl.opengl.GL11.*;

Expand Down Expand Up @@ -295,4 +296,40 @@ private float removeRainSplashing(float original) {

return original;
}

@ModifyArgs(
method = "drawBlockOutline",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/render/WorldRenderer;drawCuboidShapeOutline(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/util/shape/VoxelShape;DDDFFFF)V"
)
)
private void modifyBlockOutlineArgs(Args args) {
// args: MatrixStack matrices,
// VertexConsumer vertexConsumer,
// VoxelShape shape,
// double offsetX,
// double offsetY,
// double offsetZ,
// float red,
// float green,
// float blue,
// float alpha

if (!ModuleBlockOutline.INSTANCE.getEnabled()) {
return;
}

var color = ModuleBlockOutline.INSTANCE.getOutlineColor();
var red = color.getR() / 255f;
var green = color.getG() / 255f;
var blue = color.getB() / 255f;
var alpha = color.getA() / 255f;

args.set(6, red);
args.set(7, green);
args.set(8, blue);
args.set(9, alpha);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ object ModuleManager : Listenable, Iterable<Module> by modules {
ModuleAnimations,
ModuleAntiBlind,
ModuleBlockESP,
ModuleBlockOutline,
ModuleBreadcrumbs,
ModuleCameraClip,
ModuleClickGui,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2024 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.features.module.modules.render

import net.ccbluex.liquidbounce.features.module.Category
import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.render.engine.Color4b

/**
* Block Outline module
*
* Changes the way Minecraft highlights blocks.
*
* TODO: Implement Block Side Box and GUI Information Panel
*/
object ModuleBlockOutline : Module("BlockOutline", Category.RENDER, aliases = arrayOf("BlockOverlay")) {
val outlineColor by color("Outline", Color4b(68, 117, 255, 102))
}

0 comments on commit 4c45003

Please sign in to comment.