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

This commit is contained in:
winterflyt committed 2026-11-30 05:58:34 +02:00
1 parent 68c33bf212
commit 923da9ce01
5 files changed
+535

No files matched your search

@@ -0,0 +1,36 @@
package openonyx.features.render;
import openonyx.events.TargetType;
import openonyx.history.TabbedSettingGroup;
public final class GlowESPPart3 extends TabbedSettingGroup {
public final GlowESPPart team;
public final GlowESPPart mobs;
public final GlowESPPart enemy;
public final GlowESPPart self = new GlowESPPart("Self", false, -2562832, false);
private GlowESPPart3() {
super("Targets", TargetType.e);
this.enemy = new GlowESPPart("Enemy", true, -8857601, false);
this.team = new GlowESPPart("Team", false, -8585312, false);
this.mobs = new GlowESPPart("Mobs", false, -3105793, false);
}
public GlowESPPart 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);
}
}
}
+330
View File
@@ -0,0 +1,330 @@
package openonyx.features.render;
import java.util.Locale;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import openonyx.core.OnyxClient;
import openonyx.features.Module;
import openonyx.features.ModuleCategory;
import openonyx.history.internal.NumberSetting;
import openonyx.render.HandMaskShader;
import openonyx.render.HandTransform;
public final class Hand extends Module {
private static final double D = 45.0;
private static final double c = -0.52;
public final SwingAnimation swingAnimation;
private static final double k = 0.4;
private static final float g = 0.5F;
private static final double M = -0.72;
private static final double L = 0.56;
public final HandEffects handEffects = new HandEffects();
private static final long m = 140000000L;
private static final long h = 300000000L;
private float l;
private final SwingTimer swingTimer;
private long d;
private static final long i = 260000000L;
private float f;
private static final float H = 0.25F;
public final HandPose mainHand = new HandPose("Main hand");
public boolean L(ItemStack itemStack, float f) {
if (!this.L(itemStack)) {
return false;
}
float gx;
Hand hand1;
if (HandMaskShader.L()) {
hand1 = this;
gx = this.f;
} else {
gx = Math.max(Math.clamp(fx, 0.0F, 1.0F), this.D());
hand1 = this;
this.f = gx;
}
hand1.D(gx);
return true;
}
private void i(float f) {
float gx = -0.4F * (float)Math.sin(Math.sqrt(fx) * Math.PI);
float hx = 0.2F * (float)Math.sin(Math.sqrt(fx) * Math.PI * 2.0);
float ix = -0.2F * (float)Math.sin(fx * Math.PI);
GlStateManager.translate(gx, hx, ix);
this.L(fx);
}
private boolean k() {
return this.isEnabled()
&& mc.thePlayer != null
&& mc.thePlayer.isBlocking()
&& mc.thePlayer.getHeldItem() != null
&& mc.thePlayer.getHeldItem().getItem() instanceof ItemSword;
}
public void h() {
Hand hand1 = this;
float fx = HandTransform.L();
GlStateManager.scale(hand1.mainHand.scaleX.getFloat() * fx, hand1.mainHand.scaleY.getFloat() * fx, hand1.mainHand.scaleZ.getFloat() * fx);
}
private float D() {
if (!mc.gameSettings.keyBindAttack.isKeyDown()) {
this.d = -1L;
return 0.0F;
}
if (this.d < 0L) {
this.d = System.nanoTime();
}
return (float)((System.nanoTime() - this.d) % 260000000L) / 2.6E8F;
}
public float getItemColorWeight() {
return this.handEffects.smokeEffect.itemColor.isEnabled() ? 0.0F : 1.0F;
}
private boolean F() {
Hand hand1 = this;
ItemStack itemStack;
return !hand1.swingAnimation.swordsOnly.isEnabled() ? true : (itemStack = mc.thePlayer.getHeldItem()) != null && itemStack.getItem() instanceof ItemSword;
}
private int getHeldItemColor() {
if (mc.thePlayer == null) {
return -1;
}
ItemStack itemStack;
if ((itemStack = mc.thePlayer.getHeldItem()) != null && itemStack.getItem() != null) {
String string;
if ((string = itemStack.getItem().getUnlocalizedName().toLowerCase(Locale.ROOT)).contains("diamond")) {
return -11149856;
} else if (string.contains("gold")) {
return -11174;
} else if (string.contains("iron")) {
return -2564376;
} else if (string.contains("emerald")) {
return -13250449;
} else if (string.contains("redstone")) {
return -1950917;
} else {
return !string.contains("lapis") && !string.contains("dyepowder") ? -1644826 : -13543724;
}
} else {
return -1;
}
}
private boolean l() {
return this.swingAnimation.isEnabled() && this.swingAnimation.replaceVanillaSwing.isEnabled() && this.F();
}
public int L() {
Hand hand1 = this;
SmokeEffect smokeEffect = hand1.handEffects.smokeEffect;
return hand1.handEffects.smokeEffect.itemColor.isEnabled() ? hand1.getHeldItemColor() : smokeEffect.color.getValue();
}
public float L() {
return 0.5F;
}
public SmokeEffect L() {
if (!this.isEnabled() || mc.thePlayer == null) {
return null;
} else {
return this.handEffects.isEnabled() && this.handEffects.effect.is(EffectMode.SMOKE) ? this.handEffects.smokeEffect : null;
}
}
public Hand() {
super("Hand", "Adjust the first-person hand and replace the sword swing", ModuleCategory.RENDER);
this.swingAnimation = new SwingAnimation();
this.swingTimer = new SwingTimer();
this.d = -1L;
this.swingAnimation.speed.onChange(double_ -> this.swingTimer.d());
}
private static NumberSetting L(String string, double d) {
return new NumberSetting(string, dx, -360.0, 360.0, 1.0).withSuffix("deg");
}
private static float L(float f, float g, float h) {
return fx + (gx - fx) * hx;
}
private static float applyCurve(CurveMode curveMode, float f) {
switch (curveMode) {
case SQRT:
while (false) {
}
return fx;
case EASE_OUT:
return fx * fx * (3.0F - 2.0F * fx);
case LINEAR:
return 1.0F - (1.0F - fx) * (1.0F - fx);
case SMOOTH:
return (float)Math.sin(fx * Math.PI / 2.0);
case SIN:
return (float)Math.sqrt(fx);
default:
throw new MatchException(null, null);
}
}
private static float L(float f, float g) {
return Math.max(0.01F, L(1.0F, fx, gx));
}
@Override
protected void onDisable() {
this.swingTimer.d();
}
private static void L(float f, float g, float h, float i) {
if (fx != 0.0F) {
GlStateManager.rotate(fx, gx, hx, ix);
}
}
private boolean h() {
return OnyxClient.moduleManager.killAura.isEnabled() && OnyxClient.moduleManager.killAura.getTarget() != null;
}
private void D(float f) {
float gx;
GlStateManager.translate(0.0F, (gx = -((float)Math.sin(Math.sqrt(fx) * Math.PI)) * 2.0F) / 10.0F + 0.1F, 0.0F);
L(gx * 10.0F, 0.0F, 1.0F, 0.0F);
L(250.0F, 0.2F, 1.0F, -0.6F);
L(-10.0F, 1.0F, 0.5F, 1.0F);
L(-gx * 20.0F, 1.0F, 0.5F, 1.0F);
}
private float L(float f) {
if (this.h()) {
long lx = SwingTimer.L(140000000L, this.swingAnimation.speed.getFloat());
return this.swingTimer.L(lx);
} else {
this.swingTimer.L();
return this.swingTimer.L(fx, SwingTimer.L(300000000L, this.swingAnimation.speed.getFloat()));
}
}
public boolean applySwing(float f) {
if (!this.isEnabled() || mc.thePlayer == null) {
return false;
}
if (this.I()) {
return true;
}
if (!this.swingAnimation.isEnabled()) {
this.swingTimer.d();
this.i(fx);
return true;
}
if (!this.F()) {
return false;
}
if (this.swingAnimation.matchVanilla.isEnabled()) {
this.i(fx);
return this.l();
}
float gx;
Hand hand1;
if (HandMaskShader.L()) {
gx = this.l;
hand1 = this;
} else {
float hx = this.swingAnimation.strength.getFloat() / 100.0F;
fx = this.L(Math.clamp(fx, 0.0F, 1.0F));
gx = (float)Math.sin(applyCurve(this.swingAnimation.curve.getValue(), fx) * Math.PI) * hx;
hand1 = this;
this.l = gx;
}
hand1.applySwingPose(gx);
return this.l();
}
private void applySwingPose(float f) {
GlStateManager.translate(
this.swingAnimation.positionX.getFloat() * fx, this.swingAnimation.positionY.getFloat() * fx, this.swingAnimation.positionZ.getFloat() * fx
);
L(this.swingAnimation.rotationX.getFloat() * fx, 1.0F, 0.0F, 0.0F);
L(this.swingAnimation.rotationY.getFloat() * fx, 0.0F, 1.0F, 0.0F);
L(this.swingAnimation.rotationZ.getFloat() * fx, 0.0F, 0.0F, 1.0F);
GlStateManager.scale(
L(this.swingAnimation.scaleX.getFloat(), fx), L(this.swingAnimation.scaleY.getFloat(), fx), L(this.swingAnimation.scaleZ.getFloat(), fx)
);
}
public GlintEffect L() {
if (!this.isEnabled() || mc.thePlayer == null) {
return null;
} else {
return this.handEffects.isEnabled() && this.handEffects.effect.is(EffectMode.GLINT) ? this.handEffects.glintEffect : null;
}
}
private void L(float f) {
float gx = (float)Math.sin(fx * fx * Math.PI);
fx = (float)Math.sin(Math.sqrt(fx) * Math.PI);
L(gx * -20.0F, 0.0F, 1.0F, 0.0F);
L(fx * -20.0F, 0.0F, 0.0F, 1.0F);
L(fx * -80.0F, 1.0F, 0.0F, 0.0F);
}
private boolean I() {
return this.k() && this.swingAnimation.isEnabled();
}
public boolean L(float f, float g) {
if (this.isEnabled() && mc.thePlayer != null) {
GlStateManager.translate(this.mainHand.positionX.getFloat(), this.mainHand.positionY.getFloat() - fx * 0.6F, this.mainHand.positionZ.getFloat());
HandTransform.D();
L(this.mainHand.numberSetting2.getFloat(), 1.0F, 0.0F, 0.0F);
L(this.mainHand.numberSetting.getFloat(), 0.0F, 1.0F, 0.0F);
L(this.mainHand.numberSetting3.getFloat(), 0.0F, 0.0F, 1.0F);
this.L(Math.clamp(gx, 0.0F, 1.0F));
this.h();
return true;
} else {
return false;
}
}
public boolean L(float f) {
Hand hand1 = this;
if (hand1.isEnabled() && mc.thePlayer != null) {
boolean bl = !hand1.I();
float gx = hand1.l() ? 0.0F : fx * 0.6F;
GlStateManager.translate(hand1.mainHand.positionX.getFloat(), hand1.mainHand.positionY.getFloat() - gx, hand1.mainHand.positionZ.getFloat());
HandTransform.D();
if (bl) {
L(hand1.mainHand.numberSetting2.getFloat(), 1.0F, 0.0F, 0.0F);
L(hand1.mainHand.numberSetting.getFloat(), 0.0F, 1.0F, 0.0F);
L(hand1.mainHand.numberSetting3.getFloat(), 0.0F, 0.0F, 1.0F);
}
return true;
} else {
return false;
}
}
public boolean L(ItemStack itemStack) {
return this.I() && itemStack != null && itemStack.getItem() instanceof ItemSword;
}
}
@@ -0,0 +1,15 @@
package openonyx.features.render;
import openonyx.history.SettingSection;
import openonyx.history.internal.EnumSetting;
public final class HandEffects extends SettingSection {
public final SmokeEffect smokeEffect;
public final EnumSetting<EffectMode> effect = new EnumSetting<>("Effect", EffectMode.GLINT);
public final GlintEffect glintEffect = new GlintEffect().visibleWhen(() -> this.effect.is(EffectMode.GLINT));
private HandEffects() {
super("Effects", false);
this.smokeEffect = new SmokeEffect().visibleWhen(() -> this.effect.is(EffectMode.SMOKE));
}
}
@@ -0,0 +1,39 @@
package openonyx.features.render;
import openonyx.history.SettingGroup;
import openonyx.history.internal.ActionSetting;
import openonyx.history.internal.NumberSetting;
public final class HandPose extends SettingGroup {
public final NumberSetting numberSetting;
public final ActionSetting resetToVanilla = new ActionSetting("Reset to vanilla", () -> {
this.positionX.setValue(0.56);
this.positionY.setValue(-0.52);
this.positionZ.setValue(-0.72);
this.scaleX.setValue(0.4);
this.scaleY.setValue(0.4);
this.scaleZ.setValue(0.4);
this.numberSetting2.setValue(0.0);
this.numberSetting.setValue(45.0);
this.numberSetting3.setValue(0.0);
}).describe("Restore the hand transform to Minecraft's own first-person placement");
public final NumberSetting positionX = new NumberSetting("Position X", 0.56, -2.0, 2.0, 0.01);
public final NumberSetting numberSetting2;
public final NumberSetting numberSetting3;
public final NumberSetting scaleY;
public final NumberSetting positionZ;
public final NumberSetting scaleZ;
public final NumberSetting scaleX;
public final NumberSetting positionY = new NumberSetting("Position Y", -0.52, -2.0, 2.0, 0.01);
private HandPose(String string) {
super(string);
this.positionZ = new NumberSetting("Position Z", -0.72, -2.0, 2.0, 0.01);
this.scaleX = new NumberSetting("Scale X", 0.4, 0.02, 3.0, 0.01);
this.scaleY = new NumberSetting("Scale Y", 0.4, 0.02, 3.0, 0.01);
this.scaleZ = new NumberSetting("Scale Z", 0.4, 0.02, 3.0, 0.01);
this.numberSetting2 = Hand.L("Rotation X", 0.0);
this.numberSetting = Hand.L("Rotation Y", 45.0);
this.numberSetting3 = Hand.L("Rotation Z", 0.0);
}
}
+115
View File
@@ -0,0 +1,115 @@
package openonyx.features.render;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.util.MathHelper;
import openonyx.configuration.internal.WorldChangeEvent;
import openonyx.features.Module;
import openonyx.features.ModuleCategory;
import openonyx.history.internal.BooleanSetting;
import openonyx.history.internal.ColorSetting;
import openonyx.history.internal.NumberSetting;
import openonyx.render.PostProcessor;
import openonyx.render.group_p.ShaderProgram;
import openonyx.theme.internal.ColorUtils;
public final class Hurtcam extends Module {
private long k;
public final NumberSetting intensity;
public final BooleanSetting scaleWithDamage;
public final NumberSetting duration;
private static final float j = 100.0F;
private float m;
public final ColorSetting color = new ColorSetting("Color", -49088).describe("Tint of the damage wash");
private int l;
private ShaderProgram shaderProgram;
private boolean d;
public final NumberSetting size;
private float f;
public final BooleanSetting directional;
private float e;
public Hurtcam() {
super("Hurtcam", "Soft red flash around the screen when you take damage", ModuleCategory.RENDER);
this.intensity = new NumberSetting("Intensity", 45.0, 5.0, 100.0, 5.0).withSuffix("%").describe("How strong the wash gets at full health loss");
this.size = new NumberSetting("Size", 55.0, 10.0, 100.0, 5.0).withSuffix("%").describe("How far in from the edge the wash reaches");
this.duration = new NumberSetting("Duration", 450.0, 100.0, 1500.0, 50.0).withSuffix("ms").describe("How long the wash takes to fade out");
this.scaleWithDamage = new BooleanSetting("Scale with damage", true).describe("Bigger hits flash brighter");
this.directional = new BooleanSetting("Directional", false).describe("Bias the wash towards where the hit came from");
}
private void F() {
this.e = this.f = 0.0F;
this.l = 0;
this.m = 0.0F;
this.k = 0L;
}
@Override
protected void onEnable() {
this.F();
}
@Override
protected void onDisable() {
this.F();
}
public void l() {
Hurtcam hurtcam1 = this;
if (hurtcam1.isEnabled() && mc.thePlayer != null) {
hurtcam1.h();
if (!(hurtcam1.f <= 0.002F)) {
if (PostProcessor.L()) {
if (!hurtcam1.d) {
hurtcam1.shaderProgram = ShaderProgram.load("onyx_hurt", "onyx_post", "onyx_hurt");
hurtcam1.d = true;
}
if (hurtcam1.shaderProgram != null && hurtcam1.shaderProgram.isLoaded()) {
int i = hurtcam1.color.getValue();
float fx = hurtcam1.f * (hurtcam1.intensity.getFloat() / 100.0F);
float g = hurtcam1.size.getFloat() / 100.0F;
boolean bl = hurtcam1.directional.isEnabled();
PostProcessor.L(hurtcam1.shaderProgram, shaderProgram -> {
shaderProgramx.setUniform3f("uTint", ColorUtils.red(i) / 255.0F, ColorUtils.green(i) / 255.0F, ColorUtils.blue(i) / 255.0F);
shaderProgramx.setUniform1f("uStrength", fx * (ColorUtils.alpha(i) / 255.0F));
shaderProgramx.setUniform1f("uReach", g);
shaderProgramx.setUniform1f("uBias", this.m);
shaderProgramx.setUniform1f("uDirectional", bl ? 1.0F : 0.0F);
});
}
}
}
}
}
private void h() {
Hurtcam hurtcam1 = this;
long lx = System.nanoTime();
float g = hurtcam1.k == 0L ? 16.0F : Math.min((float)(lx - hurtcam1.k) / 1000000.0F, 100.0F);
hurtcam1.k = lx;
int i = mc.thePlayer.hurtTime;
if (mc.thePlayer.hurtTime > hurtcam1.l) {
hurtcam1.e = 1.0F;
if (hurtcam1.scaleWithDamage.isEnabled()) {
float fx = Math.max(1.0F, mc.thePlayer.maxHurtTime);
hurtcam1.e = MathHelper.clamp_float(i / fx, 0.35F, 1.0F);
}
hurtcam1.f = Math.max(hurtcam1.f, hurtcam1.e);
hurtcam1.m = mc.thePlayer.attackedAtYaw;
}
hurtcam1.l = i;
float h = hurtcam1.duration.getFloat();
hurtcam1.f = hurtcam1.f - (h <= 0.0F ? hurtcam1.f : g / h * hurtcam1.e);
if (hurtcam1.f < 0.0F) {
hurtcam1.f = 0.0F;
}
}
@EventHandler
private void onWorldChange(WorldChangeEvent worldChangeEvent) {
this.F();
}
}