Architecture #35
This commit is contained in:
@@ -3,14 +3,14 @@ package org.saturnclient.common;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
import org.saturnclient.common.render.IWindow;
|
import org.saturnclient.common.ref.render.WindowRef;
|
||||||
|
|
||||||
public interface IMinecraftClient {
|
public interface IMinecraftClient {
|
||||||
|
|
||||||
public File getRunDirectory();
|
public File getRunDirectory();
|
||||||
|
|
||||||
public InputStream getResource(SaturnIdentifier identifier);
|
public InputStream getResource(IdentifierRef identifier);
|
||||||
|
|
||||||
public IWindow getWindow();
|
public WindowRef getWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.saturnclient.common;
|
package org.saturnclient.common;
|
||||||
|
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
import org.saturnclient.ui.SaturnScreen;
|
import org.saturnclient.ui.SaturnScreen;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -26,7 +26,7 @@ public abstract class MinecraftProvider {
|
|||||||
|
|
||||||
public abstract int getWidth(String text, int font);
|
public abstract int getWidth(String text, int font);
|
||||||
|
|
||||||
public abstract void registerBufferedImageTexture(SaturnIdentifier i, BufferedImage bi);
|
public abstract void registerBufferedImageTexture(IdentifierRef i, BufferedImage bi);
|
||||||
|
|
||||||
public abstract String getKeyName(int key);
|
public abstract String getKeyName(int key);
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
package org.saturnclient.common.bindings;
|
|
||||||
|
|
||||||
import org.saturnclient.common.MinecraftBinding;
|
|
||||||
import org.saturnclient.common.MinecraftProvider;
|
|
||||||
|
|
||||||
public class SaturnIdentifier extends MinecraftBinding {
|
|
||||||
public SaturnIdentifier(String namespace, String path) {
|
|
||||||
super(MinecraftProvider.PROVIDER.createIdentifier(namespace, path));
|
|
||||||
}
|
|
||||||
|
|
||||||
public SaturnIdentifier(Object o) {
|
|
||||||
super(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SaturnIdentifier of(String namespace, String path) {
|
|
||||||
return new SaturnIdentifier(namespace, path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SaturnIdentifier of(String fullPath) {
|
|
||||||
String[] p = fullPath.split(":", 2);
|
|
||||||
|
|
||||||
return new SaturnIdentifier(p[0], p[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SaturnIdentifier ofVanilla(String path) {
|
|
||||||
return new SaturnIdentifier("minecraft", path);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return this.inner.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package org.saturnclient.common.bindings;
|
|
||||||
|
|
||||||
import org.saturnclient.common.MinecraftBinding;
|
|
||||||
|
|
||||||
public class SaturnItemStack extends MinecraftBinding {
|
|
||||||
public SaturnItemStack(Object binding) {
|
|
||||||
super(binding);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package org.saturnclient.common.bindings;
|
|
||||||
|
|
||||||
import org.saturnclient.common.MinecraftBinding;
|
|
||||||
|
|
||||||
public class SaturnSprite extends MinecraftBinding {
|
|
||||||
public SaturnSprite(Object binding) {
|
|
||||||
super(binding);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package org.saturnclient.common.ref.asset;
|
||||||
|
|
||||||
|
import org.saturnclient.common.MinecraftBinding;
|
||||||
|
import org.saturnclient.common.MinecraftProvider;
|
||||||
|
|
||||||
|
public class IdentifierRef extends MinecraftBinding {
|
||||||
|
public IdentifierRef(String namespace, String path) {
|
||||||
|
super(MinecraftProvider.PROVIDER.createIdentifier(namespace, path));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IdentifierRef(Object o) {
|
||||||
|
super(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IdentifierRef of(String namespace, String path) {
|
||||||
|
return new IdentifierRef(namespace, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IdentifierRef of(String fullPath) {
|
||||||
|
String[] p = fullPath.split(":", 2);
|
||||||
|
|
||||||
|
return new IdentifierRef(p[0], p[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IdentifierRef ofVanilla(String path) {
|
||||||
|
return new IdentifierRef("minecraft", path);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.inner.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.saturnclient.common.ref.asset;
|
||||||
|
|
||||||
|
import org.saturnclient.common.MinecraftBinding;
|
||||||
|
|
||||||
|
public class SpriteRef extends MinecraftBinding {
|
||||||
|
public SpriteRef(Object binding) {
|
||||||
|
super(binding);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.saturnclient.common.ref.game;
|
||||||
|
|
||||||
|
import org.saturnclient.common.MinecraftBinding;
|
||||||
|
|
||||||
|
public class ItemStackRef extends MinecraftBinding {
|
||||||
|
public ItemStackRef(Object binding) {
|
||||||
|
super(binding);
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-4
@@ -1,8 +1,6 @@
|
|||||||
package org.saturnclient.common.render;
|
package org.saturnclient.common.ref.render;
|
||||||
|
|
||||||
import org.saturnclient.common.bindings.SaturnQuaternionf;
|
public interface MatrixStackRef {
|
||||||
|
|
||||||
public interface IMatrixStack {
|
|
||||||
public void translate(double x, double y, double z);
|
public void translate(double x, double y, double z);
|
||||||
|
|
||||||
public void translate(float x, float y, float z);
|
public void translate(float x, float y, float z);
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package org.saturnclient.common.bindings;
|
package org.saturnclient.common.ref.render;
|
||||||
|
|
||||||
import org.saturnclient.common.MinecraftBinding;
|
import org.saturnclient.common.MinecraftBinding;
|
||||||
|
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
package org.saturnclient.common.render;
|
package org.saturnclient.common.ref.render;
|
||||||
|
|
||||||
public interface IWindow {
|
public interface WindowRef {
|
||||||
public int getWidth();
|
public int getWidth();
|
||||||
|
|
||||||
public int getHeight();
|
public int getHeight();
|
||||||
@@ -3,7 +3,7 @@ package org.saturnclient.config;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.saturnclient.common.MinecraftProvider;
|
import org.saturnclient.common.MinecraftProvider;
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
import org.saturnclient.config.manager.ConfigManager;
|
import org.saturnclient.config.manager.ConfigManager;
|
||||||
import org.saturnclient.config.manager.Key;
|
import org.saturnclient.config.manager.Key;
|
||||||
import org.saturnclient.config.manager.Property;
|
import org.saturnclient.config.manager.Property;
|
||||||
@@ -18,7 +18,7 @@ public class Config {
|
|||||||
public static Property<Integer> openEmoteWheel = Property.keybinding(Key.GLFW_KEY_B);
|
public static Property<Integer> openEmoteWheel = Property.keybinding(Key.GLFW_KEY_B);
|
||||||
public static Property<Boolean> stagger = Property.bool(true);
|
public static Property<Boolean> stagger = Property.bool(true);
|
||||||
|
|
||||||
public static SaturnIdentifier getLogo() {
|
public static IdentifierRef getLogo() {
|
||||||
return realisticLogo.value ? Textures.REALISTIC_LOGO : Textures.LOGO;
|
return realisticLogo.value ? Textures.REALISTIC_LOGO : Textures.LOGO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.saturnclient.modules;
|
package org.saturnclient.modules;
|
||||||
|
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
import org.saturnclient.config.manager.ConfigManager;
|
import org.saturnclient.config.manager.ConfigManager;
|
||||||
import org.saturnclient.config.manager.Property.NamedProperty;
|
import org.saturnclient.config.manager.Property.NamedProperty;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
@@ -37,7 +37,7 @@ public abstract class Module {
|
|||||||
return details.name;
|
return details.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SaturnIdentifier getIconTexture() {
|
public IdentifierRef getIconTexture() {
|
||||||
return Textures.getModIcon(details.namespace);
|
return Textures.getModIcon(details.namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +1,32 @@
|
|||||||
package org.saturnclient.modules.interfaces;
|
package org.saturnclient.modules.interfaces;
|
||||||
|
|
||||||
import org.saturnclient.common.bindings.SaturnItemStack;
|
import org.saturnclient.common.ref.game.ItemStackRef;
|
||||||
|
|
||||||
public interface ArmorDisplayInterface {
|
public interface ArmorDisplayInterface {
|
||||||
|
|
||||||
SaturnItemStack getMainHand();
|
ItemStackRef getMainHand();
|
||||||
|
|
||||||
SaturnItemStack getHelmet();
|
ItemStackRef getHelmet();
|
||||||
|
|
||||||
SaturnItemStack getChestplate();
|
ItemStackRef getChestplate();
|
||||||
|
|
||||||
SaturnItemStack getLeggings();
|
ItemStackRef getLeggings();
|
||||||
|
|
||||||
SaturnItemStack getBoots();
|
ItemStackRef getBoots();
|
||||||
|
|
||||||
SaturnItemStack getDummyMainHand();
|
ItemStackRef getDummyMainHand();
|
||||||
|
|
||||||
SaturnItemStack getDummyHelmet();
|
ItemStackRef getDummyHelmet();
|
||||||
|
|
||||||
SaturnItemStack getDummyChestplate();
|
ItemStackRef getDummyChestplate();
|
||||||
|
|
||||||
SaturnItemStack getDummyLeggings();
|
ItemStackRef getDummyLeggings();
|
||||||
|
|
||||||
SaturnItemStack getDummyBoots();
|
ItemStackRef getDummyBoots();
|
||||||
|
|
||||||
boolean isEmpty(SaturnItemStack stack);
|
boolean isEmpty(ItemStackRef stack);
|
||||||
|
|
||||||
int getMaxDamage(SaturnItemStack stack);
|
int getMaxDamage(ItemStackRef stack);
|
||||||
|
|
||||||
int getDamage(SaturnItemStack stack);
|
int getDamage(ItemStackRef stack);
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package org.saturnclient.modules.interfaces;
|
package org.saturnclient.modules.interfaces;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.saturnclient.common.bindings.SaturnSprite;
|
|
||||||
|
import org.saturnclient.common.ref.asset.SpriteRef;
|
||||||
|
|
||||||
public interface StatusEffectsInterface {
|
public interface StatusEffectsInterface {
|
||||||
|
|
||||||
@@ -13,13 +14,13 @@ public interface StatusEffectsInterface {
|
|||||||
|
|
||||||
/** Represents a single effect for rendering purposes */
|
/** Represents a single effect for rendering purposes */
|
||||||
class Effect {
|
class Effect {
|
||||||
private final SaturnSprite icon;
|
private final SpriteRef icon;
|
||||||
private final int durationSeconds;
|
private final int durationSeconds;
|
||||||
private final boolean infinite;
|
private final boolean infinite;
|
||||||
private final boolean showIcon;
|
private final boolean showIcon;
|
||||||
private final String infiniteText;
|
private final String infiniteText;
|
||||||
|
|
||||||
public Effect(SaturnSprite icon, int durationSeconds, boolean infinite, boolean showIcon, String infiniteText) {
|
public Effect(SpriteRef icon, int durationSeconds, boolean infinite, boolean showIcon, String infiniteText) {
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
this.durationSeconds = durationSeconds;
|
this.durationSeconds = durationSeconds;
|
||||||
this.infinite = infinite;
|
this.infinite = infinite;
|
||||||
@@ -27,7 +28,7 @@ public interface StatusEffectsInterface {
|
|||||||
this.infiniteText = infiniteText;
|
this.infiniteText = infiniteText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SaturnSprite getIcon() {
|
public SpriteRef getIcon() {
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import org.saturnclient.modules.ModDimensions;
|
|||||||
import org.saturnclient.modules.Module;
|
import org.saturnclient.modules.Module;
|
||||||
import org.saturnclient.modules.ModuleDetails;
|
import org.saturnclient.modules.ModuleDetails;
|
||||||
import org.saturnclient.modules.interfaces.ArmorDisplayInterface;
|
import org.saturnclient.modules.interfaces.ArmorDisplayInterface;
|
||||||
import org.saturnclient.common.bindings.SaturnItemStack;
|
import org.saturnclient.common.ref.game.ItemStackRef;
|
||||||
import org.saturnclient.config.manager.Property;
|
import org.saturnclient.config.manager.Property;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
|
|
||||||
@@ -30,11 +30,11 @@ public class ArmorDisplay extends Module implements HudMod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void renderArmor(RenderScope scope,
|
public void renderArmor(RenderScope scope,
|
||||||
SaturnItemStack mainHand,
|
ItemStackRef mainHand,
|
||||||
SaturnItemStack helmet,
|
ItemStackRef helmet,
|
||||||
SaturnItemStack chestplate,
|
ItemStackRef chestplate,
|
||||||
SaturnItemStack leggings,
|
ItemStackRef leggings,
|
||||||
SaturnItemStack boots) {
|
ItemStackRef boots) {
|
||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package org.saturnclient.ui;
|
package org.saturnclient.ui;
|
||||||
|
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
import org.saturnclient.common.bindings.SaturnItemStack;
|
import org.saturnclient.common.ref.asset.SpriteRef;
|
||||||
import org.saturnclient.common.bindings.SaturnSprite;
|
import org.saturnclient.common.ref.game.ItemStackRef;
|
||||||
import org.saturnclient.common.render.IMatrixStack;
|
import org.saturnclient.common.ref.render.MatrixStackRef;
|
||||||
|
|
||||||
public interface RenderScope {
|
public interface RenderScope {
|
||||||
public IMatrixStack getMatrixStack();
|
public MatrixStackRef getMatrixStack();
|
||||||
|
|
||||||
public void setOpacity(float alpha);
|
public void setOpacity(float alpha);
|
||||||
|
|
||||||
@@ -25,16 +25,16 @@ public interface RenderScope {
|
|||||||
public int getScaledWindowHeight();
|
public int getScaledWindowHeight();
|
||||||
|
|
||||||
/* Saturn common sprites */
|
/* Saturn common sprites */
|
||||||
public void drawTexture(SaturnIdentifier sprite, int x, int y, float u, float v, int width, int height,
|
public void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height,
|
||||||
int color);
|
int color);
|
||||||
|
|
||||||
public void drawTexture(SaturnIdentifier sprite, int x, int y, float u, float v, int width, int height);
|
public void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height);
|
||||||
|
|
||||||
public void drawTexture(SaturnIdentifier sprite, int x, int y, float u, float v, int width, int height,
|
public void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height,
|
||||||
int regionWith,
|
int regionWith,
|
||||||
int regionHeight, int textureWidth, int textureHeight);
|
int regionHeight, int textureWidth, int textureHeight);
|
||||||
|
|
||||||
public void drawTexture(SaturnIdentifier sprite, int x, int y, float u, float v, int width, int height,
|
public void drawTexture(IdentifierRef sprite, int x, int y, float u, float v, int width, int height,
|
||||||
int regionWidth,
|
int regionWidth,
|
||||||
int regionHeight, int textureWidth, int textureHeight, int color);
|
int regionHeight, int textureWidth, int textureHeight, int color);
|
||||||
|
|
||||||
@@ -46,19 +46,19 @@ public interface RenderScope {
|
|||||||
|
|
||||||
public void draw();
|
public void draw();
|
||||||
|
|
||||||
public void drawItem(SaturnItemStack item, int x, int y);
|
public void drawItem(ItemStackRef item, int x, int y);
|
||||||
|
|
||||||
public void drawItem(SaturnItemStack stack, int x, int y, int seed);
|
public void drawItem(ItemStackRef stack, int x, int y, int seed);
|
||||||
|
|
||||||
public void drawItem(SaturnItemStack stack, int x, int y, int seed, int z);
|
public void drawItem(ItemStackRef stack, int x, int y, int seed, int z);
|
||||||
|
|
||||||
public void drawItemWithoutEntity(SaturnItemStack stack, int x, int y);
|
public void drawItemWithoutEntity(ItemStackRef stack, int x, int y);
|
||||||
|
|
||||||
public void drawItemWithoutEntity(SaturnItemStack stack, int x, int y, int seed);
|
public void drawItemWithoutEntity(ItemStackRef stack, int x, int y, int seed);
|
||||||
|
|
||||||
public void drawSpriteStretched(SaturnSprite sprite, int x, int y, int width, int height);
|
public void drawSpriteStretched(SpriteRef sprite, int x, int y, int width, int height);
|
||||||
|
|
||||||
public void drawSpriteStretched(SaturnSprite sprite, int x, int y, int width, int height, int color);
|
public void drawSpriteStretched(SpriteRef sprite, int x, int y, int width, int height, int color);
|
||||||
|
|
||||||
public void fill(int x1, int y1, int x2, int y2, int color);
|
public void fill(int x1, int y1, int x2, int y2, int color);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.saturnclient.ui.components;
|
package org.saturnclient.ui.components;
|
||||||
|
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
import org.saturnclient.config.Theme;
|
import org.saturnclient.config.Theme;
|
||||||
import org.saturnclient.ui.Element;
|
import org.saturnclient.ui.Element;
|
||||||
import org.saturnclient.ui.ElementContext;
|
import org.saturnclient.ui.ElementContext;
|
||||||
@@ -9,11 +9,11 @@ import org.saturnclient.ui.RenderScope;
|
|||||||
public class CosmeticPreview extends Element {
|
public class CosmeticPreview extends Element {
|
||||||
static int padding = 14;
|
static int padding = 14;
|
||||||
|
|
||||||
SaturnIdentifier sprite;
|
IdentifierRef sprite;
|
||||||
private Runnable onClick;
|
private Runnable onClick;
|
||||||
private boolean isSelected;
|
private boolean isSelected;
|
||||||
|
|
||||||
public CosmeticPreview(boolean isSelected, SaturnIdentifier sprite, Runnable onClick) {
|
public CosmeticPreview(boolean isSelected, IdentifierRef sprite, Runnable onClick) {
|
||||||
this.sprite = sprite;
|
this.sprite = sprite;
|
||||||
this.onClick = onClick;
|
this.onClick = onClick;
|
||||||
this.isSelected = isSelected;
|
this.isSelected = isSelected;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.saturnclient.ui.components;
|
package org.saturnclient.ui.components;
|
||||||
|
|
||||||
import org.saturnclient.common.MinecraftProvider;
|
import org.saturnclient.common.MinecraftProvider;
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
import org.saturnclient.config.Config;
|
import org.saturnclient.config.Config;
|
||||||
import org.saturnclient.config.Theme;
|
import org.saturnclient.config.Theme;
|
||||||
import org.saturnclient.ui.Element;
|
import org.saturnclient.ui.Element;
|
||||||
@@ -18,9 +18,9 @@ public class Sidebar extends Element {
|
|||||||
public static class SidebarComponent {
|
public static class SidebarComponent {
|
||||||
Runnable onClick;
|
Runnable onClick;
|
||||||
boolean end;
|
boolean end;
|
||||||
SaturnIdentifier sprite;
|
IdentifierRef sprite;
|
||||||
|
|
||||||
public SidebarComponent(SaturnIdentifier sprite, Runnable onClick, boolean end) {
|
public SidebarComponent(IdentifierRef sprite, Runnable onClick, boolean end) {
|
||||||
this.onClick = onClick;
|
this.onClick = onClick;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
this.sprite = sprite;
|
this.sprite = sprite;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
package org.saturnclient.ui.elements;
|
package org.saturnclient.ui.elements;
|
||||||
|
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
import org.saturnclient.config.Theme;
|
import org.saturnclient.config.Theme;
|
||||||
import org.saturnclient.ui.Element;
|
import org.saturnclient.ui.Element;
|
||||||
import org.saturnclient.ui.ElementContext;
|
import org.saturnclient.ui.ElementContext;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
|
|
||||||
public class ClickableTexture extends Element {
|
public class ClickableTexture extends Element {
|
||||||
SaturnIdentifier sprite;
|
IdentifierRef sprite;
|
||||||
private Runnable onClick;
|
private Runnable onClick;
|
||||||
|
|
||||||
public ClickableTexture(SaturnIdentifier sprite, Runnable onClick) {
|
public ClickableTexture(IdentifierRef sprite, Runnable onClick) {
|
||||||
this.sprite = sprite;
|
this.sprite = sprite;
|
||||||
this.onClick = onClick;
|
this.onClick = onClick;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,16 +2,16 @@ package org.saturnclient.ui.elements;
|
|||||||
|
|
||||||
import org.saturnclient.common.IMinecraftClient;
|
import org.saturnclient.common.IMinecraftClient;
|
||||||
import org.saturnclient.common.MinecraftProvider;
|
import org.saturnclient.common.MinecraftProvider;
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
import org.saturnclient.ui.Element;
|
import org.saturnclient.ui.Element;
|
||||||
import org.saturnclient.ui.ElementContext;
|
import org.saturnclient.ui.ElementContext;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
import org.saturnclient.ui.resources.SvgTexture;
|
import org.saturnclient.ui.resources.SvgTexture;
|
||||||
|
|
||||||
public class ImageTexture extends Element {
|
public class ImageTexture extends Element {
|
||||||
SaturnIdentifier sprite;
|
IdentifierRef sprite;
|
||||||
|
|
||||||
public ImageTexture(SaturnIdentifier sprite) {
|
public ImageTexture(IdentifierRef sprite) {
|
||||||
this.sprite = sprite;
|
this.sprite = sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ public class ImageTexture extends Element {
|
|||||||
int renderHeight = (int) (height * client.getWindow().getFramebufferHeight()
|
int renderHeight = (int) (height * client.getWindow().getFramebufferHeight()
|
||||||
/ client.getWindow().getHeight());
|
/ client.getWindow().getHeight());
|
||||||
|
|
||||||
SaturnIdentifier pngId = SvgTexture.getSvg(client, sprite, renderWidth * 2, renderHeight * 2);
|
IdentifierRef pngId = SvgTexture.getSvg(client, sprite, renderWidth * 2, renderHeight * 2);
|
||||||
|
|
||||||
this.sprite = pngId;
|
this.sprite = pngId;
|
||||||
if (pngId == null) {
|
if (pngId == null) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.saturnclient.ui.elements;
|
package org.saturnclient.ui.elements;
|
||||||
|
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
import org.saturnclient.config.Theme;
|
import org.saturnclient.config.Theme;
|
||||||
import org.saturnclient.ui.Element;
|
import org.saturnclient.ui.Element;
|
||||||
import org.saturnclient.ui.ElementContext;
|
import org.saturnclient.ui.ElementContext;
|
||||||
@@ -10,9 +10,9 @@ import org.saturnclient.ui.Utils;
|
|||||||
public class TabMenu extends Element {
|
public class TabMenu extends Element {
|
||||||
public static class TabMenuComponent {
|
public static class TabMenuComponent {
|
||||||
Runnable onClick;
|
Runnable onClick;
|
||||||
SaturnIdentifier sprite;
|
IdentifierRef sprite;
|
||||||
|
|
||||||
public TabMenuComponent(SaturnIdentifier sprite, Runnable onClick) {
|
public TabMenuComponent(IdentifierRef sprite, Runnable onClick) {
|
||||||
this.onClick = onClick;
|
this.onClick = onClick;
|
||||||
this.sprite = sprite;
|
this.sprite = sprite;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
package org.saturnclient.ui.elements;
|
package org.saturnclient.ui.elements;
|
||||||
|
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
import org.saturnclient.config.Theme;
|
import org.saturnclient.config.Theme;
|
||||||
import org.saturnclient.ui.Element;
|
import org.saturnclient.ui.Element;
|
||||||
import org.saturnclient.ui.ElementContext;
|
import org.saturnclient.ui.ElementContext;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
|
|
||||||
public class TextureButton extends Element {
|
public class TextureButton extends Element {
|
||||||
SaturnIdentifier sprite;
|
IdentifierRef sprite;
|
||||||
private Runnable onClick;
|
private Runnable onClick;
|
||||||
static int padding = 14;
|
static int padding = 14;
|
||||||
|
|
||||||
public TextureButton(SaturnIdentifier sprite, Runnable onClick) {
|
public TextureButton(IdentifierRef sprite, Runnable onClick) {
|
||||||
this.sprite = sprite;
|
this.sprite = sprite;
|
||||||
this.onClick = onClick;
|
this.onClick = onClick;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package org.saturnclient.ui.resources;
|
package org.saturnclient.ui.resources;
|
||||||
|
|
||||||
import org.saturnclient.common.MinecraftProvider;
|
import org.saturnclient.common.MinecraftProvider;
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
|
|
||||||
public class Fonts {
|
public class Fonts {
|
||||||
public static final SaturnIdentifier INTER = SaturnIdentifier.of("saturnclient", "inter");
|
public static final IdentifierRef INTER = IdentifierRef.of("saturnclient", "inter");
|
||||||
public static final SaturnIdentifier INTER_BOLD = SaturnIdentifier.of("saturnclient", "inter_bold");
|
public static final IdentifierRef INTER_BOLD = IdentifierRef.of("saturnclient", "inter_bold");
|
||||||
public static final SaturnIdentifier DEFAULT = SaturnIdentifier.ofVanilla("default");
|
public static final IdentifierRef DEFAULT = IdentifierRef.ofVanilla("default");
|
||||||
|
|
||||||
public static SaturnIdentifier getFont(int font) {
|
public static IdentifierRef getFont(int font) {
|
||||||
switch (font) {
|
switch (font) {
|
||||||
case 0:
|
case 0:
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ import com.kitfox.svg.SVGUniverse;
|
|||||||
|
|
||||||
import org.saturnclient.common.IMinecraftClient;
|
import org.saturnclient.common.IMinecraftClient;
|
||||||
import org.saturnclient.common.MinecraftProvider;
|
import org.saturnclient.common.MinecraftProvider;
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
|
|
||||||
public class SvgTexture {
|
public class SvgTexture {
|
||||||
|
|
||||||
private static List<SaturnIdentifier> svgCache = new ArrayList<>();
|
private static List<IdentifierRef> svgCache = new ArrayList<>();
|
||||||
|
|
||||||
private static BufferedImage renderSvg(InputStream svgStream, int width, int height) throws Exception {
|
private static BufferedImage renderSvg(InputStream svgStream, int width, int height) throws Exception {
|
||||||
// Load SVG
|
// Load SVG
|
||||||
@@ -50,8 +50,8 @@ public class SvgTexture {
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SaturnIdentifier getSvg(IMinecraftClient client, SaturnIdentifier svgImage, int width, int height) {
|
public static IdentifierRef getSvg(IMinecraftClient client, IdentifierRef svgImage, int width, int height) {
|
||||||
SaturnIdentifier id = SaturnIdentifier
|
IdentifierRef id = IdentifierRef
|
||||||
.of(svgImage.toString().replaceAll("\\.svg$", (width + "_" + height).toString() + ".png"));
|
.of(svgImage.toString().replaceAll("\\.svg$", (width + "_" + height).toString() + ".png"));
|
||||||
|
|
||||||
if (svgCache.contains(id)) {
|
if (svgCache.contains(id)) {
|
||||||
|
|||||||
@@ -1,84 +1,84 @@
|
|||||||
package org.saturnclient.ui.resources;
|
package org.saturnclient.ui.resources;
|
||||||
|
|
||||||
import org.saturnclient.common.bindings.SaturnIdentifier;
|
import org.saturnclient.common.ref.asset.IdentifierRef;
|
||||||
|
|
||||||
public class Textures {
|
public class Textures {
|
||||||
public static final SaturnIdentifier CROSSHAIR_RANGE = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef CROSSHAIR_RANGE = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/hud/crosshair_range.png");
|
"textures/gui/hud/crosshair_range.png");
|
||||||
public static final SaturnIdentifier COSMETICS = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef COSMETICS = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/cosmetics.png");
|
"textures/gui/components/cosmetics.png");
|
||||||
public static final SaturnIdentifier HUD_ICON = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef HUD_ICON = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/hud.png");
|
"textures/gui/components/hud.png");
|
||||||
public static final SaturnIdentifier SEARCH = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef SEARCH = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/search.png");
|
"textures/gui/components/search.png");
|
||||||
public static final SaturnIdentifier CLOSE = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef CLOSE = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/close.png");
|
"textures/gui/components/close.png");
|
||||||
public static final SaturnIdentifier MODS_TAB = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef MODS_TAB = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/mods_tab.png");
|
"textures/gui/components/mods_tab.png");
|
||||||
public static final SaturnIdentifier SETTINGS = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef SETTINGS = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/settings.png");
|
"textures/gui/components/settings.png");
|
||||||
public static final SaturnIdentifier CLOAK = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef CLOAK = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/cloak.png");
|
"textures/gui/components/cloak.png");
|
||||||
public static final SaturnIdentifier HAT = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef HAT = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/hat.png");
|
"textures/gui/components/hat.png");
|
||||||
public static final SaturnIdentifier RESET = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef RESET = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/reset.png");
|
"textures/gui/components/reset.png");
|
||||||
public static final SaturnIdentifier TOGGLE_INDICATOR = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef TOGGLE_INDICATOR = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/toggle_indicator.png");
|
"textures/gui/components/toggle_indicator.png");
|
||||||
public static final SaturnIdentifier LEFT = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef LEFT = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/left.png");
|
"textures/gui/components/left.png");
|
||||||
public static final SaturnIdentifier RIGHT = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef RIGHT = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/right.png");
|
"textures/gui/components/right.png");
|
||||||
public static final SaturnIdentifier STORE = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef STORE = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/store.png");
|
"textures/gui/components/store.png");
|
||||||
public static final SaturnIdentifier COINS = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef COINS = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/coins.png");
|
"textures/gui/components/coins.png");
|
||||||
public static final SaturnIdentifier SHIRT = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef SHIRT = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/shirt.png");
|
"textures/gui/components/shirt.png");
|
||||||
public static final SaturnIdentifier CIRCLE_X = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef CIRCLE_X = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/circle_x.png");
|
"textures/gui/components/circle_x.png");
|
||||||
public static final SaturnIdentifier INFO = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef INFO = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/info.png");
|
"textures/gui/components/info.png");
|
||||||
public static final SaturnIdentifier CHECK = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef CHECK = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/check.png");
|
"textures/gui/components/check.png");
|
||||||
|
|
||||||
public static final SaturnIdentifier LOGO = new SaturnIdentifier("saturnclient", "textures/logo/logo.png");
|
public static final IdentifierRef LOGO = new IdentifierRef("saturnclient", "textures/logo/logo.png");
|
||||||
public static final SaturnIdentifier REALISTIC_LOGO = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef REALISTIC_LOGO = new IdentifierRef("saturnclient",
|
||||||
"textures/logo/realistic.png");
|
"textures/logo/realistic.png");
|
||||||
public static final SaturnIdentifier LOGO_TEXT = new SaturnIdentifier("saturnclient", "textures/logo/text.png");
|
public static final IdentifierRef LOGO_TEXT = new IdentifierRef("saturnclient", "textures/logo/text.png");
|
||||||
public static final SaturnIdentifier LOGO_TEXT_BIG = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef LOGO_TEXT_BIG = new IdentifierRef("saturnclient",
|
||||||
"textures/logo/text_big.png");
|
"textures/logo/text_big.png");
|
||||||
public static final SaturnIdentifier SPLASH = new SaturnIdentifier("saturnclient", "textures/gui/splash.png");
|
public static final IdentifierRef SPLASH = new IdentifierRef("saturnclient", "textures/gui/splash.png");
|
||||||
|
|
||||||
// Widgets
|
// Widgets
|
||||||
public static final SaturnIdentifier BUTTON_BORDER = new SaturnIdentifier("saturnclient", "button_border");
|
public static final IdentifierRef BUTTON_BORDER = new IdentifierRef("saturnclient", "button_border");
|
||||||
public static final SaturnIdentifier BUTTON = new SaturnIdentifier("saturnclient", "button");
|
public static final IdentifierRef BUTTON = new IdentifierRef("saturnclient", "button");
|
||||||
public static final SaturnIdentifier BUTTON_OP = new SaturnIdentifier("saturnclient", "button_op");
|
public static final IdentifierRef BUTTON_OP = new IdentifierRef("saturnclient", "button_op");
|
||||||
public static final SaturnIdentifier SETTINGS_BG = new SaturnIdentifier("saturnclient", "settings_bg");
|
public static final IdentifierRef SETTINGS_BG = new IdentifierRef("saturnclient", "settings_bg");
|
||||||
public static final SaturnIdentifier RECT = new SaturnIdentifier("saturnclient", "rect");
|
public static final IdentifierRef RECT = new IdentifierRef("saturnclient", "rect");
|
||||||
public static final SaturnIdentifier RECT_BORDER = new SaturnIdentifier("saturnclient", "rect_border");
|
public static final IdentifierRef RECT_BORDER = new IdentifierRef("saturnclient", "rect_border");
|
||||||
public static final SaturnIdentifier MOD = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef MOD = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/mod.png");
|
"textures/gui/components/mod.png");
|
||||||
public static final SaturnIdentifier MOD_BG = new SaturnIdentifier("saturnclient",
|
public static final IdentifierRef MOD_BG = new IdentifierRef("saturnclient",
|
||||||
"textures/gui/components/mod_bg.png");
|
"textures/gui/components/mod_bg.png");
|
||||||
|
|
||||||
public static SaturnIdentifier getCloakPreview(String cloak) {
|
public static IdentifierRef getCloakPreview(String cloak) {
|
||||||
return new SaturnIdentifier("saturnclient",
|
return new IdentifierRef("saturnclient",
|
||||||
"textures/gui/cloak/" + (cloak.isEmpty() ? "none" : cloak) + ".png");
|
"textures/gui/cloak/" + (cloak.isEmpty() ? "none" : cloak) + ".png");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SaturnIdentifier getHatPreview(String hat) {
|
public static IdentifierRef getHatPreview(String hat) {
|
||||||
return new SaturnIdentifier("saturnclient",
|
return new IdentifierRef("saturnclient",
|
||||||
"textures/gui/hat/" + (hat.isEmpty() ? "none" : hat) + ".png");
|
"textures/gui/hat/" + (hat.isEmpty() ? "none" : hat) + ".png");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SaturnIdentifier getEmotePreview(String emote) {
|
public static IdentifierRef getEmotePreview(String emote) {
|
||||||
return new SaturnIdentifier("saturnclient",
|
return new IdentifierRef("saturnclient",
|
||||||
"textures/gui/emote/" + (emote == null ? "none" : emote) + ".png");
|
"textures/gui/emote/" + (emote == null ? "none" : emote) + ".png");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SaturnIdentifier getModIcon(String modId) {
|
public static IdentifierRef getModIcon(String modId) {
|
||||||
return new SaturnIdentifier("saturnclient", "textures/gui/mod/" + modId + ".svg");
|
return new IdentifierRef("saturnclient", "textures/gui/mod/" + modId + ".svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import org.saturnclient.modules.HudMod;
|
|||||||
import org.saturnclient.modules.ModDimensions;
|
import org.saturnclient.modules.ModDimensions;
|
||||||
import org.saturnclient.modules.ModManager;
|
import org.saturnclient.modules.ModManager;
|
||||||
import org.saturnclient.modules.Module;
|
import org.saturnclient.modules.Module;
|
||||||
import org.saturnclient.common.render.IMatrixStack;
|
import org.saturnclient.common.ref.render.MatrixStackRef;
|
||||||
import org.saturnclient.config.manager.ConfigManager;
|
import org.saturnclient.config.manager.ConfigManager;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
import org.saturnclient.ui.SaturnScreen;
|
import org.saturnclient.ui.SaturnScreen;
|
||||||
@@ -92,7 +92,7 @@ public class HudEditor extends SaturnScreen {
|
|||||||
public void render(RenderScope renderScope, int mouseX, int mouseY, float delta, long elapsed) {
|
public void render(RenderScope renderScope, int mouseX, int mouseY, float delta, long elapsed) {
|
||||||
for (HudMod mod : hudMods) {
|
for (HudMod mod : hudMods) {
|
||||||
ModDimensions dim = mod.getDimensions();
|
ModDimensions dim = mod.getDimensions();
|
||||||
IMatrixStack matrices = renderScope.getMatrixStack();
|
MatrixStackRef matrices = renderScope.getMatrixStack();
|
||||||
matrices.push();
|
matrices.push();
|
||||||
|
|
||||||
matrices.translate(dim.x.value, dim.y.value, 0);
|
matrices.translate(dim.x.value, dim.y.value, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user