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

This commit is contained in:
winterflyt committed 2026-11-30 05:57:23 +02:00
1 parent 5ddac858eb
commit 15165f8ba3
5 files changed
+286

No files matched your search

@@ -0,0 +1,17 @@
package openonyx.features.render;
import openonyx.history.SettingGroup;
import openonyx.history.internal.BooleanSetting;
import openonyx.history.internal.NumberSetting;
public final class CameraPart2 extends SettingGroup {
public BooleanSetting smoothPitch;
public NumberSetting smoothing = new NumberSetting("Smoothing", 40.0, 5.0, 90.0, 5.0)
.withSuffix("%")
.describe("How far the first-person view lags your aim");
private CameraPart2() {
super("First person", false);
this.smoothPitch = new BooleanSetting("Smooth pitch", true).describe("Also ease vertical movement, not just turning");
}
}
@@ -0,0 +1,167 @@
package openonyx.features.render;
import java.awt.image.BufferedImage;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.util.ResourceLocation;
import openonyx.configuration.internal.PreTickEvent;
import openonyx.events.FileDialogUtils;
import openonyx.events.NotificationDispatcher;
import openonyx.features.Module;
import openonyx.features.ModuleCategory;
import openonyx.features.hud.group_d.NotificationLevel;
import openonyx.history.internal.ActionSetting;
import openonyx.history.internal.ColorSetting;
import openonyx.history.internal.EnumSetting;
import openonyx.history.internal.NumberSetting;
import openonyx.history.internal.TextSetting;
import openonyx.render.group_g.CapeTextureLoader;
import openonyx.render.group_g.FitMode;
import openonyx.ui.CapeEditor;
public final class CapeChanger extends Module {
private BufferedImage bufferedImage;
public NumberSetting offsetX;
public NumberSetting zoom;
private boolean M;
public TextSetting capeFile;
public ActionSetting browse;
private ResourceLocation resourceLocation;
private int h;
public ActionSetting apply;
public NumberSetting offsetY;
public ActionSetting edit;
public ColorSetting background;
public EnumSetting<FitMode> fit;
public EnumSetting<CapeChangerSourceMode> source = new EnumSetting<>("Source", CapeChangerSourceMode.ONYX_LOGO)
.describe("The built-in Onyx logo cape, or a PNG off your disk");
private String e;
public void d(boolean bl) {
if (this.M != bl) {
this.M = bl;
if (!bl) {
this.l();
}
}
}
@Override
protected void onEnable() {
this.e();
}
private void k() {
if (this.resourceLocation != null && mc.thePlayer != null) {
mc.thePlayer.setLocationOfCape(this.resourceLocation);
}
}
public BufferedImage getBufferedImage() {
return this.bufferedImage;
}
private void d(ResourceLocation resourceLocation) {
this.resourceLocation = resourceLocationx;
if (this.isEnabled()) {
this.k();
}
}
@Override
protected void onDisable() {
if (mc.thePlayer != null) {
mc.thePlayer.setLocationOfCape(null);
}
this.resourceLocation = null;
}
@EventHandler
public void onPreTick(PreTickEvent preTickEvent) {
this.k();
}
public CapeChanger() {
super("CapeChanger", "Overrides your own cape texture locally", ModuleCategory.RENDER);
this.capeFile = new TextSetting("Cape file", "")
.describe("Full path to a cape PNG - any resolution")
.visibleWhen(this.source, capeChangerSourceMode -> capeChangerSourceMode == CapeChangerSourceMode.LOCAL_FILE);
this.browse = new ActionSetting("Browse", () -> FileDialogUtils.d("Select a cape PNG", this.capeFile.getValue(), this.capeFile::setValue))
.withButtonLabel("Browse…")
.describe("Or paste the path into the field above")
.visibleWhen(() -> this.source.is(CapeChangerSourceMode.LOCAL_FILE));
this.apply = new ActionSetting("Apply", () -> {
if (this.source.is(CapeChangerSourceMode.ONYX_LOGO)) {
CapeTextureLoader.L(resourceLocation -> {
this.d(resourceLocationx);
NotificationDispatcher.d("CapeChanger", "Onyx cape applied", NotificationLevel.SUCCESS);
}, string -> NotificationDispatcher.d("CapeChanger", string, NotificationLevel.ERROR));
} else if (this.capeFile.getValue().isEmpty()) {
NotificationDispatcher.d("CapeChanger", "Pick a cape PNG first", NotificationLevel.WARNING);
} else if (this.bufferedImage != null && this.e.equals(this.capeFile.getValue())) {
this.l();
} else {
CapeTextureLoader.d(this.capeFile.getValue(), bufferedImage -> {
this.bufferedImage = bufferedImagex;
this.e = this.capeFile.getValue();
CapeTextureLoader.L(bufferedImagex);
this.l();
NotificationDispatcher.d("CapeChanger", "Cape applied", NotificationLevel.SUCCESS);
}, string -> NotificationDispatcher.d("CapeChanger", string, NotificationLevel.ERROR));
}
}).withButtonLabel("Apply cape").visibleWhen(() -> this.source.is(CapeChangerSourceMode.LOCAL_FILE));
this.fit = new EnumSetting<>("Fit", FitMode.AUTO)
.describe("Fit shows the whole picture on a background, Fill crops it to the cape, Texture takes the PNG as a finished cape sheet")
.visibleWhen(() -> this.source.is(CapeChangerSourceMode.LOCAL_FILE))
.onChange(fitMode -> this.l());
this.background = new ColorSetting("Background", -15329507)
.d()
.describe("What fills the cape where the picture does not reach")
.visibleWhen(() -> this.source.is(CapeChangerSourceMode.LOCAL_FILE) && !this.fit.is(FitMode.TEXTURE))
.onChange(integer -> this.l());
this.zoom = new NumberSetting("Zoom", 100.0, 10.0, 400.0, 5.0)
.withSuffix("%")
.visibleWhen(() -> this.source.is(CapeChangerSourceMode.LOCAL_FILE) && !this.fit.is(FitMode.TEXTURE))
.onChange(double_ -> this.l());
this.offsetX = new NumberSetting("Offset X", 0.0, -100.0, 100.0, 1.0)
.withSuffix("%")
.visibleWhen(() -> this.source.is(CapeChangerSourceMode.LOCAL_FILE) && !this.fit.is(FitMode.TEXTURE))
.onChange(double_ -> this.l());
this.offsetY = new NumberSetting("Offset Y", 0.0, -100.0, 100.0, 1.0)
.withSuffix("%")
.visibleWhen(() -> this.source.is(CapeChangerSourceMode.LOCAL_FILE) && !this.fit.is(FitMode.TEXTURE))
.onChange(double_ -> this.l());
this.edit = new ActionSetting("Edit", () -> mc.displayGuiScreen(new CapeEditor(mc.currentScreen)))
.withButtonLabel("Edit cape…")
.describe("Drag the picture around the cape and scroll to zoom")
.visibleWhen(() -> this.source.is(CapeChangerSourceMode.LOCAL_FILE) && !this.fit.is(FitMode.TEXTURE));
this.e = "";
this.source.onChange(capeChangerSourceMode -> {
if (this.isEnabled()) {
this.e();
}
});
}
public void l() {
CapeChanger capeChanger1 = this;
if (!capeChanger1.M) {
if (capeChanger1.isEnabled() && capeChanger1.source.is(CapeChangerSourceMode.LOCAL_FILE) && capeChanger1.bufferedImage != null) {
int i = ++capeChanger1.h;
CapeTextureLoader.L(
capeChanger1.bufferedImage,
capeChanger1.fit.getValue(),
capeChanger1.background.getValue(),
capeChanger1.zoom.getValue() / 100.0,
capeChanger1.offsetX.getValue() / 100.0,
capeChanger1.offsetY.getValue() / 100.0,
resourceLocation -> {
if (i == this.h) {
this.d(resourceLocationx);
}
}
);
}
}
}
}
@@ -0,0 +1,14 @@
package openonyx.features.render;
public enum CapeChangerSourceMode {
ONYX_LOGO,
LOCAL_FILE;
private static CapeChangerSourceMode[] L() {
CapeChangerSourceMode[] capeChangerSourceModes = new CapeChangerSourceMode[2];
boolean bl = true;
capeChangerSourceModes[0] = ONYX_LOGO;
capeChangerSourceModes[1] = LOCAL_FILE;
return capeChangerSourceModes;
}
}
+51
View File
@@ -0,0 +1,51 @@
package openonyx.features.render;
import net.minecraft.entity.EntityLivingBase;
import openonyx.events.TargetType;
import openonyx.features.Module;
import openonyx.features.ModuleCategory;
import openonyx.theme.internal.ColorUtils;
public class Chams extends Module {
public final ChamsPart3 chamsPart3 = new ChamsPart3();
public float d(TargetType targetType) {
ChamsPart chamsPart;
return (chamsPart = this.chamsPart3.L(targetType)).keepModel.isEnabled() ? chamsPart.modelOpacity.getFloat() / 100.0F : 0.0F;
}
public int L(TargetType targetType) {
ChamsPart chamsPart = this.chamsPart3.L(targetType);
int i = Math.round(Math.clamp(chamsPart.opacity.getFloat() / 100.0F, 0.05F, 1.0F) * 255.0F);
return ColorUtils.withAlpha(chamsPart.color.getOpaque(), i);
}
public float L(TargetType targetType) {
return this.chamsPart3.L(targetType).wallOpacity.getFloat() / 100.0F;
}
public ChamsPart L(TargetType targetType) {
return this.chamsPart3.L(targetType);
}
public boolean L(TargetType targetType) {
return this.chamsPart3.L(targetType).throughWalls.isEnabled();
}
public Chams() {
super("Chams", "Reskins entities with a graded color tint on the model itself", ModuleCategory.RENDER);
}
public TargetType L(EntityLivingBase entityLivingBase) {
if (!this.isEnabled()) {
return null;
} else {
TargetType targetType;
if ((targetType = TargetType.L(entityLivingBase)) == null) {
return null;
} else {
return this.chamsPart3.L(targetType).isEnabled() ? targetType : null;
}
}
}
}
@@ -0,0 +1,37 @@
package openonyx.features.render;
import openonyx.history.SettingSection;
import openonyx.history.internal.BooleanSetting;
import openonyx.history.internal.ColorSetting;
import openonyx.history.internal.NumberSetting;
public final class ChamsPart extends SettingSection {
public final ColorSetting color;
public final BooleanSetting keepModel;
public final NumberSetting opacity;
public final BooleanSetting throughWalls;
public final NumberSetting strength;
public final NumberSetting modelOpacity;
public final NumberSetting wallOpacity;
private ChamsPart(String string, boolean bl, int i, boolean bl1) {
super(string, bl);
this.color = new ColorSetting("Color", i);
if (bl1) {
this.color.D();
}
this.opacity = new NumberSetting("Opacity", 100.0, 5.0, 100.0, 5.0).withSuffix("%");
this.strength = new NumberSetting("Strength", 70.0, 0.0, 100.0, 5.0)
.withSuffix("%")
.describe("How far the skin is graded towards the tint - at 0% the skin is left exactly as the game drew it");
this.keepModel = new BooleanSetting("Keep model", false).describe("Leaves the untouched model visible under the shading");
this.modelOpacity = new NumberSetting("Model opacity", 50.0, 0.0, 100.0, 5.0).withSuffix("%").visibleWhen(this.keepModel::isEnabled);
this.throughWalls = new BooleanSetting("Through walls", false)
.describe("Draws a second pass that ignores depth, so the model stays readable behind blocks");
this.wallOpacity = new NumberSetting("Wall opacity", 40.0, 5.0, 100.0, 5.0)
.withSuffix("%")
.describe("How strong the occluded pass is against the visible one")
.visibleWhen(this.throughWalls::isEnabled);
}
}