Search in sources :

Example 1 with Color

use of mathax.client.utils.render.color.Color in project Client by MatHax.

the class WorldRendererMixin method renderEntity.

@Inject(method = "renderEntity", at = @At("HEAD"))
private void renderEntity(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo info) {
    if (EntityShaders.shouldDrawOverlay(entity) && vertexConsumers != EntityShaders.overlayVertexConsumerProvider && vertexConsumers != EntityShaders.outlinesVertexConsumerProvider) {
        Framebuffer prevBuffer = this.entityOutlinesFramebuffer;
        this.entityOutlinesFramebuffer = EntityShaders.overlayFramebuffer;
        EntityShaders.overlayVertexConsumerProvider.setColor(0, 0, 0, 100);
        GlStateManager._disableDepthTest();
        renderEntity(entity, cameraX, cameraY, cameraZ, tickDelta, matrices, EntityShaders.overlayVertexConsumerProvider);
        GlStateManager._enableDepthTest();
        this.entityOutlinesFramebuffer = prevBuffer;
    }
    if (EntityShaders.shouldDrawOutline(entity) && vertexConsumers != EntityShaders.outlinesVertexConsumerProvider && vertexConsumers != EntityShaders.overlayVertexConsumerProvider) {
        Framebuffer prevBuffer = this.entityOutlinesFramebuffer;
        this.entityOutlinesFramebuffer = EntityShaders.outlinesFramebuffer;
        Utils.renderingEntityOutline = true;
        Color color = Modules.get().get(ESP.class).getOutlineColor(entity);
        EntityShaders.outlinesVertexConsumerProvider.setColor(color.r, color.g, color.b, color.a);
        GlStateManager._disableDepthTest();
        renderEntity(entity, cameraX, cameraY, cameraZ, tickDelta, matrices, EntityShaders.outlinesVertexConsumerProvider);
        GlStateManager._enableDepthTest();
        Utils.renderingEntityOutline = false;
        this.entityOutlinesFramebuffer = prevBuffer;
    }
}
Also used : Framebuffer(net.minecraft.client.gl.Framebuffer) Color(mathax.client.utils.render.color.Color)

Example 2 with Color

use of mathax.client.utils.render.color.Color in project Client by MatHax.

the class BetterTab method getPlayerName.

public Text getPlayerName(PlayerListEntry playerListEntry) {
    Text name;
    Color color = null;
    name = playerListEntry.getDisplayName();
    if (name == null) {
        /*if (mc.getSession().getUsername().equals("Matejko06"))
                name = new LiteralText("  " + playerListEntry.getProfile().getName());
            else*/
        name = new LiteralText(playerListEntry.getProfile().getName());
    }
    if (playerListEntry.getProfile().getId().toString().equals(mc.player.getGameProfile().getId().toString()) && self.get()) {
        color = selfColor.get();
    } else if (friends.get() && Friends.get().get(playerListEntry.getProfile().getName()) != null) {
        Friend friend = Friends.get().get(playerListEntry.getProfile().getName());
        if (friend != null)
            color = Friends.get().color;
    } else if (enemies.get() && Enemies.get().get(playerListEntry.getProfile().getName()) != null) {
        Enemy enemy = Enemies.get().get(playerListEntry.getProfile().getName());
        if (enemy != null)
            color = Enemies.get().color;
    }
    if (color != null) {
        String nameString = name.getString();
        for (Formatting format : Formatting.values()) {
            if (format.isColor())
                nameString = nameString.replace(format.toString(), "");
        }
        name = new LiteralText(nameString).setStyle(name.getStyle().withColor(new TextColor(color.getPacked())));
    }
    return name;
}
Also used : Friend(mathax.client.systems.friends.Friend) SettingColor(mathax.client.utils.render.color.SettingColor) TextColor(net.minecraft.text.TextColor) Color(mathax.client.utils.render.color.Color) Enemy(mathax.client.systems.enemies.Enemy) Formatting(net.minecraft.util.Formatting) LiteralText(net.minecraft.text.LiteralText) Text(net.minecraft.text.Text) TextColor(net.minecraft.text.TextColor) LiteralText(net.minecraft.text.LiteralText)

Example 3 with Color

use of mathax.client.utils.render.color.Color in project Client by MatHax.

the class TNTAura method onRender.

