Improved structure
This commit is contained in:
@@ -4,9 +4,13 @@ import java.io.File;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.saturnclient.common.minecraft.bindings.SaturnIdentifier;
|
import org.saturnclient.common.minecraft.bindings.SaturnIdentifier;
|
||||||
|
import org.saturnclient.common.minecraft.render.IWindow;
|
||||||
|
|
||||||
public interface IMinecraftClient {
|
public interface IMinecraftClient {
|
||||||
|
|
||||||
public File getRunDirectory();
|
public File getRunDirectory();
|
||||||
|
|
||||||
public InputStream getResource(SaturnIdentifier identifier);
|
public InputStream getResource(SaturnIdentifier identifier);
|
||||||
|
|
||||||
|
public IWindow getWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.saturnclient.common.minecraft.render;
|
||||||
|
|
||||||
|
public interface IWindow {
|
||||||
|
public int getWidth();
|
||||||
|
|
||||||
|
public int getHeight();
|
||||||
|
|
||||||
|
public int getFramebufferWidth();
|
||||||
|
|
||||||
|
public int getFramebufferHeight();
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import org.saturnclient.common.minecraft.bindings.SaturnIdentifier;
|
|||||||
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;
|
||||||
|
|
||||||
public class ImageTexture extends Element {
|
public class ImageTexture extends Element {
|
||||||
SaturnIdentifier sprite;
|
SaturnIdentifier sprite;
|
||||||
@@ -16,16 +17,16 @@ public class ImageTexture extends Element {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(RenderScope renderScope, ElementContext ctx) {
|
public void render(RenderScope renderScope, ElementContext ctx) {
|
||||||
// if (sprite.toString().endsWith(".svg")) {
|
if (sprite.toString().endsWith(".svg")) {
|
||||||
// IMinecraftClient client = MinecraftProvider.PROVIDER.getClient();
|
IMinecraftClient client = MinecraftProvider.PROVIDER.getClient();
|
||||||
|
|
||||||
// // Get the actual window pixel dimensions for the image
|
// Get the actual window pixel dimensions for the image
|
||||||
// int renderWidth = (int) (width * client.getWindow().getFramebufferWidth() / client.getWindow().getWidth());
|
int renderWidth = (int) (width * client.getWindow().getFramebufferWidth() / client.getWindow().getWidth());
|
||||||
// int renderHeight = (int) (height * client.getWindow().getFramebufferHeight()
|
int renderHeight = (int) (height * client.getWindow().getFramebufferHeight()
|
||||||
// / client.getWindow().getHeight());
|
/ client.getWindow().getHeight());
|
||||||
|
|
||||||
// sprite = SvgTexture.getSvg(client, sprite, renderWidth * 2, renderHeight * 2);
|
sprite = SvgTexture.getSvg(client, sprite, renderWidth * 2, renderHeight * 2);
|
||||||
// }
|
}
|
||||||
|
|
||||||
renderScope.drawTexture(sprite, 0, 0, 0, 0, width, height);
|
renderScope.drawTexture(sprite, 0, 0, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package org.saturnclient.saturnclient.impl;
|
package org.saturnclient.impl;
|
||||||
|
|
||||||
import org.saturnclient.saturnclient.SaturnClient;
|
import org.saturnclient.saturnclient.SaturnClient;
|
||||||
import net.minecraft.text.Style;
|
import net.minecraft.text.Style;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package org.saturnclient.saturnclient.impl;
|
package org.saturnclient.impl;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package org.saturnclient.saturnclient.mixin;
|
package org.saturnclient.impl.mixins;
|
||||||
|
|
||||||
import org.joml.Quaternionf;
|
import org.joml.Quaternionf;
|
||||||
import org.saturnclient.common.minecraft.bindings.SaturnQuaternionf;
|
import org.saturnclient.common.minecraft.bindings.SaturnQuaternionf;
|
||||||
+11
-1
@@ -1,14 +1,16 @@
|
|||||||
package org.saturnclient.saturnclient.mixin;
|
package org.saturnclient.impl.mixins;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.saturnclient.common.minecraft.IMinecraftClient;
|
import org.saturnclient.common.minecraft.IMinecraftClient;
|
||||||
import org.saturnclient.common.minecraft.bindings.SaturnIdentifier;
|
import org.saturnclient.common.minecraft.bindings.SaturnIdentifier;
|
||||||
|
import org.saturnclient.common.minecraft.render.IWindow;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.util.Window;
|
||||||
import net.minecraft.resource.ReloadableResourceManagerImpl;
|
import net.minecraft.resource.ReloadableResourceManagerImpl;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
@@ -17,6 +19,9 @@ public class MinecraftClientMixin implements IMinecraftClient {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public File runDirectory;
|
public File runDirectory;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private Window window;
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
public ReloadableResourceManagerImpl resourceManager;
|
public ReloadableResourceManagerImpl resourceManager;
|
||||||
|
|
||||||
@@ -33,4 +38,9 @@ public class MinecraftClientMixin implements IMinecraftClient {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IWindow getWindow() {
|
||||||
|
return (IWindow) (Object) this.window;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package org.saturnclient.impl.mixins;
|
||||||
|
|
||||||
|
import org.saturnclient.common.minecraft.render.IWindow;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
import net.minecraft.client.util.Window;
|
||||||
|
|
||||||
|
@Mixin(Window.class)
|
||||||
|
public abstract class WindowMixin implements IWindow {
|
||||||
|
@Shadow
|
||||||
|
public abstract int getWidth();
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public abstract int getHeight();
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public abstract int getFramebufferWidth();
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public abstract int getFramebufferHeight();
|
||||||
|
}
|
||||||
@@ -9,13 +9,13 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||||||
import org.saturnclient.cosmetics.Emotes;
|
import org.saturnclient.cosmetics.Emotes;
|
||||||
import org.saturnclient.cosmetics.cloak.Cloaks;
|
import org.saturnclient.cosmetics.cloak.Cloaks;
|
||||||
import org.saturnclient.cosmetics.hat.Hats;
|
import org.saturnclient.cosmetics.hat.Hats;
|
||||||
|
import org.saturnclient.impl.SaturnClientProvider;
|
||||||
import org.saturnclient.modules.ModManager;
|
import org.saturnclient.modules.ModManager;
|
||||||
import org.saturnclient.saturnclient.client.ServiceClient;
|
import org.saturnclient.saturnclient.client.ServiceClient;
|
||||||
import org.saturnclient.common.minecraft.MinecraftProvider;
|
import org.saturnclient.common.minecraft.MinecraftProvider;
|
||||||
import org.saturnclient.config.Config;
|
import org.saturnclient.config.Config;
|
||||||
import org.saturnclient.config.manager.ConfigManager;
|
import org.saturnclient.config.manager.ConfigManager;
|
||||||
import org.saturnclient.saturnclient.event.KeyInputHandler;
|
import org.saturnclient.saturnclient.event.KeyInputHandler;
|
||||||
import org.saturnclient.saturnclient.impl.SaturnClientProvider;
|
|
||||||
import org.saturnclient.saturnclient.mixin.DrawContextAccessor;
|
import org.saturnclient.saturnclient.mixin.DrawContextAccessor;
|
||||||
import org.saturnclient.ui.ElementRenderer;
|
import org.saturnclient.ui.ElementRenderer;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public class RenderScopeImpl implements RenderScope {
|
|||||||
matrices.translate(x, y + (i * Fonts.getHeight()), 0);
|
matrices.translate(x, y + (i * Fonts.getHeight()), 0);
|
||||||
matrices.scale(scale, scale, 1.0f);
|
matrices.scale(scale, scale, 1.0f);
|
||||||
TextRenderer textRenderer = SaturnClient.client.textRenderer;
|
TextRenderer textRenderer = SaturnClient.client.textRenderer;
|
||||||
textRenderer.draw(org.saturnclient.saturnclient.impl.Fonts.setFont(line, font), 0,
|
textRenderer.draw(org.saturnclient.impl.Fonts.setFont(line, font), 0,
|
||||||
font == 0 ? 1 : 7, color, false,
|
font == 0 ? 1 : 7, color, false,
|
||||||
this.matrices.peek().getPositionMatrix(),
|
this.matrices.peek().getPositionMatrix(),
|
||||||
this.vertexConsumers, TextLayerType.NORMAL, 0, 15728880);
|
this.vertexConsumers, TextLayerType.NORMAL, 0, 15728880);
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"saturnclient.mixins.json",
|
"saturnclient.mixins.json",
|
||||||
"mods.mixins.json"
|
"mods.mixins.json",
|
||||||
|
"impl.mixins.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=${loader_version}",
|
"fabricloader": ">=${loader_version}",
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"minVersion": "0.8",
|
||||||
|
"package": "org.saturnclient.impl.mixins",
|
||||||
|
"compatibilityLevel": "JAVA_21",
|
||||||
|
"client": [
|
||||||
|
"MinecraftClientMixin",
|
||||||
|
"MatrixStackMixin",
|
||||||
|
"WindowMixin"
|
||||||
|
],
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,9 +10,7 @@
|
|||||||
"WhoAmI",
|
"WhoAmI",
|
||||||
"DrawContextAccessor",
|
"DrawContextAccessor",
|
||||||
"SplashOverlayMixin",
|
"SplashOverlayMixin",
|
||||||
"SetScreenMixin",
|
"SetScreenMixin"
|
||||||
"MinecraftClientMixin",
|
|
||||||
"MatrixStackMixin"
|
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
Reference in New Issue
Block a user