From e032cbb65842e55bb8b12b91a46e8c5177a97115 Mon Sep 17 00:00:00 2001 From: Pixirora Date: Wed, 10 Jul 2024 20:36:10 -0400 Subject: [PATCH] make GuiTexture and Texture distinct types Rather than GuiTexture being a child type of Texture. This stops GuiTexture from being used in a place that Texture would be used by accident. --- .../kit_tunes/impl/ui/texture/AbstractTexture.java | 10 ++++++++++ .../kit_tunes/impl/ui/texture/GuiTexture.java | 2 +- .../pixaurora/kit_tunes/impl/ui/texture/Texture.java | 6 +----- 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 subprojects/core/src/main/java/net/pixaurora/kit_tunes/impl/ui/texture/AbstractTexture.java diff --git a/subprojects/core/src/main/java/net/pixaurora/kit_tunes/impl/ui/texture/AbstractTexture.java b/subprojects/core/src/main/java/net/pixaurora/kit_tunes/impl/ui/texture/AbstractTexture.java new file mode 100644 index 0000000..d42c368 --- /dev/null +++ b/subprojects/core/src/main/java/net/pixaurora/kit_tunes/impl/ui/texture/AbstractTexture.java @@ -0,0 +1,10 @@ +package net.pixaurora.kit_tunes.impl.ui.texture; + +import net.pixaurora.kit_tunes.api.resource.ResourcePath; +import net.pixaurora.kit_tunes.impl.ui.math.Size; + +public interface AbstractTexture { + public ResourcePath path(); + + public Size size(); +} diff --git a/subprojects/core/src/main/java/net/pixaurora/kit_tunes/impl/ui/texture/GuiTexture.java b/subprojects/core/src/main/java/net/pixaurora/kit_tunes/impl/ui/texture/GuiTexture.java index d57dbec..6e9e679 100644 --- a/subprojects/core/src/main/java/net/pixaurora/kit_tunes/impl/ui/texture/GuiTexture.java +++ b/subprojects/core/src/main/java/net/pixaurora/kit_tunes/impl/ui/texture/GuiTexture.java @@ -4,7 +4,7 @@ import net.pixaurora.kit_tunes.impl.KitTunes; import net.pixaurora.kit_tunes.impl.ui.math.Size; -public interface GuiTexture extends Texture { +public interface GuiTexture extends AbstractTexture { public static GuiTexture of(ResourcePath path, Size size) { return new TextureImpl(KitTunes.UI_LAYER.convertToGuiAsset(path), size); } diff --git a/subprojects/core/src/main/java/net/pixaurora/kit_tunes/impl/ui/texture/Texture.java b/subprojects/core/src/main/java/net/pixaurora/kit_tunes/impl/ui/texture/Texture.java index 551f84a..384d63a 100644 --- a/subprojects/core/src/main/java/net/pixaurora/kit_tunes/impl/ui/texture/Texture.java +++ b/subprojects/core/src/main/java/net/pixaurora/kit_tunes/impl/ui/texture/Texture.java @@ -5,11 +5,7 @@ import net.pixaurora.kit_tunes.impl.resource.ResourcePathImpl; import net.pixaurora.kit_tunes.impl.ui.math.Size; -public interface Texture { - public ResourcePath path(); - - public Size size(); - +public interface Texture extends AbstractTexture { public static Texture of(String path, Size size) { return of(ResourcePathImpl.fromString(path), size); }