@EventHandler
private void onRender(Render3DEvent event) {
    if (obsidianRender.get() && !obsidianPos.isEmpty()) {
        for (BlockPos pos : obsidianPos) {
            boolean isFirst = pos.equals(obsidianPos.get(obsidianPos.size() - 1));
            Color side = isFirst ? obsidianNextSideColor.get() : obsidianSideColor.get();
            Color line = isFirst ? obsidianNextLineColor.get() : obsidianLineColor.get();
            event.renderer.box(pos, side, line, obsidianShapeMode.get(), 0);
        }
    }
    if (tntRender.get() && target != null && allowTNT(target)) {
        if (tntBlockstate(target.getBlockPos().add(0, 2, 0)))
            event.renderer.box(target.getBlockPos().add(0, 2, 0), tntSideColor.get(), tntLineColor.get(), tntShapeMode.get(), 0);
    }
    if (breakRender.get() && target != null && autoBreak.get()) {
        if (!mineBlockstate(target.getBlockPos().add(0, 2, 0)))
            event.renderer.box(target.getBlockPos().add(0, 2, 0), breakSideColor.get(), breakLineColor.get(), breakShapeMode.get(), 0);
    }
}
Also used : SettingColor(mathax.client.utils.render.color.SettingColor) Color(mathax.client.utils.render.color.Color) BlockPos(net.minecraft.util.math.BlockPos) EventHandler(mathax.client.eventbus.EventHandler)

Example 4 with Color

use of mathax.client.utils.render.color.Color in project Client by MatHax.

the class LightningEntityRendererMixin method onSetLightningVertex.

/**
 * @author Walaryne
 */
@Inject(method = "drawBranch", at = @At(value = "HEAD"), cancellable = true)
private static void onSetLightningVertex(Matrix4f matrix4f, VertexConsumer vertexConsumer, float f, float g, int i, float h, float j, float k, float l, float m, float n, float o, boolean bl, boolean bl2, boolean bl3, boolean bl4, CallbackInfo info) {
    Ambience ambience = Modules.get().get(Ambience.class);
    if (ambience.isActive() && ambience.changeLightningColor.get()) {
        Color color = ambience.lightningColor.get();
        vertexConsumer.vertex(matrix4f, f + (bl ? o : -o), (float) (i * 16), g + (bl2 ? o : -o)).color(color.r / 255f, color.g / 255f, color.b / 255f, 0.3F).next();
        vertexConsumer.vertex(matrix4f, h + (bl ? n : -n), (float) ((i + 1) * 16), j + (bl2 ? n : -n)).color(color.r / 255f, color.g / 255f, color.b / 255f, 0.3F).next();
        vertexConsumer.vertex(matrix4f, h + (bl3 ? n : -n), (float) ((i + 1) * 16), j + (bl4 ? n : -n)).color(color.r / 255f, color.g / 255f, color.b / 255f, 0.3F).next();
        vertexConsumer.vertex(matrix4f, f + (bl3 ? o : -o), (float) (i * 16), g + (bl4 ? o : -o)).color(color.r / 255f, color.g / 255f, color.b / 255f, 0.3F).next();
        info.cancel();
    }
}
Also used : Color(mathax.client.utils.render.color.Color) Ambience(mathax.client.systems.modules.world.Ambience) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 5 with Color

use of mathax.client.utils.render.color.Color in project Client by MatHax.

the class LivingEntityRendererMixin method modifyColor.

@ModifyArgs(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/EntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;IIFFFF)V"))
private void modifyColor(Args args, T livingEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) {
    Chams module = Modules.get().get(Chams.class);
    if (!module.isActive() || !module.players.get() || !(livingEntity instanceof PlayerEntity))
        return;
    if (module.ignoreSelf.get() && livingEntity == mc.player)
        return;
    Color color = PlayerUtils.getPlayerColor(((PlayerEntity) livingEntity), module.playersColor.get());
    args.set(4, color.r / 255f);
    args.set(5, color.g / 255f);
    args.set(6, color.b / 255f);
    args.set(7, module.playersColor.get().a / 255f);
}
Also used : Chams(mathax.client.systems.modules.render.Chams) Color(mathax.client.utils.render.color.Color) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ClientPlayerEntity(net.minecraft.client.network.ClientPlayerEntity)

Aggregations

Color (mathax.client.utils.render.color.Color)25 Chams (mathax.client.systems.modules.render.Chams)6 SettingColor (mathax.client.utils.render.color.SettingColor)6 Redirect (org.spongepowered.asm.mixin.injection.Redirect)5 TextColor (net.minecraft.text.TextColor)3 EventHandler (mathax.client.eventbus.EventHandler)2 Ambience (mathax.client.systems.modules.world.Ambience)2 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 Text (net.minecraft.text.Text)2 MatHaxGuiTheme (mathax.client.gui.themes.mathax.MatHaxGuiTheme)1 MeteorGuiTheme (mathax.client.gui.themes.meteor.MeteorGuiTheme)1 WTable (mathax.client.gui.widgets.containers.WTable)1 Enemy (mathax.client.systems.enemies.Enemy)1 Friend (mathax.client.systems.friends.Friend)1 Module (mathax.client.systems.modules.Module)1 ModuleColorMode (mathax.client.utils.render.ModuleColorMode)1 Framebuffer (net.minecraft.client.gl.Framebuffer)1 AbstractClientPlayerEntity (net.minecraft.client.network.AbstractClientPlayerEntity)1 ClientPlayerEntity (net.minecraft.client.network.ClientPlayerEntity)1 GameRenderer (net.minecraft.client.render.GameRenderer)1