Search in sources :

Example 1 with QuadColor

use of org.bleachhack.util.render.color.QuadColor in project BleachHack by BleachDrinker420.

the class NewChunks method onWorldRender.

@BleachSubscribe
public void onWorldRender(EventWorldRender.Post event) {
    int renderY = mc.world.getBottomY() + getSetting(0).asSlider().getValueInt();
    int opacity = (int) (getSetting(2).asToggle().getChild(0).asSlider().getValueFloat() * 255);
    if (getSetting(3).asToggle().getState()) {
        int[] color = getSetting(3).asToggle().getChild(0).asColor().getRGBArray();
        QuadColor outlineColor = QuadColor.single(color[0], color[1], color[2], 255);
        QuadColor fillColor = QuadColor.single(color[0], color[1], color[2], opacity);
        synchronized (newChunks) {
            for (ChunkPos c : newChunks) {
                if (mc.getCameraEntity().getBlockPos().isWithinDistance(c.getStartPos(), 1024)) {
                    Box box = new Box(c.getStartX(), renderY, c.getStartZ(), c.getStartX() + 16, renderY, c.getStartZ() + 16);
                    if (getSetting(2).asToggle().getState()) {
                        Renderer.drawBoxFill(box, fillColor, SKIP_DIRS);
                    }
                    Renderer.drawBoxOutline(box, outlineColor, 2f, SKIP_DIRS);
                }
            }
        }
    }
    if (getSetting(4).asToggle().getState()) {
        int[] color = getSetting(4).asToggle().getChild(0).asColor().getRGBArray();
        QuadColor outlineColor = QuadColor.single(color[0], color[1], color[2], 255);
        QuadColor fillColor = QuadColor.single(color[0], color[1], color[2], opacity);
        synchronized (oldChunks) {
            for (ChunkPos c : oldChunks) {
                if (mc.getCameraEntity().getBlockPos().isWithinDistance(c.getStartPos(), 1024)) {
                    Box box = new Box(c.getStartX(), renderY, c.getStartZ(), c.getStartX() + 16, renderY, c.getStartZ() + 16);
                    if (getSetting(2).asToggle().getState()) {
                        Renderer.drawBoxFill(box, fillColor, SKIP_DIRS);
                    }
                    Renderer.drawBoxOutline(box, outlineColor, 2f, SKIP_DIRS);
                }
            }
        }
    }
}
Also used : QuadColor(org.bleachhack.util.render.color.QuadColor) ChunkPos(net.minecraft.util.math.ChunkPos) Box(net.minecraft.util.math.Box) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Example 2 with QuadColor

use of org.bleachhack.util.render.color.QuadColor in project BleachHack by BleachDrinker420.

the class Renderer method drawBoxBoth.

public static void drawBoxBoth(Box box, QuadColor color, float lineWidth, Direction... excludeDirs) {
    QuadColor outlineColor = color.clone();
    outlineColor.overwriteAlpha(255);
    drawBoxBoth(box, color, outlineColor, lineWidth, excludeDirs);
}
Also used : QuadColor(org.bleachhack.util.render.color.QuadColor)

Example 3 with QuadColor

use of org.bleachhack.util.render.color.QuadColor in project BleachHack by BleachDrinker420.

the class LiquidFiller method onWorldRender.

@BleachSubscribe
public void onWorldRender(EventWorldRender.Post event) {
    if (getSetting(7).asToggle().getState()) {
        int opacity = (int) (getSetting(7).asToggle().getChild(0).asSlider().getValue() * 255);
        QuadColor waterColor = QuadColor.single((opacity << 24) | getSetting(7).asToggle().getChild(1).asColor().getRGB());
        QuadColor lavaColor = QuadColor.single((opacity << 24) | getSetting(7).asToggle().getChild(2).asColor().getRGB());
        int ceilRange = (int) Math.ceil(getSetting(1).asSlider().getValue());
        for (BlockPos pos : BlockPos.iterateOutwards(mc.player.getBlockPos().up(), ceilRange, ceilRange, ceilRange)) {
            FluidState fluid = mc.world.getFluidState(pos);
            if (fluid.getFluid() instanceof WaterFluid.Still && getSetting(0).asMode().getMode() != 0) {
                Renderer.drawBoxBoth(fluid.getShape(mc.world, pos).getBoundingBox().offset(pos), waterColor, 3f);
            } else if (fluid.getFluid() instanceof LavaFluid.Still && getSetting(0).asMode().getMode() != 1) {
                Renderer.drawBoxBoth(fluid.getShape(mc.world, pos).getBoundingBox().offset(pos), lavaColor, 3f);
            }
        }
    }
}
Also used : WaterFluid(net.minecraft.fluid.WaterFluid) QuadColor(org.bleachhack.util.render.color.QuadColor) BlockPos(net.minecraft.util.math.BlockPos) FluidState(net.minecraft.fluid.FluidState) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Aggregations

QuadColor (org.bleachhack.util.render.color.QuadColor)3 BleachSubscribe (org.bleachhack.eventbus.BleachSubscribe)2 FluidState (net.minecraft.fluid.FluidState)1 WaterFluid (net.minecraft.fluid.WaterFluid)1 BlockPos (net.minecraft.util.math.BlockPos)1 Box (net.minecraft.util.math.Box)1 ChunkPos (net.minecraft.util.math.ChunkPos)1