Skip to content

Commit 24d2a5f

Browse files
committed
Panorama Renderer -> Kotlin
1 parent 8d27727 commit 24d2a5f

10 files changed

Lines changed: 275 additions & 253 deletions

File tree

src/main/java/org/visuals/legacy/animatium/mixins/v1/gui/screen_tweaks/MixinGuiRenderer_LegacyPanoramaRendering.java renamed to src/main/java/org/visuals/legacy/animatium/mixins/v1/gui/screen_tweaks/panorama/MixinGuiRenderer_LegacyPanoramaRendering.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* "MINECRAFT" LINKING EXCEPTION TO THE GPL
2424
*/
2525

26-
package org.visuals.legacy.animatium.mixins.v1.gui.screen_tweaks;
26+
package org.visuals.legacy.animatium.mixins.v1.gui.screen_tweaks.panorama;
2727

2828
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
2929
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
@@ -35,7 +35,7 @@
3535
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
3636
import org.visuals.legacy.animatium.Animatium;
3737
import org.visuals.legacy.animatium.config.AnimatiumConfig;
38-
import org.visuals.legacy.animatium.util.rendering.panorama.LegacyPanoramaRenderer;
38+
import org.visuals.legacy.animatium.handler.rendering.panorama.LegacyPanoramaRenderer;
3939

