From 4f24b8eee54f0aa866a90038b44fc805bf8f61ab Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Thu, 11 Apr 2024 04:48:12 -0400 Subject: [PATCH] Cleanup --- .../renderer/impl/BodySkinPartRenderer.java | 6 ++-- ...ava => IsometricHeadSkinPartRenderer.java} | 8 ++--- .../me/braydon/mc/model/skin/ISkinPart.java | 34 ++++--------------- .../java/me/braydon/mc/model/skin/Skin.java | 1 - 4 files changed, 13 insertions(+), 36 deletions(-) rename src/main/java/me/braydon/mc/common/renderer/impl/{IsometricSkinPartRenderer.java => IsometricHeadSkinPartRenderer.java} (93%) diff --git a/src/main/java/me/braydon/mc/common/renderer/impl/BodySkinPartRenderer.java b/src/main/java/me/braydon/mc/common/renderer/impl/BodySkinPartRenderer.java index ec3bfb3..924e6b7 100644 --- a/src/main/java/me/braydon/mc/common/renderer/impl/BodySkinPartRenderer.java +++ b/src/main/java/me/braydon/mc/common/renderer/impl/BodySkinPartRenderer.java @@ -31,11 +31,11 @@ import me.braydon.mc.model.skin.Skin; import java.awt.image.BufferedImage; /** - * A basic 2D renderer for a {@link ISkinPart.Basic#BODY}. + * A basic 2D renderer for a {@link ISkinPart.Custom#BODY}. * * @author Braydon */ -public final class BodySkinPartRenderer extends SkinRenderer { +public final class BodySkinPartRenderer extends SkinRenderer { public static final BodySkinPartRenderer INSTANCE = new BodySkinPartRenderer(); /** @@ -49,7 +49,7 @@ public final class BodySkinPartRenderer extends SkinRenderer { * @return the rendered skin part */ @Override @NonNull - public BufferedImage render(@NonNull Skin skin, @NonNull ISkinPart.Basic part, boolean overlays, int size) { + public BufferedImage render(@NonNull Skin skin, @NonNull ISkinPart.Custom part, boolean overlays, int size) { return getVanillaSkinPart(skin, ISkinPart.Vanilla.FACE, size); } } \ No newline at end of file diff --git a/src/main/java/me/braydon/mc/common/renderer/impl/IsometricSkinPartRenderer.java b/src/main/java/me/braydon/mc/common/renderer/impl/IsometricHeadSkinPartRenderer.java similarity index 93% rename from src/main/java/me/braydon/mc/common/renderer/impl/IsometricSkinPartRenderer.java rename to src/main/java/me/braydon/mc/common/renderer/impl/IsometricHeadSkinPartRenderer.java index 60963d9..95c457b 100644 --- a/src/main/java/me/braydon/mc/common/renderer/impl/IsometricSkinPartRenderer.java +++ b/src/main/java/me/braydon/mc/common/renderer/impl/IsometricHeadSkinPartRenderer.java @@ -33,12 +33,12 @@ import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; /** - * A isometric 3D renderer for a {@link ISkinPart.Isometric}. + * A isometric 3D renderer for a {@link ISkinPart.Custom#HEAD}. * * @author Braydon */ -public final class IsometricSkinPartRenderer extends SkinRenderer { - public static final IsometricSkinPartRenderer INSTANCE = new IsometricSkinPartRenderer(); +public final class IsometricHeadSkinPartRenderer extends SkinRenderer { + public static final IsometricHeadSkinPartRenderer INSTANCE = new IsometricHeadSkinPartRenderer(); private static final double SKEW_A = 26D / 45D; // 0.57777777 private static final double SKEW_B = SKEW_A * 2D; // 1.15555555 @@ -58,7 +58,7 @@ public final class IsometricSkinPartRenderer extends SkinRenderer[][] TYPES = { Vanilla.values(), Basic.values(), Isometric.values() }; + Enum[][] TYPES = { Vanilla.values(), Custom.values() }; /** * Get the name of this part. @@ -170,19 +170,17 @@ public interface ISkinPart { } /** - * A basic part of a skin. - *

- * These parts have custom renderers! - *

+ * A custom part of a skin. */ @AllArgsConstructor @Getter - enum Basic implements ISkinPart { + enum Custom implements ISkinPart { + HEAD(IsometricHeadSkinPartRenderer.INSTANCE), BODY(BodySkinPartRenderer.INSTANCE); /** * The custom renderer to use for this part. */ - @NonNull private final SkinRenderer renderer; + @NonNull private final SkinRenderer renderer; /** * Render a part of a skin. @@ -197,24 +195,4 @@ public interface ISkinPart { return renderer.render(skin, this, overlays, size); } } - - /** - * A isometric part of a skin. - */ - enum Isometric implements ISkinPart { - HEAD; - - /** - * Render a part of a skin. - * - * @param skin the skin to render the part for - * @param overlays whether to render overlays - * @param size the size to scale the skin part to - * @return the rendered skin part - */ - @Override @NonNull - public BufferedImage render(@NonNull Skin skin, boolean overlays, int size) { - return IsometricSkinPartRenderer.INSTANCE.render(skin, this, overlays, size); - } - } } \ No newline at end of file diff --git a/src/main/java/me/braydon/mc/model/skin/Skin.java b/src/main/java/me/braydon/mc/model/skin/Skin.java index 8a865bb..39c9320 100644 --- a/src/main/java/me/braydon/mc/model/skin/Skin.java +++ b/src/main/java/me/braydon/mc/model/skin/Skin.java @@ -31,7 +31,6 @@ import me.braydon.mc.model.Player; import java.util.HashMap; import java.util.Map; -import java.util.function.Consumer; /** * A skin for a {@link Player}.