From 6c484907fe879ad4a70f88315b0c766410c6af6f Mon Sep 17 00:00:00 2001 From: winterflyt <36+winterflyt@noreply.skidsolutions.xyz> Date: Mon, 30 Nov 2026 06:12:57 +0200 Subject: [PATCH] Upload files to "src/openonyx/render/internal" --- .../render/internal/RenderSupport_174.java | 82 +++++ .../render/internal/WingInstance.java | 36 +++ src/openonyx/render/internal/WingPoint.java | 4 + .../render/internal/WingsRenderer.java | 296 ++++++++++++++++++ .../internal/WingsRendererListener.java | 7 + 5 files changed, 425 insertions(+) create mode 100644 src/openonyx/render/internal/RenderSupport_174.java create mode 100644 src/openonyx/render/internal/WingInstance.java create mode 100644 src/openonyx/render/internal/WingPoint.java create mode 100644 src/openonyx/render/internal/WingsRenderer.java create mode 100644 src/openonyx/render/internal/WingsRendererListener.java diff --git a/src/openonyx/render/internal/RenderSupport_174.java b/src/openonyx/render/internal/RenderSupport_174.java new file mode 100644 index 0000000..c45b931 --- /dev/null +++ b/src/openonyx/render/internal/RenderSupport_174.java @@ -0,0 +1,82 @@ +package openonyx.render.internal; + +public record RenderSupport_174( + float preTranslateY, + float preTranslateZ, + float anchorY, + float anchorZ, + float pitchRotation, + float yawRotation, + float rollRotation, + float openMultiplier, + float scaleMultiplier, + float motionSpreadBoost, + float flapAmplitude, + float sideOffset, + float sideZOffset, + float sideRoll, + float sidePitch, + float flapSpeed +) { + private static float L(float f, float g, float h) { + return g + (h - g) * f; + } + + public static String decrypt(String string) { + String string1 = string; + int k = (--3 ^ 5) << 4; + String string2; + int n = (string2 = string1).length(); + char[] e = new char[n]; + boolean bl = true; + int i; + int m = i = n - 1; + char[] c = e; + byte d = 12; + k = m; + byte b = 41; + + while (k >= 0) { + int l = i; + int j = string2.charAt(i); + i--; + c[l] = (char)(j ^ b); + if (i < 0) { + break; + } + + j = i--; + c[j] = (char)(string2.charAt(j) ^ d); + k = i; + } + + return new String(c); + } + + public static RenderSupport_174 L(RenderSupport_174 renderSupport_174, RenderSupport_174 renderSupport_1741, float f) { + if (f <= 0.0F) { + return renderSupport_174; + } else { + return f >= 1.0F + ? renderSupport_1741 + : new RenderSupport_174( + L(f, renderSupport_174.preTranslateY, renderSupport_1741.preTranslateY), + L(f, renderSupport_174.preTranslateZ, renderSupport_1741.preTranslateZ), + L(f, renderSupport_174.anchorY, renderSupport_1741.anchorY), + L(f, renderSupport_174.anchorZ, renderSupport_1741.anchorZ), + L(f, renderSupport_174.pitchRotation, renderSupport_1741.pitchRotation), + L(f, renderSupport_174.yawRotation, renderSupport_1741.yawRotation), + L(f, renderSupport_174.rollRotation, renderSupport_1741.rollRotation), + L(f, renderSupport_174.openMultiplier, renderSupport_1741.openMultiplier), + L(f, renderSupport_174.scaleMultiplier, renderSupport_1741.scaleMultiplier), + L(f, renderSupport_174.motionSpreadBoost, renderSupport_1741.motionSpreadBoost), + L(f, renderSupport_174.flapAmplitude, renderSupport_1741.flapAmplitude), + L(f, renderSupport_174.sideOffset, renderSupport_1741.sideOffset), + L(f, renderSupport_174.sideZOffset, renderSupport_1741.sideZOffset), + L(f, renderSupport_174.sideRoll, renderSupport_1741.sideRoll), + L(f, renderSupport_174.sidePitch, renderSupport_1741.sidePitch), + L(f, renderSupport_174.flapSpeed, renderSupport_1741.flapSpeed) + ); + } + } +} diff --git a/src/openonyx/render/internal/WingInstance.java b/src/openonyx/render/internal/WingInstance.java new file mode 100644 index 0000000..0179c61 --- /dev/null +++ b/src/openonyx/render/internal/WingInstance.java @@ -0,0 +1,36 @@ +package openonyx.render.internal; + +import net.minecraft.util.Vec3; + +public record WingInstance(Vec3 position, float bodyYaw, float open, WingStyle shape, RenderSupport_174 pose) { + public static String decrypt(String string) { + String string1 = string; + int k = --4 << --4; + String string2; + int n = (string2 = string1).length(); + char[] e = new char[n]; + boolean bl = true; + int i; + int m = i = n - 1; + char[] c = e; + byte d = 12; + k = m; + byte b = 103; + + while (k >= 0) { + int l = i; + int j = string2.charAt(i); + i--; + c[l] = (char)(j ^ b); + if (i < 0) { + break; + } + + j = i--; + c[j] = (char)(string2.charAt(j) ^ d); + k = i; + } + + return new String(c); + } +} diff --git a/src/openonyx/render/internal/WingPoint.java b/src/openonyx/render/internal/WingPoint.java new file mode 100644 index 0000000..097e9f2 --- /dev/null +++ b/src/openonyx/render/internal/WingPoint.java @@ -0,0 +1,4 @@ +package openonyx.render.internal; + +public record WingPoint(float x, float y, float alphaMul) { +} diff --git a/src/openonyx/render/internal/WingsRenderer.java b/src/openonyx/render/internal/WingsRenderer.java new file mode 100644 index 0000000..39cb177 --- /dev/null +++ b/src/openonyx/render/internal/WingsRenderer.java @@ -0,0 +1,296 @@ +package openonyx.render.internal; + +import java.util.Iterator; +import java.util.List; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.util.Vec3; +import openonyx.core.MinecraftAccess; +import openonyx.core.OnyxClient; +import openonyx.render.group_p.ShaderProgram; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.vector.Matrix4f; +import org.lwjgl.util.vector.Vector3f; +import org.lwjgl.util.vector.Vector4f; + +public final class WingsRenderer implements AutoCloseable, MinecraftAccess { + private static final float m = 0.84F; + private static final float h = 1.22F; + private ShaderProgram shaderProgram; + private static final float I = 1.0F; + public static final int d = 220; + private static final float i = 0.96F; + private boolean f; + private boolean H; + private static final long e = 180000000000L; + + private void L(List list, WingsStyle wingsStyle, Vec3 vec3, int i, int j) { + int k = d(ix, j); + ix = d(ix, (int)(j * 0.45F)); + boolean bl = wingsStyle.shaderFill() && this.L(); + Tessellator tessellator; + WorldRenderer worldRenderer = (tessellator = Tessellator.getInstance()).getWorldRenderer(); + worldRenderer.begin(4, DefaultVertexFormats.POSITION_COLOR); + L(list, wingsStyle, vec3, (wingInstance, matrix4f, f) -> L(worldRenderer, matrix4f, fx, 1.0F, wingInstance.shape().getWingPoints(), k, ix)); + tessellator.draw(); + if (bl) { + ShaderProgram.unbind(); + } + } + + private static int L(int i, int j, float f) { + int k = L(ix, 24) + (int)((L(j, 24) - L(ix, 24)) * fx); + int l = L(ix, 16) + (int)((L(j, 16) - L(ix, 16)) * fx); + int mx = L(ix, 8) + (int)((L(j, 8) - L(ix, 8)) * fx); + j = L(ix, 0) + (int)((L(j, 0) - L(ix, 0)) * fx); + return k << 24 | l << 16 | mx << 8 | j; + } + + private void d(List list, WingsStyle wingsStyle, Vec3 vec3, int i, int j, int k) { + int l = d(ix, (int)(k * 0.22F)); + ix = d(ix, 0); + k = d(j, (int)(k * 0.26F)); + j = d(j, 0); + Tessellator tessellator; + WorldRenderer worldRenderer = (tessellator = Tessellator.getInstance()).getWorldRenderer(); + worldRenderer.begin(4, DefaultVertexFormats.POSITION_COLOR); + L(list, wingsStyle, vec3, (wingInstance, matrix4f, f) -> { + WingPoint[] wingPoints = wingInstance.shape().getWingPoints(); + L(worldRenderer, matrix4f, fx, 1.22F, wingPoints, l, ix); + L(worldRenderer, matrix4f, fx, 0.84F, wingPoints, k, j); + }); + tessellator.draw(); + } + + @Override + public void close() { + this.H = true; + this.f = false; + this.shaderProgram = null; + } + + private static int d(int i, int j) { + return Math.clamp(j, 0, 255) << 24 | ix & 16777215; + } + + private static int L(int i, float f) { + return d(ix, Math.clamp((int)(L(ix) * fx), 0, 255)); + } + + private void L(List list, WingsStyle wingsStyle, Vec3 vec3, int i, int j, int k) { + ix = d(ix, (int)Math.min(255.0F, k * 0.95F)); + j = d(j, (int)(k * 0.2F)); + k = d(j, Math.max(Math.round(8.0F * wingsStyle.opacity()), (int)(L(j) * 0.75F))); + Tessellator tessellator; + WorldRenderer worldRenderer = (tessellator = Tessellator.getInstance()).getWorldRenderer(); + GL11.glLineWidth(2.2F); + worldRenderer.begin(1, DefaultVertexFormats.POSITION_COLOR); + L(list, wingsStyle, vec3, (wingInstance, matrix4f, f) -> { + WingStyle wingStyle; + WingPoint[] wingPoints = (wingStyle = wingInstance.shape()).getWingPoints(); + + int o; + for (int t = o = 0; t < wingPoints.length; t = o) { + WingPoint wingPoint = wingPoints[o]; + WingPoint wingPoint1 = wingPoints[(o + 1) % wingPoints.length]; + L(worldRenderer, matrix4f, fx * wingPoint.x() * 1.0F, wingPoint.y() * 1.0F, ix); + float g = fx * wingPoint1.x() * 1.0F; + float hx = wingPoint1.y(); + o++; + L(worldRenderer, matrix4f, g, hx * 1.0F, ix); + } + + int[] p; + int q = (p = wingStyle.L()).length; + + int r; + for (int s = r = 0; s < q; s = ++r) { + if ((ix = p[r]) < wingPoints.length) { + WingPoint wingPoint2 = wingPoints[ix]; + L(worldRenderer, matrix4f, 0.0F, 0.0F, k); + L(worldRenderer, matrix4f, fx * wingPoint2.x() * 0.96F, wingPoint2.y() * 0.96F, L(j, wingPoint2.alphaMul())); + } + } + }); + tessellator.draw(); + GL11.glLineWidth(1.0F); + } + + private static void L(boolean bl) { + GlStateManager.pushMatrix(); + GlStateManager.disableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.disableCull(); + GlStateManager.depthMask(false); + GlStateManager.shadeModel(7425); + if (bl) { + GlStateManager.disableDepth(); + } + + GL11.glEnable(2848); + GL11.glHint(3154, 4354); + } + + public WingsRenderer() { + int ix = 3 & 5; + super(); + this.H = (boolean)ix; + } + + private static Matrix4f L(Matrix4f matrix4f, WingInstance wingInstance, float f) { + Matrix4f matrix4f1 = matrix4f; + RenderSupport_174 renderSupport_174 = wingInstance.pose(); + matrix4f = new Matrix4f(matrix4f1); + matrix4f.translate(new Vector3f(fx * renderSupport_174.sideOffset(), 0.0F, renderSupport_174.sideZOffset())); + matrix4f.rotate((float)Math.toRadians(fx * wingInstance.open()), new Vector3f(0.0F, 1.0F, 0.0F)); + matrix4f.rotate((float)Math.toRadians(fx * renderSupport_174.sideRoll()), new Vector3f(0.0F, 0.0F, 1.0F)); + matrix4f.rotate((float)Math.toRadians(renderSupport_174.sidePitch()), new Vector3f(1.0F, 0.0F, 0.0F)); + return matrix4f; + } + + private static void L(WorldRenderer worldRenderer, Matrix4f matrix4f, float f, float g, WingPoint[] wingPoints, int i, int j) { + WorldRenderer worldRenderer1 = worldRenderer; + + int k; + for (int l = k = 0; l < wingPoints.length; l = k) { + WingPoint wingPoint = wingPoints[k]; + WingPoint wingPoint1 = wingPoints[(k + 1) % wingPoints.length]; + L(worldRenderer1, matrix4f, 0.0F, 0.0F, ix); + L(worldRenderer1, matrix4f, fx * wingPoint.x() * g, wingPoint.y() * g, L(j, wingPoint.alphaMul())); + float hx = fx * wingPoint1.x() * g; + float mx = wingPoint1.y() * g; + k++; + L(worldRenderer1, matrix4f, hx, mx, L(j, wingPoint1.alphaMul())); + } + } + + private static Matrix4f L(WingInstance wingInstance, WingsStyle wingsStyle, Vec3 vec3) { + WingInstance wingInstance1 = wingInstance; + RenderSupport_174 renderSupport_174 = wingInstance1.pose(); + Matrix4f matrix4f = new Matrix4f(); + matrix4f.translate( + new Vector3f( + (float)(wingInstance1.position().xCoord - vec3.xCoord), + (float)(wingInstance1.position().yCoord - vec3.yCoord), + (float)(wingInstance1.position().zCoord - vec3.zCoord) + ) + ); + matrix4f.rotate((float)Math.toRadians(180.0F - wingInstance1.bodyYaw()), new Vector3f(0.0F, 1.0F, 0.0F)); + if (renderSupport_174.preTranslateY() != 0.0F || renderSupport_174.preTranslateZ() != 0.0F) { + matrix4f.translate(new Vector3f(0.0F, renderSupport_174.preTranslateY(), renderSupport_174.preTranslateZ())); + } + + if (renderSupport_174.pitchRotation() != 0.0F) { + matrix4f.rotate((float)Math.toRadians(renderSupport_174.pitchRotation()), new Vector3f(1.0F, 0.0F, 0.0F)); + } + + if (renderSupport_174.yawRotation() != 0.0F) { + matrix4f.rotate((float)Math.toRadians(renderSupport_174.yawRotation()), new Vector3f(0.0F, 1.0F, 0.0F)); + } + + if (renderSupport_174.rollRotation() != 0.0F) { + matrix4f.rotate((float)Math.toRadians(renderSupport_174.rollRotation()), new Vector3f(0.0F, 0.0F, 1.0F)); + } + + matrix4f.translate(new Vector3f(0.0F, renderSupport_174.anchorY() + wingsStyle.heightOffset(), renderSupport_174.anchorZ() + wingsStyle.depthOffset())); + float fx = wingsStyle.scale() * renderSupport_174.scaleMultiplier(); + matrix4f.scale(new Vector3f(fx, fx, fx)); + return matrix4f; + } + + private static void L(List list, WingsStyle wingsStyle, Vec3 vec3, WingsRendererListener wingsRendererListener) { + List list1 = list; + Iterator iterator; + Iterator iterator1 = iterator = list1.iterator(); + + while (iterator1.hasNext()) { + WingInstance wingInstance; + Matrix4f matrix4f = L(wingInstance = (WingInstance)iterator.next(), wingsStyle, vec3); + iterator1 = iterator; + wingsRendererListener.L(wingInstance, L(matrix4f, wingInstance, -1.0F), -1.0F); + wingsRendererListener.L(wingInstance, L(matrix4f, wingInstance, 1.0F), 1.0F); + } + } + + public void L(float f, List list, WingsStyle wingsStyle) { + WingsRenderer wingsRenderer1 = this; + if (wingsRenderer1.H && !list.isEmpty()) { + Entity entity; + if ((entity = mc.getRenderViewEntity()) != null) { + Vec3 vec3 = new Vec3( + entity.prevPosX + (entity.posX - entity.prevPosX) * fx, + entity.prevPosY + (entity.posY - entity.prevPosY) * fx, + entity.prevPosZ + (entity.posZ - entity.prevPosZ) * fx + ); + int l; + int ix = L(l = wingsStyle.color() | 0xFF000000, -1, 0.28F); + int j = L(l, -1, 0.55F); + int k = Math.round(255.0F * wingsStyle.opacity()); + + try { + L(wingsStyle.throughWalls()); + wingsRenderer1.d(list, wingsStyle, vec3, ix, j, k); + wingsRenderer1.L(list, wingsStyle, vec3, l, k); + wingsRenderer1.L(list, wingsStyle, vec3, l, ix, k); + L(); + } catch (Throwable throwable) { + wingsRenderer1.H = false; + OnyxClient.LOGGER.warn("Wings renderer has been disabled after a render failure", throwable); + } + } + } + } + + private boolean L() { + if (!this.f) { + this.f = true; + this.shaderProgram = ShaderProgram.load("onyx_wings_aurora"); + } + + if (this.shaderProgram != null && this.shaderProgram.isLoaded()) { + this.shaderProgram.use(); + this.shaderProgram.setUniform1f("uTime", (float)(System.nanoTime() % 180000000000L) / 1.0E9F); + this.shaderProgram.setUniform2f("uResolution", mc.displayWidth, mc.displayHeight); + return true; + } else { + return false; + } + } + + private static void L(WorldRenderer worldRenderer, Matrix4f matrix4f, float f, float g, int i) { + Vector4f vector4f = Matrix4f.transform(matrix4f, new Vector4f(fx, g, 0.0F, 1.0F), null); + worldRenderer.pos(vector4f.x, vector4f.y, vector4f.z).color(L(ix, 16), L(ix, 8), L(ix, 0), L(ix)).endVertex(); + } + + private static int L(int i, int j) { + return ix >> j & 0xFF; + } + + private static int L(int i) { + return ix >> 24 & 0xFF; + } + + private static void L() { + GL11.glDisable(2848); + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableDepth(); + GlStateManager.enableCull(); + GlStateManager.disableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.blendFunc(770, 771); + GlStateManager.disableFog(); + GlStateManager.enableLighting(); + GlStateManager.enableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } +} diff --git a/src/openonyx/render/internal/WingsRendererListener.java b/src/openonyx/render/internal/WingsRendererListener.java new file mode 100644 index 0000000..ec7e482 --- /dev/null +++ b/src/openonyx/render/internal/WingsRendererListener.java @@ -0,0 +1,7 @@ +package openonyx.render.internal; + +import org.lwjgl.util.vector.Matrix4f; + +interface WingsRendererListener { + void L(WingInstance wingInstance, Matrix4f matrix4f, float f); +}