4040
@Mixin(GuiRenderer.class)
4141
public abstract class MixinGuiRenderer_LegacyPanoramaRendering {

src/main/java/org/visuals/legacy/animatium/mixins/v1/gui/screen_tweaks/MixinPanorama_LegacyPanorama.java renamed to src/main/java/org/visuals/legacy/animatium/mixins/v1/gui/screen_tweaks/panorama/MixinPanorama_LegacyPanorama.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* "MINECRAFT" LINKING EXCEPTION TO THE GPL
2424
*/
2525

26-
package org.visuals.legacy.animatium.mixins.v1.gui.screen_tweaks;
26+
package org.visuals.legacy.animatium.mixins.v1.gui.screen_tweaks.panorama;
2727

2828
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
2929
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
@@ -36,7 +36,7 @@
3636
import org.spongepowered.asm.mixin.injection.At;
3737
import org.visuals.legacy.animatium.Animatium;
3838
import org.visuals.legacy.animatium.config.AnimatiumConfig;
39-
import org.visuals.legacy.animatium.util.rendering.panorama.LegacyPanoramaRenderer;
39+
import org.visuals.legacy.animatium.handler.rendering.panorama.LegacyPanoramaRenderer;
4040

4141
@Mixin(Panorama.class)
4242
public abstract class MixinPanorama_LegacyPanorama {

src/main/java/org/visuals/legacy/animatium/mixins/v1/rendering/items/MixinSpriteContents_FixTransparencyLimit.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
@Mixin(SpriteContents.class)
3838
public abstract class MixinSpriteContents_FixTransparencyLimit {
3939
@WrapOperation(method = "isTransparent", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ARGB;alpha(I)I"))
40-
private int animatium$upMinPixelTransparencyLimit(final int color, Operation<Integer> original) {
40+
private int animatium$upMinPixelTransparencyLimit(final int color, final Operation<Integer> original) {
4141
if (Animatium.isEnabled() && AnimatiumConfig.instance().fixes.upMinPixelTransparencyLimit && ARGB.alphaFloat(color) <= 0.1F) {
4242
return 0;
4343
} else {

src/main/java/org/visuals/legacy/animatium/util/compatibility/IrisUtil.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ public final class IrisUtil {
4040
static {
4141
try {
4242
// API
43-
Class<?> irisApiClass = Class.forName("net.irisshaders.iris.api.v0.IrisApi");
43+
final Class<?> irisApiClass = Class.forName("net.irisshaders.iris.api.v0.IrisApi");
4444
IRIS_INSTANCE = irisApiClass.getMethod("getInstance").invoke(null);
4545

4646
// Enums
47-
@SuppressWarnings("rawtypes")
48-
Class<? extends Enum> irisProgramEnum = Class.forName("net.irisshaders.iris.api.v0.IrisProgram").asSubclass(Enum.class);
47+
@SuppressWarnings("rawtypes") final Class<? extends Enum> irisProgramEnum = Class.forName("net.irisshaders.iris.api.v0.IrisProgram").asSubclass(Enum.class);
4948
Arrays.stream(IrisPipeline.VALUES).forEach((program) -> program.initialize(irisProgramEnum));
5049

5150
// Methods
@@ -68,10 +67,4 @@ public static void assignPipeline(final RenderPipeline pipeline, final IrisPipel
6867
} catch (final Exception ignored) {
6968
}
7069
}
71-
72-
public static void assignPipeline(final IrisPipeline program, final RenderPipeline... pipelines) {
73-
for (final RenderPipeline pipeline : pipelines) {
74-
assignPipeline(pipeline, program);
75-
}
76-
}
7770
}

src/main/java/org/visuals/legacy/animatium/util/rendering/panorama/LegacyPanoramaRenderer.java

Lines changed: 0 additions & 158 deletions
This file was deleted.

src/main/java/org/visuals/legacy/animatium/util/rendering/panorama/PanoramaBlitTexture.java

Lines changed: 0 additions & 75 deletions
This file was deleted.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/**
2+
* Animatium
3+
* The all-you-could-want legacy animations mod for modern minecraft versions.
4+
* Brings back animations from the 1.7/1.8 era and more.
5+
* <p>
6+
* Copyright (C) 2024-2025 lowercasebtw
7+
* Copyright (C) 2024-2025 mixces
8+
* Copyright (C) 2024-2025 Contributors to the project retain their copyright
9+
* <p>
10+
* This program is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
* <p>
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU General Public License for more details.
19+
* <p>
20+
* You should have received a copy of the GNU General Public License
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
* <p>
23+
* "MINECRAFT" LINKING EXCEPTION TO THE GPL
24+
*/
25+
26+
package org.visuals.legacy.animatium.handler.rendering.panorama
27+
28+
import com.mojang.blaze3d.systems.RenderSystem
29+
import com.mojang.blaze3d.textures.FilterMode
30+
import com.mojang.blaze3d.textures.GpuTextureView
31+
import com.mojang.blaze3d.vertex.VertexConsumer
32+
import net.minecraft.client.gui.navigation.ScreenRectangle
33+
import net.minecraft.client.gui.render.TextureSetup
34+
import net.minecraft.client.renderer.RenderPipelines
35+
import net.minecraft.client.renderer.state.gui.GuiElementRenderState
36+
import net.minecraft.util.ARGB
37+
import org.joml.Matrix3x2f
38+
39+
class LegacyPanoramaBlitTexture(
40+
val pose: Matrix3x2f,
41+
val textureView: GpuTextureView,
42+
val width: Int,
43+
val height: Int
44+
) : GuiElementRenderState {
45+
override fun buildVertices(vertexConsumer: VertexConsumer) {
46+
val color = ARGB.white(1.0F)
47+
val aspect = if (this.width > this.height) 120.0F / this.width else 120.0F / this.height
48+
val sw = this.width * aspect / 256.0F
49+
val sh = this.height * aspect / 256.0F
50+
vertexConsumer
51+
.addVertexWith2DPose(this.pose, 0.0F, this.height.toFloat())
52+
.setUv(0.5F - sh, 0.5F + sw)
53+
.setColor(color)
54+
vertexConsumer
55+
.addVertexWith2DPose(this.pose, this.width.toFloat(), this.height.toFloat())
56+
.setUv(0.5F - sh, 0.5F - sw)
57+
.setColor(color)
58+
vertexConsumer
59+
.addVertexWith2DPose(this.pose, this.width.toFloat(), 0.0F)
60+
.setUv(0.5F + sh, 0.5F - sw)
61+
.setColor(color)
62+
vertexConsumer
63+
.addVertexWith2DPose(this.pose, 0.0F, 0.0F)
64+
.setUv(0.5F + sh, 0.5F + sw)
65+
.setColor(color)
66+
}
67+
68+
override fun pipeline() = RenderPipelines.GUI_TEXTURED
69+
70+
override fun textureSetup() =
71+
TextureSetup.singleTexture(this.textureView, RenderSystem.getSamplerCache().getClampToEdge(FilterMode.LINEAR))
72+
73+
override fun scissorArea() = null
74+
75+
override fun bounds() = ScreenRectangle(0, 0, this.width, this.height)
76+
}

src/main/java/org/visuals/legacy/animatium/util/rendering/panorama/LegacyPanoramaRenderState.java renamed to src/main/kotlin/org/visuals/legacy/animatium/handler/rendering/panorama/LegacyPanoramaRenderState.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
* "MINECRAFT" LINKING EXCEPTION TO THE GPL
2424
*/
2525

26-
package org.visuals.legacy.animatium.util.rendering.panorama;
26+
package org.visuals.legacy.animatium.handler.rendering.panorama
2727

28-
import org.joml.Matrix3x2f;
28+
import org.joml.Matrix3x2f
2929

30-
public record LegacyPanoramaRenderState(Matrix3x2f pose, int width, int height, float spin) {
31-
}
30+
data class LegacyPanoramaRenderState(val pose: Matrix3x2f, val width: Int, val height: Int, val spin: Float)

0 commit comments

Comments
 (0)