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

This commit is contained in:
winterflyt committed 2026-11-30 05:57:15 +02:00
1 parent 237fe3da04
commit 5ddac858eb
5 files changed
+333

No files matched your search

@@ -0,0 +1,38 @@
package openonyx.features.render;
import openonyx.events.TargetType;
import openonyx.history.TabbedSettingGroup;
public final class BoxesPart extends TabbedSettingGroup {
public final BoxesPart2 enemy;
public final BoxesPart2 mobs;
public final BoxesPart2 team;
public final BoxesPart2 self = new BoxesPart2("Self", false, -2562832, true);
private BoxesPart() {
super("Targets", TargetType.e);
this.enemy = new BoxesPart2("Enemy", true, -3910337, true);
this.team = new BoxesPart2("Team", false, -8585312, false);
this.mobs = new BoxesPart2("Mobs", false, -3105793, false);
}
// $VF: Unable to simplify switch on enum
// Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
public BoxesPart2 L(TargetType targetType) {
switch (targetType) {
case SELF:
while (false) {
}
return this.self;
case ENEMY:
return this.enemy;
case TEAM:
return this.team;
case MOBS:
return this.mobs;
default:
throw new MatchException(null, null);
}
}
}
@@ -0,0 +1,16 @@
package openonyx.features.render;
import openonyx.history.SettingSection;
import openonyx.history.internal.ColorSetting;
public final class BoxesPart2 extends SettingSection {
public final ColorSetting color;
private BoxesPart2(String string, boolean bl, int i, boolean bl1) {
super(string, bl);
this.color = new ColorSetting("Color", i);
if (bl1) {
this.color.D();
}
}
}
@@ -0,0 +1,32 @@
package openonyx.features.render;
import openonyx.events.TargetType;
// $VF: synthetic class
class BoxesPart3 {
static {
int[] i = new int[TargetType.values().length];
boolean bl = true;
e = i;
try {
e[TargetType.SELF.ordinal()] = 1;
} catch (NoSuchFieldError noSuchFieldError3) {
}
try {
e[TargetType.ENEMY.ordinal()] = 2;
} catch (NoSuchFieldError noSuchFieldError2) {
}
try {
e[TargetType.TEAM.ordinal()] = 3;
} catch (NoSuchFieldError noSuchFieldError1) {
}
try {
e[TargetType.MOBS.ordinal()] = 4;
} catch (NoSuchFieldError noSuchFieldError) {
}
}
}
+233
View File
@@ -0,0 +1,233 @@
package openonyx.features.render;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.Entity;
import openonyx.configuration.internal.WorldChangeEvent;
import openonyx.features.Module;
import openonyx.features.ModuleCategory;
import openonyx.history.internal.NumberSetting;
import openonyx.render.CameraState;
import openonyx.render.MotionBlurShader;
public class Camera extends Module {
private boolean t;
private double b;
private static final double E = 6.0;
private double F;
private double G;
private float A;
private float K;
private boolean B;
private long C;
private float J;
private double D;
private double c;
public CameraPart cameraPart;
private long k;
private double g;
private float M;
private boolean L;
public CameraPart2 cameraPart2;
private double m;
private float h;
private double l;
private float I;
public NumberSetting distance;
private double i;
private static final double f = 8.0;
private long H;
public NumberSetting smoothing = new NumberSetting("Smoothing", 95.0, 0.0, 95.0, 5.0).withSuffix("%").describe("How far the camera lags behind you");
public double l() {
return this.l;
}
public float D() {
return this.K;
}
public double h() {
return this.G;
}
public void L(float f, float g) {
Camera camera1 = this;
long lx = System.nanoTime();
float hx = camera1.k == 0L ? 16.0F : Math.min((float)(lx - camera1.k) / 1000000.0F, 100.0F);
camera1.k = lx;
if (!camera1.B) {
camera1.B = true;
camera1.K = fx;
camera1.h = gx;
} else {
double d = camera1.L(hx);
camera1.K = camera1.K + L(fx - camera1.K) * (float)d;
camera1.h = camera1.h + (gx - camera1.h) * (float)d;
}
}
public float d() {
Camera camera1 = this;
if (camera1.isEnabled() && camera1.cameraPart.isEnabled()) {
float fx = camera1.cameraPart.amount.getFloat() / 100.0F;
if (camera1.cameraPart.onlyWhenMoving.isEnabled() && mc.thePlayer != null) {
double d = Math.sqrt(mc.thePlayer.motionX * mc.thePlayer.motionX + mc.thePlayer.motionZ * mc.thePlayer.motionZ);
return fx * (float)Math.min(1.0, d / 0.14);
} else {
return fx;
}
} else {
return 0.0F;
}
}
@EventHandler
private void onWorldChange(WorldChangeEvent worldChangeEvent) {
MotionBlurShader.d();
this.L = false;
this.t = false;
}
public void L(Entity entity) {
if (this.isEnabled() && this.cameraPart2.isEnabled() && entity != null) {
if (mc.gameSettings.thirdPersonView == 0 && !mc.gameSettings.debugCamEnable) {
float ix = entity.rotationYaw;
float fx = entity.rotationPitch;
long lx = System.nanoTime();
float gx = this.C == 0L ? 16.0F : Math.min((float)(lx - this.C) / 1000000.0F, 100.0F);
this.C = lx;
Camera camera1;
if (!this.L) {
this.L = true;
this.J = this.I = ix;
this.A = this.M = fx;
camera1 = this;
} else {
this.I = this.J;
this.M = this.A;
double d;
float hx = (d = this.cameraPart2.smoothing.getFloat() / 100.0 * 260.0) <= 0.0 ? 1.0F : (float)(1.0 - Math.exp(-gx / d));
this.J = this.J + L(ix - this.J) * hx;
if (this.cameraPart2.smoothPitch.isEnabled()) {
this.A = this.A + (fx - this.A) * hx;
camera1 = this;
} else {
this.A = fx;
camera1 = this;
}
}
CameraState.L(camera1.J, this.A, this.J, this.A);
} else {
this.L = false;
}
}
}
public void L(double d, double e, double f) {
Camera camera1 = this;
camera1.l = d;
camera1.g = e;
camera1.b = fx;
long lx = System.nanoTime();
float gx = camera1.H == 0L ? 16.0F : Math.min((float)(lx - camera1.H) / 1000000.0F, 100.0F);
camera1.H = lx;
double kx = d - camera1.F;
double hx = e - camera1.i;
double ix = fx - camera1.D;
boolean bl = kx * kx + hx * hx + ix * ix > 64.0;
camera1.F = d;
camera1.i = e;
camera1.D = fx;
if (camera1.t && !bl) {
double mx = camera1.L(gx);
camera1.c = camera1.c + (d - camera1.c) * mx;
camera1.m = camera1.m + (e - camera1.m) * mx;
camera1.G = camera1.G + (fx - camera1.G) * mx;
double n = d - camera1.c;
hx = e - camera1.m;
ix = fx - camera1.G;
double j;
if ((j = n * n + hx * hx + ix * ix) > 36.0) {
j = 6.0 / Math.sqrt(j);
camera1.c = d - n * j;
camera1.m = e - hx * j;
camera1.G = fx - ix * j;
}
} else {
camera1.t = true;
camera1.c = d;
camera1.m = e;
camera1.G = fx;
}
}
@Override
protected void onDisable() {
MotionBlurShader.d();
this.L = false;
this.C = 0L;
this.B = false;
this.k = 0L;
this.t = false;
this.H = 0L;
this.F = 0.0;
this.i = 0.0;
this.D = 0.0;
}
public double L(float f) {
Camera camera1 = this;
float gx;
if ((gx = camera1.smoothing.getFloat()) <= 0.0F) {
return 1.0;
}
double d = gx / 100.0 * 400.0;
return 1.0 - Math.exp(-fx / d);
}
public double I() {
return this.c;
}
public Camera() {
super("Camera", "Smooth trailing camera position and third-person orbit", ModuleCategory.RENDER);
this.distance = new NumberSetting("Distance", 50.0, 50.0, 160.0, 5.0).withSuffix("%").describe("Third-person camera distance");
this.cameraPart2 = new CameraPart2();
this.cameraPart = new CameraPart();
}
public double i() {
return this.distance.getFloat() / 100.0;
}
private static float L(float f) {
float gx = fx;
if ((fx = gx % 360.0F) >= 180.0F) {
fx -= 360.0F;
}
if (fx < -180.0F) {
fx += 360.0F;
}
return fx;
}
public double D() {
return this.b;
}
public float L() {
return this.h;
}
public double d() {
return this.m;
}
public double L() {
return this.g;
}
}
@@ -0,0 +1,14 @@
package openonyx.features.render;
import openonyx.history.SettingGroup;
import openonyx.history.internal.BooleanSetting;
import openonyx.history.internal.NumberSetting;
public final class CameraPart extends SettingGroup {
public NumberSetting amount = new NumberSetting("Amount", 45.0, 5.0, 90.0, 5.0).withSuffix("%").describe("How much of the previous frame is kept");
public BooleanSetting onlyWhenMoving = new BooleanSetting("Only when moving", true).describe("Fade the blur in with your speed");
private CameraPart() {
super("Motion blur", false);
}
}