Upload files to "src/openonyx/features/render"

This commit is contained in:
winterflyt committed 2026-11-30 05:56:56 +02:00
1 parent e0d7a7425d
commit e771e05f20
5 files changed
+482

No files matched your search

@@ -0,0 +1,6 @@
package openonyx.features.render;
import net.minecraft.util.BlockPos;
record BedESPData2(BlockPos pos, int color) {
}
@@ -0,0 +1,7 @@
package openonyx.features.render;
import java.util.List;
import net.minecraft.util.BlockPos;
public record BedESPData3(BlockPos bed, boolean own, List<BedESPData> entries, int total) {
}
@@ -0,0 +1,134 @@
package openonyx.features.render;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
import openonyx.core.MinecraftAccess;
import openonyx.render.Render2D;
import openonyx.render.RenderSupport_120;
import openonyx.render.WorldToScreen;
import openonyx.theme.Fonts;
import openonyx.theme.ThemeManager;
public final class BedESPOverlay implements MinecraftAccess {
private static final int k = 5;
private static final float g = 16.0F;
private static final float M = 0.45F;
private static final float L = 1.4F;
private static final float j = 12.0F;
private static final float m = 11.0F;
private static final float h = 4.0F;
private static final double l = 1.4;
private static final int I = -938339561;
private static final float d = 10.0F;
private static final float i = 1.0F;
private final BedESP bedESP;
private static final float H = 4.0F;
private static final float e = 30.0F;
private static String L(BedESPData bedESPData) {
return String.valueOf(bedESPData.count());
}
public BedESPOverlay(BedESP bedESP) {
this.bedESP = bedESPx;
}
private void L(Render2D render2D, BedESPData bedESPData, float f, float g) {
render2D.pushMatrix();
render2D.translate(4.0F, gx + 0.5F);
render2D.scaleAround(0.625F, 0.0F, 0.0F);
render2D.drawItem(bedESPData.icon(), 0.0F, 0.0F);
render2D.popMatrix();
render2D.drawTextRightVCentered(Fonts.FONT_STYLE8, L(bedESPData), f - 4.0F, gx + 5.5F, ThemeManager.getPalette().onSurface());
}
private double L(BlockPos blockPos) {
return mc.thePlayer.getDistanceSq(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5);
}
public void L(Render2D render2D, float f, float g) {
BedESPOverlay bedESPOverlay1 = this;
ArrayList arrayList;
if (!(arrayList = new ArrayList<>(bedESPOverlay1.bedESP.getBedESPData3s())).isEmpty()) {
RenderSupport_120.L(bedESPOverlay1.bedESP.tagBlur.isEnabled());
arrayList.sort(Comparator.comparingDouble(bedESPData3 -> -this.L(bedESPData3x.bed())));
Iterator iterator;
Iterator iterator1 = iterator = arrayList.iterator();
while (iterator1.hasNext()) {
BedESPData3 bedESPData3 = (BedESPData3)iterator.next();
double dx = bedESPOverlay1.L(bedESPData3.bed());
BlockPos blockPos = bedESPData3.bed();
float[] hx;
if ((hx = WorldToScreen.L(new Vec3(blockPos.getX() + 0.5, blockPos.getY() + 1.4, blockPos.getZ() + 0.5), f, gx)) == null) {
iterator1 = iterator;
} else {
bedESPOverlay1.L(render2D, bedESPData3, hx[0], hx[1], bedESPOverlay1.L(dx));
iterator1 = iterator;
}
}
}
}
public boolean L() {
return this.bedESP.isEnabled() && this.bedESP.defenseTags.isEnabled() && mc.thePlayer != null && mc.theWorld != null && WorldToScreen.L();
}
private float L(double d) {
BedESPOverlay bedESPOverlay1 = this;
float hx = (float)Math.sqrt(dx);
float gx = 12.0F / Math.max(1.0F, hx);
float f;
if ((f = bedESPOverlay1.bedESP.tagFalloff.getFloat()) != 1.0F) {
gx = (float)Math.pow(gx, f);
}
return bedESPOverlay1.bedESP.tagScale.getFloat() * Math.min(1.4F, Math.max(0.45F, gx));
}
private void L(Render2D render2D, BedESPData3 bedESPData3, float f, float g, float h) {
BedESPOverlay bedESPOverlay1 = this;
List list = bedESPData3.entries();
int ix = Math.min(5, list.size());
boolean bl = list.size() > ix;
int jx = ix + (bl ? 1 : 0);
float lx = 30.0F;
int kx;
for (int p = kx = 0; p < ix; p = kx) {
float q = render2D.getTextWidth(Fonts.FONT_STYLE8, L((BedESPData)list.get(kx)));
kx++;
lx = Math.max(lx, 22.0F + q);
}
float n = 8.0F + jx * 11.0F + Math.max(0, jx - 1) * 1.0F;
render2D.pushMatrix();
render2D.translate(f, gx);
render2D.scaleAround(hx, 0.0F, 0.0F);
render2D.translate(-lx / 2.0F, -n);
RenderSupport_120.L(render2D, 0.0F, 0.0F, lx, n, 8.0F, -938339561, bedESPOverlay1.bedESP.tagBlur.isEnabled());
f = 4.0F;
for (int o = mx = 0; o < ix; o = mx) {
bedESPOverlay1.L(render2D, (BedESPData)list.get(mx), lx, f);
mx++;
f += 12.0F;
}
if (bl) {
render2D.drawTextCenteredVCentered(
Fonts.FONT_STYLE8,
new StringBuilder().insert(0, "+").append(list.size() - ix).toString(),
lx / 2.0F,
f + 5.5F,
ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), 0.75F)
);
}
render2D.popMatrix();
}
}
@@ -0,0 +1,14 @@
package openonyx.features.render;
public enum BlockMode {
SMOOTH,
VANILLA;
private static BlockMode[] L() {
BlockMode[] blockModes = new BlockMode[2];
boolean bl = true;
blockModes[0] = VANILLA;
blockModes[1] = SMOOTH;
return blockModes;
}
}
@@ -0,0 +1,321 @@
package openonyx.features.render;
import java.util.Objects;
import net.minecraft.block.material.Material;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import openonyx.core.OnyxClient;
import openonyx.features.Module;
import openonyx.features.ModuleCategory;
import openonyx.features.combat.BedBreaker;
import openonyx.history.internal.BooleanSetting;
import openonyx.history.internal.ColorSetting;
import openonyx.history.internal.EnumSetting;
import openonyx.history.internal.NumberSetting;
import openonyx.render.group_a.BlockOverlayBox;
import openonyx.render.group_a.BlockOverlayStyle;
import openonyx.render.group_d.Animation;
import openonyx.render.group_d.Easings;
public final class BlockOverlay extends Module {
private static final float P = 70.0F;
public final BooleanSetting onlyOnBedBreak;
private static final float R = 60.0F;
public final NumberSetting fillOpacity;
private double t;
private float b;
public final BooleanSetting throughWalls;
private static final float F = 0.004F;
private BlockPos blockPos;
public final BooleanSetting hideVanillaOutline;
private final Animation animation;
public final NumberSetting padding;
private final Animation animation2;
private BlockPos blockPos2;
public final EnumSetting<ThemeMode> theme = new EnumSetting<>("Theme", ThemeMode.FILL)
.describe("Outline on its own, over a transparent fill, or over the block's own texture");
private final Animation animation3;
public final BlockOverlayPart3 blockOverlayPart3;
public final ColorSetting secondColor;
private final BlockOverlayBox blockOverlayBox;
private final Animation[] animations;
private boolean L;
private static final double j = 16.0;
public final NumberSetting lineWidth;
private double h;
private double l;
public final BlockOverlayPart blockOverlayPart;
public final BlockOverlayPart2 blockOverlayPart2;
public final NumberSetting outlineOpacity;
private long f;
private static final float H = 100.0F;
public final ColorSetting color = new ColorSetting("Color", -10178561).D().L();
private void d(float f) {
Animation[] animationsx = this.animations;
int jx = this.animations.length;
int i;
for (int k = i = 0; k < jx; k = i) {
animationsx[i++].update(fx);
}
this.animation3.update(fx);
this.animation.update(fx);
this.animation2.update(fx);
}
private void d(AxisAlignedBB axisAlignedBB) {
BlockOverlay blockOverlay1 = this;
float fx = blockOverlay1.blockOverlayPart2.move.getFloat();
blockOverlay1.animations[0].animateTo((float)(axisAlignedBB.minX - blockOverlay1.h), fx, Easings.EASING2);
blockOverlay1.animations[1].animateTo((float)(axisAlignedBB.minY - blockOverlay1.l), fx, Easings.EASING2);
blockOverlay1.animations[2].animateTo((float)(axisAlignedBB.minZ - blockOverlay1.t), fx, Easings.EASING2);
blockOverlay1.animations[3].animateTo((float)(axisAlignedBB.maxX - blockOverlay1.h), fx, Easings.EASING2);
blockOverlay1.animations[4].animateTo((float)(axisAlignedBB.maxY - blockOverlay1.l), fx, Easings.EASING2);
blockOverlay1.animations[5].animateTo((float)(axisAlignedBB.maxZ - blockOverlay1.t), fx, Easings.EASING2);
}
public void L(float f) {
BlockOverlay blockOverlay1 = this;
float g = blockOverlay1.d();
if (blockOverlay1.isEnabled() && mc.theWorld != null && mc.thePlayer != null) {
BlockOverlay blockOverlay2;
label27: {
BlockPos blockPosx;
AxisAlignedBB axisAlignedBB = (blockPosx = blockOverlay1.L(blockOverlay1.L(), g)) == null ? null : blockOverlay1.L(blockPosx);
if (axisAlignedBB == null) {
if (blockOverlay1.L) {
blockOverlay1.L = false;
blockOverlay1.animation3.animateTo(0.0F, blockOverlay1.blockOverlayPart2.fade.getFloat(), Easings.EASING);
blockOverlay1.animation
.animateTo(blockOverlay1.blockOverlayPart2.appearance.getValue().L(), blockOverlay1.blockOverlayPart2.fade.getFloat(), Easings.EASING);
blockOverlay1.animation2.set(0.0F);
blockOverlay2 = blockOverlay1;
break label27;
}
} else {
blockOverlay1.L(blockPosx, axisAlignedBB);
blockOverlay1.animation2.animateTo(blockOverlay1.L(), 70.0F, Easings.EASING8);
}
blockOverlay2 = blockOverlay1;
}
blockOverlay2.d(g);
float hx = blockOverlay1.animation3.getValue();
if (!blockOverlay1.L && hx <= 0.004F) {
blockOverlay1.blockPos2 = null;
} else {
blockOverlay1.blockOverlayBox.L(fx, blockOverlay1.blockPos2, blockOverlay1.L(), hx, blockOverlay1.animation2.getValue(), blockOverlay1.L());
}
} else {
blockOverlay1.h();
}
}
private void L(BlockPos blockPos, AxisAlignedBB axisAlignedBB) {
BlockOverlay blockOverlay1 = this;
boolean bl1 = blockOverlay1.blockPos2 == null;
boolean bl = !bl1 && blockPosx.distanceSq(blockOverlay1.blockPos2.getX(), blockOverlay1.blockPos2.getY(), blockOverlay1.blockPos2.getZ()) > 16.0;
if (!blockPosx.equals(blockOverlay1.blockPos2)) {
blockOverlay1.animation2.set(0.0F);
}
blockOverlay1.blockPos2 = blockPosx;
blockOverlay1.L = true;
boolean bl2;
if (!bl1 && !bl) {
blockOverlay1.d(axisAlignedBB);
bl2 = bl1;
} else {
blockOverlay1.h = axisAlignedBB.minX;
blockOverlay1.l = axisAlignedBB.minY;
blockOverlay1.t = axisAlignedBB.minZ;
blockOverlay1.L(axisAlignedBB);
bl2 = bl1;
}
if (bl2) {
blockOverlay1.animation3.set(0.0F);
blockOverlay1.animation.set(blockOverlay1.blockOverlayPart2.appearance.getValue().L());
}
blockOverlay1.animation3.animateTo(1.0F, blockOverlay1.blockOverlayPart2.appear.getFloat(), Easings.EASING7);
blockOverlay1.animation.animateTo(1.0F, blockOverlay1.blockOverlayPart2.appear.getFloat(), Easings.EASING7);
}
private BlockOverlayStyle L() {
BlockOverlay blockOverlay1 = this;
float fx = blockOverlay1.fillOpacity.getFloat() / 100.0F;
return new BlockOverlayStyle(
blockOverlay1.theme.getValue(),
blockOverlay1.color.getValue(),
blockOverlay1.secondColor.getOpaque(),
blockOverlay1.lineWidth.getFloat(),
blockOverlay1.outlineOpacity.getFloat() / 100.0F,
fx,
Math.clamp(fx * 3.0F, 0.0F, 1.6F),
blockOverlay1.blockOverlayPart.glintSpeed.getFloat(),
blockOverlay1.blockOverlayPart.glintScale.getFloat(),
blockOverlay1.blockOverlayPart.glintGlow.getFloat() / 100.0F,
blockOverlay1.blockOverlayPart3.isEnabled(),
blockOverlay1.blockOverlayPart3.mode.getValue(),
blockOverlay1.blockOverlayPart3.direction.is(DirectionMode.UP),
blockOverlay1.blockOverlayPart3.progressOpacity.getFloat() / 100.0F,
blockOverlay1.throughWalls.isEnabled()
);
}
public BlockOverlay() {
super("BlockOverlay", "Highlights the block you are looking at", ModuleCategory.RENDER);
this.secondColor = new ColorSetting("Second color", -7055617)
.D()
.L(48.0)
.describe("The other end of the glint's gradient")
.visibleWhen(this.theme, themeMode -> themeMode == ThemeMode.GLINT);
this.lineWidth = new NumberSetting("Line width", 1.5, 0.5, 5.0, 0.5).withSuffix(" px");
this.outlineOpacity = new NumberSetting("Outline opacity", 90.0, 5.0, 100.0, 5.0).withSuffix("%");
this.fillOpacity = new NumberSetting("Fill opacity", 22.0, 1.0, 80.0, 1.0)
.withSuffix("%")
.visibleWhen(this.theme, themeMode -> themeMode != ThemeMode.OUTLINE);
this.padding = new NumberSetting("Padding", 0.6, 0.0, 5.0, 0.1)
.withSuffix("%")
.describe("How far the box stands off the block face, as a fraction of a block");
this.blockOverlayPart = new BlockOverlayPart();
this.blockOverlayPart2 = new BlockOverlayPart2();
this.blockOverlayPart3 = new BlockOverlayPart3();
this.onlyOnBedBreak = new BooleanSetting("Only on bed break", false)
.describe("Hides the overlay unless BedBreaker is mining, so it marks the bed and nothing else");
this.throughWalls = new BooleanSetting("Through walls", true).describe("Draws the whole box and its progress even when the block is buried");
this.hideVanillaOutline = new BooleanSetting("Hide vanilla outline", true).describe("Suppresses the black wireframe this overlay is standing in for");
Animation[] animationsx = new Animation[6];
boolean bl = true;
animationsx[0] = new Animation(0.0F);
animationsx[1] = new Animation(0.0F);
animationsx[2] = new Animation(0.0F);
animationsx[3] = new Animation(0.0F);
animationsx[4] = new Animation(0.0F);
animationsx[5] = new Animation(0.0F);
this.animations = animationsx;
this.animation3 = new Animation(0.0F);
this.animation = new Animation(1.0F);
this.animation2 = new Animation(0.0F);
this.blockOverlayBox = new BlockOverlayBox();
this.blockOverlayPart.visibleWhen(() -> this.theme.is(ThemeMode.GLINT));
}
@Override
protected void onDisable() {
this.h();
this.blockOverlayBox.L();
}
private void h() {
BlockOverlay blockOverlay1 = this;
blockOverlay1.blockPos = blockOverlay1.blockPos2 = null;
blockOverlay1.b = 0.0F;
blockOverlay1.L = false;
blockOverlay1.f = 0L;
Animation[] animationsx = blockOverlay1.animations;
int i = blockOverlay1.animations.length;
for (int k = jx = 0; k < i; k = jx) {
animationsx[jx++].set(0.0F);
}
blockOverlay1.animation3.set(0.0F);
blockOverlay1.animation.set(1.0F);
blockOverlay1.animation2.set(0.0F);
}
private BlockPos L(BlockPos blockPos, float f) {
if (this.blockPos2 != null && !Objects.equals(blockPosx, this.blockPos2)) {
if (!Objects.equals(blockPosx, this.blockPos)) {
this.blockPos = blockPosx;
this.b = 0.0F;
}
this.b += fx;
return this.b >= 60.0F ? blockPosx : this.blockPos2;
} else {
this.blockPos = null;
this.b = 0.0F;
return blockPosx;
}
}
private float d() {
long lx = System.nanoTime();
if (this.f == 0L) {
this.f = lx;
return 0.0F;
} else {
float fx = (float)(lx - this.f) / 1000000.0F;
this.f = lx;
return Math.clamp(fx, 0.0F, 100.0F);
}
}
private AxisAlignedBB L() {
double d = this.h + this.animations[0].getValue();
double e = this.l + this.animations[1].getValue();
double fx = this.t + this.animations[2].getValue();
double g = this.h + this.animations[3].getValue();
double hx = this.l + this.animations[4].getValue();
double i = this.t + this.animations[5].getValue();
double jx = (d + g) / 2.0;
double k = (e + hx) / 2.0;
double lx = (fx + i) / 2.0;
double m = this.animation.getValue();
double n = this.padding.getValue() / 100.0;
return AxisAlignedBB.fromBounds(
jx + (d - jx) * m - n, k + (e - k) * m - n, lx + (fx - lx) * m - n, jx + (g - jx) * m + n, k + (hx - k) * m + n, lx + (i - lx) * m + n
);
}
private BlockPos L() {
BlockOverlay blockOverlay1 = this;
BedBreaker bedBreaker = OnyxClient.moduleManager == null ? null : OnyxClient.moduleManager.bedBreaker;
if (bedBreaker != null && bedBreaker.isEnabled() && bedBreaker.getBlockPos3() != null) {
return bedBreaker.getBlockPos3();
}
if (blockOverlay1.onlyOnBedBreak.isEnabled()) {
return null;
}
MovingObjectPosition movingObjectPosition = mc.objectMouseOver;
return mc.objectMouseOver != null && movingObjectPosition.typeOfHit == MovingObjectType.BLOCK ? movingObjectPosition.getBlockPos() : null;
}
private float L() {
BlockOverlay blockOverlay1 = this;
if (blockOverlay1.blockOverlayPart3.isEnabled() && mc.playerController != null) {
BedBreaker bedBreaker = OnyxClient.moduleManager == null ? null : OnyxClient.moduleManager.bedBreaker;
boolean bl = bedBreaker != null && bedBreaker.isEnabled() && bedBreaker.getBlockPos3() != null;
return !bl && !mc.playerController.isHittingBlock() ? 0.0F : Math.clamp(mc.playerController.getCurBlockDamage(), 0.0F, 1.0F);
} else {
return 0.0F;
}
}
public boolean I() {
return this.isEnabled() && this.hideVanillaOutline.isEnabled() && this.L() != null;
}
private AxisAlignedBB L(BlockPos blockPos) {
return mc.theWorld.getBlockState(blockPosx).getBlock().getMaterial() == Material.air ? null : BlockOverlayBox.L(blockPosx);
}
private void L(AxisAlignedBB axisAlignedBB) {
this.animations[0].set((float)(axisAlignedBB.minX - this.h));
this.animations[1].set((float)(axisAlignedBB.minY - this.l));
this.animations[2].set((float)(axisAlignedBB.minZ - this.t));
this.animations[3].set((float)(axisAlignedBB.maxX - this.h));
this.animations[4].set((float)(axisAlignedBB.maxY - this.l));
this.animations[5].set((float)(axisAlignedBB.maxZ - this.t));
}
}