Temporarily fized 1.21.4
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ package org.saturnclient.common.minecraft.bindings;
|
|||||||
import org.saturnclient.common.minecraft.MinecraftBinding;
|
import org.saturnclient.common.minecraft.MinecraftBinding;
|
||||||
|
|
||||||
public class SaturnItemStack extends MinecraftBinding {
|
public class SaturnItemStack extends MinecraftBinding {
|
||||||
SaturnItemStack(Object binding) {
|
public SaturnItemStack(Object binding) {
|
||||||
super(binding);
|
super(binding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package org.saturnclient.common.minecraft.bindings;
|
|||||||
import org.saturnclient.common.minecraft.MinecraftBinding;
|
import org.saturnclient.common.minecraft.MinecraftBinding;
|
||||||
|
|
||||||
public class SaturnSprite extends MinecraftBinding {
|
public class SaturnSprite extends MinecraftBinding {
|
||||||
SaturnSprite(Object binding) {
|
public SaturnSprite(Object binding) {
|
||||||
super(binding);
|
super(binding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ package org.saturnclient.ui;
|
|||||||
import org.saturnclient.common.minecraft.bindings.SaturnIdentifier;
|
import org.saturnclient.common.minecraft.bindings.SaturnIdentifier;
|
||||||
import org.saturnclient.common.minecraft.bindings.SaturnItemStack;
|
import org.saturnclient.common.minecraft.bindings.SaturnItemStack;
|
||||||
import org.saturnclient.common.minecraft.bindings.SaturnSprite;
|
import org.saturnclient.common.minecraft.bindings.SaturnSprite;
|
||||||
|
import org.saturnclient.common.minecraft.render.IMatrixStack;
|
||||||
|
|
||||||
public interface RenderScope {
|
public interface RenderScope {
|
||||||
|
public IMatrixStack getMatrixStack();
|
||||||
|
|
||||||
public void setOpacity(float alpha);
|
public void setOpacity(float alpha);
|
||||||
|
|
||||||
public int getColor(int color);
|
public int getColor(int color);
|
||||||
|
|||||||
@@ -51,13 +51,12 @@ public class Utils {
|
|||||||
return (index >= 0 && index < list.size()) ? list.get(index) : null;
|
return (index >= 0 && index < list.size()) ? list.get(index) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static void notify(NotificationKind kind, String title, String toast)
|
// public static void notify(NotificationKind kind, String title, String toast) {
|
||||||
// {
|
// if (SaturnClient.client.currentScreen instanceof SaturnScreen) {
|
||||||
// if (SaturnClient.client.currentScreen instanceof SaturnScreen) {
|
// ((SaturnScreen) SaturnClient.client.currentScreen)
|
||||||
// ((SaturnScreen) SaturnClient.client.currentScreen)
|
// .draw(new Notification(SaturnClient.client.currentScreen.width,
|
||||||
// .draw(new Notification(SaturnClient.client.currentScreen.width,
|
// SaturnClient.client.currentScreen.height, kind,
|
||||||
// SaturnClient.client.currentScreen.height, kind,
|
// title, toast));
|
||||||
// title, toast));
|
// }
|
||||||
// }
|
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class Scroll extends Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Element element) {
|
public void draw(Element element) {
|
||||||
ElementRenderer.draw(children, element);
|
// ElementRenderer.draw(children, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -36,14 +36,14 @@ public class Scroll extends Element {
|
|||||||
Theme.BG_RADIUS.value, Theme.BACKGROUND.value);
|
Theme.BG_RADIUS.value, Theme.BACKGROUND.value);
|
||||||
|
|
||||||
renderScope.enableScissor(padding, padding, width - padding, height - padding);
|
renderScope.enableScissor(padding, padding, width - padding, height - padding);
|
||||||
renderScope.matrices.push();
|
renderScope.getMatrixStack().push();
|
||||||
renderScope.matrices.translate(padding, -scroll + padding, 0);
|
renderScope.getMatrixStack().translate(padding, -scroll + padding, 0);
|
||||||
|
|
||||||
ElementRenderer.render(children, ctx.elapsed, renderScope,
|
// ElementRenderer.render(children, ctx.elapsed, renderScope,
|
||||||
ctx.mouseX - padding,
|
// ctx.mouseX - padding,
|
||||||
ctx.mouseY - padding + scroll);
|
// ctx.mouseY - padding + scroll);
|
||||||
|
|
||||||
renderScope.matrices.pop();
|
renderScope.getMatrixStack().pop();
|
||||||
renderScope.disableScissor();
|
renderScope.disableScissor();
|
||||||
|
|
||||||
if (maxScroll > 0) {
|
if (maxScroll > 0) {
|
||||||
@@ -110,21 +110,21 @@ public class Scroll extends Element {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(int keyCode, int scanCode, int modifiers) {
|
public void keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||||
ElementRenderer.keyPressed(children, keyCode, scanCode, modifiers);
|
// ElementRenderer.keyPressed(children, keyCode, scanCode, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(double mouseX, double mouseY, int button) {
|
public void mouseClicked(double mouseX, double mouseY, int button) {
|
||||||
ElementRenderer.mouseClicked(children, mouseX - padding, mouseY - padding + scroll, button);
|
// ElementRenderer.mouseClicked(children, mouseX - padding, mouseY - padding + scroll, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
public void mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
||||||
ElementRenderer.mouseDragged(children, mouseX - padding, mouseY - padding + scroll, button, deltaX, deltaY);
|
// ElementRenderer.mouseDragged(children, mouseX - padding, mouseY - padding + scroll, button, deltaX, deltaY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(double mouseX, double mouseY, int button) {
|
public void mouseReleased(double mouseX, double mouseY, int button) {
|
||||||
ElementRenderer.mouseReleased(children, mouseX - padding, mouseY - padding + scroll, button);
|
// ElementRenderer.mouseReleased(children, mouseX - padding, mouseY - padding + scroll, button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +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.saturnclient.SaturnClient;
|
import org.saturnclient.saturnclient.SaturnClient;
|
||||||
|
import org.saturnclient.common.minecraft.bindings.SaturnItemStack;
|
||||||
import org.saturnclient.config.manager.Property;
|
import org.saturnclient.config.manager.Property;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
|
|
||||||
@@ -32,30 +33,30 @@ public class ArmorDisplay extends Module implements HudMod {
|
|||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
if (useMainHand.value && !mainHand.isEmpty()) {
|
if (useMainHand.value && !mainHand.isEmpty()) {
|
||||||
scope.drawItem(mainHand, 0, 15 * row);
|
scope.drawItem(new SaturnItemStack(mainHand), 0, 15 * row);
|
||||||
renderHealth(scope, row, mainHand.getMaxDamage(), mainHand.getDamage());
|
renderHealth(scope, row, mainHand.getMaxDamage(), mainHand.getDamage());
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!helmet.isEmpty()) {
|
if (!helmet.isEmpty()) {
|
||||||
scope.drawItem(helmet, 0, 15 * row);
|
scope.drawItem(new SaturnItemStack(helmet), 0, 15 * row);
|
||||||
renderHealth(scope, row, helmet.getMaxDamage(), helmet.getDamage());
|
renderHealth(scope, row, helmet.getMaxDamage(), helmet.getDamage());
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chestplate.isEmpty()) {
|
if (!chestplate.isEmpty()) {
|
||||||
scope.drawItem(chestplate, 0, 15 * row);
|
scope.drawItem(new SaturnItemStack(chestplate), 0, 15 * row);
|
||||||
renderHealth(scope, row, chestplate.getMaxDamage(), chestplate.getDamage());
|
renderHealth(scope, row, chestplate.getMaxDamage(), chestplate.getDamage());
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
if (!leggings.isEmpty()) {
|
if (!leggings.isEmpty()) {
|
||||||
scope.drawItem(leggings, 0, 15 * row);
|
scope.drawItem(new SaturnItemStack(leggings), 0, 15 * row);
|
||||||
renderHealth(scope, row, leggings.getMaxDamage(), leggings.getDamage());
|
renderHealth(scope, row, leggings.getMaxDamage(), leggings.getDamage());
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!boots.isEmpty()) {
|
if (!boots.isEmpty()) {
|
||||||
scope.drawItem(boots, 0, 15 * row);
|
scope.drawItem(new SaturnItemStack(boots), 0, 15 * row);
|
||||||
renderHealth(scope, row, boots.getMaxDamage(), boots.getDamage());
|
renderHealth(scope, row, boots.getMaxDamage(), boots.getDamage());
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import org.saturnclient.config.manager.Property;
|
|||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
import org.saturnclient.ui.resources.Textures;
|
import org.saturnclient.ui.resources.Textures;
|
||||||
|
|
||||||
import net.minecraft.client.render.RenderLayer;
|
|
||||||
|
|
||||||
public class Crosshair extends Module {
|
public class Crosshair extends Module {
|
||||||
public static Property<Boolean> enabled = Property.bool(false);
|
public static Property<Boolean> enabled = Property.bool(false);
|
||||||
|
|
||||||
@@ -29,7 +27,6 @@ public class Crosshair extends Module {
|
|||||||
int scaledWidth = 15;
|
int scaledWidth = 15;
|
||||||
int scaledHeight = 15;
|
int scaledHeight = 15;
|
||||||
|
|
||||||
scope.setRenderLayer(RenderLayer::getCrosshair);
|
|
||||||
scope.drawTexture(Textures.CROSSHAIR_RANGE,
|
scope.drawTexture(Textures.CROSSHAIR_RANGE,
|
||||||
(scope.getScaledWindowWidth() - scaledWidth) / 2,
|
(scope.getScaledWindowWidth() - scaledWidth) / 2,
|
||||||
(scope.getScaledWindowHeight() - scaledHeight) / 2, 0.0F, 0.0F, scaledWidth, scaledHeight);
|
(scope.getScaledWindowHeight() - scaledHeight) / 2, 0.0F, 0.0F, scaledWidth, scaledHeight);
|
||||||
|
|||||||
@@ -7,6 +7,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.saturnclient.SaturnClient;
|
import org.saturnclient.saturnclient.SaturnClient;
|
||||||
|
import org.saturnclient.common.minecraft.bindings.SaturnSprite;
|
||||||
import org.saturnclient.config.manager.Property;
|
import org.saturnclient.config.manager.Property;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ public class StatusEffects extends Module implements HudMod {
|
|||||||
if (effect.shouldShowIcon()) {
|
if (effect.shouldShowIcon()) {
|
||||||
RegistryEntry<StatusEffect> registryEntry = effect.getEffectType();
|
RegistryEntry<StatusEffect> registryEntry = effect.getEffectType();
|
||||||
Sprite sprite = statusEffectSpriteManager.getSprite(registryEntry);
|
Sprite sprite = statusEffectSpriteManager.getSprite(registryEntry);
|
||||||
scope.drawSpriteStretched(sprite, 0, 18 * row, 16, 16);
|
scope.drawSpriteStretched(new SaturnSprite(sprite), 0, 18 * row, 16, 16);
|
||||||
scope.drawText(0.5f, getDurationAsString(effect), 18, 18 * row + 3, dimensions.font.value, -1);
|
scope.drawText(0.5f, getDurationAsString(effect), 18, 18 * row + 3, dimensions.font.value, -1);
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.saturnclient.saturnclient.SaturnClient;
|
|||||||
import org.saturnclient.saturnclient.menus.HudEditor;
|
import org.saturnclient.saturnclient.menus.HudEditor;
|
||||||
import org.saturnclient.saturnclient.mixin.DrawContextAccessor;
|
import org.saturnclient.saturnclient.mixin.DrawContextAccessor;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
|
import org.saturnclient.ui.RenderScopeImpl;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
@@ -15,7 +16,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
import net.minecraft.client.font.TextRenderer;
|
import net.minecraft.client.font.TextRenderer;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.hud.InGameHud;
|
import net.minecraft.client.gui.hud.InGameHud;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
|
||||||
import net.minecraft.client.render.RenderTickCounter;
|
import net.minecraft.client.render.RenderTickCounter;
|
||||||
|
|
||||||
@Mixin(InGameHud.class)
|
@Mixin(InGameHud.class)
|
||||||
@@ -26,29 +26,27 @@ public class RenderMixin {
|
|||||||
|
|
||||||
if (textRenderer != null &&
|
if (textRenderer != null &&
|
||||||
!(SaturnClient.client.currentScreen instanceof HudEditor)) {
|
!(SaturnClient.client.currentScreen instanceof HudEditor)) {
|
||||||
RenderScope renderScope = new RenderScope(context.getMatrices(),
|
RenderScope renderScope = new RenderScopeImpl(context.getMatrices(),
|
||||||
((DrawContextAccessor) context).getVertexConsumers());
|
((DrawContextAccessor) context).getVertexConsumers());
|
||||||
|
|
||||||
for (org.saturnclient.modules.Module m : ModManager.ENABLED_MODS) {
|
for (org.saturnclient.modules.Module m : ModManager.ENABLED_MODS) {
|
||||||
if (m instanceof HudMod && m.isEnabled()) {
|
if (m instanceof HudMod && m.isEnabled()) {
|
||||||
ModDimensions dim = ((HudMod) m).getDimensions();
|
ModDimensions dim = ((HudMod) m).getDimensions();
|
||||||
|
|
||||||
renderScope.matrices.push();
|
renderScope.getMatrixStack().push();
|
||||||
|
|
||||||
renderScope.matrices.translate(dim.x.value, (float) dim.y.value, 0);
|
renderScope.getMatrixStack().translate(dim.x.value, (float) dim.y.value, 0);
|
||||||
|
|
||||||
renderScope.matrices.scale(dim.scale.value, dim.scale.value, 1.0f);
|
renderScope.getMatrixStack().scale(dim.scale.value, dim.scale.value, 1.0f);
|
||||||
|
|
||||||
if (dim.renderBackground) {
|
if (dim.renderBackground) {
|
||||||
renderScope.drawRoundedRectangle(0, 0, dim.width, dim.height, dim.radius.value,
|
renderScope.drawRoundedRectangle(0, 0, dim.width, dim.height, dim.radius.value,
|
||||||
dim.bgColor.value);
|
dim.bgColor.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderScope.setRenderLayer(RenderLayer::getGuiTextured);
|
|
||||||
|
|
||||||
((HudMod) m).renderHud(renderScope);
|
((HudMod) m).renderHud(renderScope);
|
||||||
|
|
||||||
renderScope.matrices.pop();
|
renderScope.getMatrixStack().pop();
|
||||||
} else {
|
} else {
|
||||||
m.render(renderScope);
|
m.render(renderScope);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.saturnclient.saturnclient.event.KeyInputHandler;
|
|||||||
import org.saturnclient.saturnclient.impl.SaturnClientProvider;
|
import org.saturnclient.saturnclient.impl.SaturnClientProvider;
|
||||||
import org.saturnclient.saturnclient.mixin.DrawContextAccessor;
|
import org.saturnclient.saturnclient.mixin.DrawContextAccessor;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
|
import org.saturnclient.ui.RenderScopeImpl;
|
||||||
import org.saturnclient.ui.SaturnScreen;
|
import org.saturnclient.ui.SaturnScreen;
|
||||||
import org.saturnclient.ui.elements.ImageTexture;
|
import org.saturnclient.ui.elements.ImageTexture;
|
||||||
import org.saturnclient.ui.resources.Textures;
|
import org.saturnclient.ui.resources.Textures;
|
||||||
@@ -57,7 +58,7 @@ public class SaturnClient implements ModInitializer {
|
|||||||
.position(screen.width - 180 - 20, screen.height - 18 - 20));
|
.position(screen.width - 180 - 20, screen.height - 18 - 20));
|
||||||
} else {
|
} else {
|
||||||
ScreenEvents.afterRender(screen).register((screen1, context, mouseX, mouseY, tickDelta) -> {
|
ScreenEvents.afterRender(screen).register((screen1, context, mouseX, mouseY, tickDelta) -> {
|
||||||
RenderScope renderScope = new RenderScope(context.getMatrices(),
|
RenderScope renderScope = new RenderScopeImpl(context.getMatrices(),
|
||||||
((DrawContextAccessor) context).getVertexConsumers());
|
((DrawContextAccessor) context).getVertexConsumers());
|
||||||
|
|
||||||
int width = context.getScaledWindowWidth();
|
int width = context.getScaledWindowWidth();
|
||||||
|
|||||||
+14
-5
@@ -1,22 +1,26 @@
|
|||||||
package org.saturnclient.saturnclient.impl;
|
package org.saturnclient.saturnclient.impl;
|
||||||
|
|
||||||
import java.io.File;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
import org.saturnclient.common.minecraft.IMinecraftClient;
|
||||||
import org.saturnclient.common.minecraft.MinecraftProvider;
|
import org.saturnclient.common.minecraft.MinecraftProvider;
|
||||||
|
import org.saturnclient.common.minecraft.bindings.SaturnIdentifier;
|
||||||
|
import org.saturnclient.cosmetics.cloak.utils.IdentifierUtils;
|
||||||
import org.saturnclient.saturnclient.SaturnClient;
|
import org.saturnclient.saturnclient.SaturnClient;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class SaturnClientProvider extends MinecraftProvider {
|
public class SaturnClientProvider extends MinecraftProvider {
|
||||||
@Override
|
@Override
|
||||||
public Object createIdentifier(String namespace, String path) {
|
public IMinecraftClient getClient() {
|
||||||
return Identifier.of(namespace, path);
|
return (IMinecraftClient) MinecraftClient.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getRunDirectory() {
|
public Object createIdentifier(String namespace, String path) {
|
||||||
return SaturnClient.client.runDirectory;
|
return Identifier.of(namespace, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -29,4 +33,9 @@ public class SaturnClientProvider extends MinecraftProvider {
|
|||||||
public int getWidth(String text, int font) {
|
public int getWidth(String text, int font) {
|
||||||
return Fonts.getWidth(text, font);
|
return Fonts.getWidth(text, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerBufferedImageTexture(SaturnIdentifier i, BufferedImage bi) {
|
||||||
|
IdentifierUtils.registerBufferedImageTextureFast((Identifier) i.inner, bi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.saturnclient.modules.Module;
|
|||||||
import org.saturnclient.config.manager.ConfigManager;
|
import org.saturnclient.config.manager.ConfigManager;
|
||||||
import org.saturnclient.saturnclient.mixin.DrawContextAccessor;
|
import org.saturnclient.saturnclient.mixin.DrawContextAccessor;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
|
import org.saturnclient.ui.RenderScopeImpl;
|
||||||
import org.saturnclient.ui.SaturnScreen;
|
import org.saturnclient.ui.SaturnScreen;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -95,7 +96,7 @@ public class HudEditor extends Screen {
|
|||||||
SaturnScreen.ROTATING_PANORAMA_RENDERER.render(context, this.width, this.height, 1.0F, delta);
|
SaturnScreen.ROTATING_PANORAMA_RENDERER.render(context, this.width, this.height, 1.0F, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderScope scope = new RenderScope(context.getMatrices(),
|
RenderScope scope = new RenderScopeImpl(context.getMatrices(),
|
||||||
((DrawContextAccessor) context).getVertexConsumers());
|
((DrawContextAccessor) context).getVertexConsumers());
|
||||||
|
|
||||||
for (HudMod mod : hudMods) {
|
for (HudMod mod : hudMods) {
|
||||||
|
|||||||
+2
-3
@@ -5,6 +5,7 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
import org.saturnclient.config.Theme;
|
import org.saturnclient.config.Theme;
|
||||||
import org.saturnclient.ui.RenderScope;
|
import org.saturnclient.ui.RenderScope;
|
||||||
|
import org.saturnclient.ui.RenderScopeImpl;
|
||||||
import org.saturnclient.ui.resources.Textures;
|
import org.saturnclient.ui.resources.Textures;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
@@ -14,7 +15,6 @@ import org.spongepowered.asm.mixin.Final;
|
|||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.screen.SplashOverlay;
|
import net.minecraft.client.gui.screen.SplashOverlay;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
|
||||||
import net.minecraft.resource.ResourceReload;
|
import net.minecraft.resource.ResourceReload;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
@@ -74,8 +74,7 @@ public abstract class SplashOverlayMixin {
|
|||||||
: -1f;
|
: -1f;
|
||||||
|
|
||||||
// Get render scope for better UI
|
// Get render scope for better UI
|
||||||
RenderScope scope = new RenderScope(context);
|
RenderScope scope = new RenderScopeImpl(context);
|
||||||
scope.setRenderLayer(RenderLayer::getGuiTextured);
|
|
||||||
|
|
||||||
// Draw background overlay
|
// Draw background overlay
|
||||||
if (fadeOutProgress >= 1.0F) {
|
if (fadeOutProgress >= 1.0F) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
|||||||
import org.saturnclient.common.minecraft.bindings.SaturnIdentifier;
|
import org.saturnclient.common.minecraft.bindings.SaturnIdentifier;
|
||||||
import org.saturnclient.common.minecraft.bindings.SaturnItemStack;
|
import org.saturnclient.common.minecraft.bindings.SaturnItemStack;
|
||||||
import org.saturnclient.common.minecraft.bindings.SaturnSprite;
|
import org.saturnclient.common.minecraft.bindings.SaturnSprite;
|
||||||
|
import org.saturnclient.common.minecraft.render.IMatrixStack;
|
||||||
import org.saturnclient.saturnclient.SaturnClient;
|
import org.saturnclient.saturnclient.SaturnClient;
|
||||||
import org.saturnclient.saturnclient.mixin.DrawContextAccessor;
|
import org.saturnclient.saturnclient.mixin.DrawContextAccessor;
|
||||||
import org.saturnclient.ui.resources.Fonts;
|
import org.saturnclient.ui.resources.Fonts;
|
||||||
@@ -58,6 +59,11 @@ public class RenderScopeImpl implements RenderScope {
|
|||||||
this.itemRenderState = new ItemRenderState();
|
this.itemRenderState = new ItemRenderState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMatrixStack getMatrixStack() {
|
||||||
|
return (IMatrixStack) matrices;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOpacity(float alpha) {
|
public void setOpacity(float alpha) {
|
||||||
this.opacity = (int) (alpha * 255) << 24;
|
this.opacity = (int) (alpha * 255) << 24;
|
||||||
|
|||||||
@@ -97,13 +97,13 @@ public abstract class SaturnScreen extends Screen {
|
|||||||
RenderScope renderScope = new RenderScopeImpl(context.getMatrices(),
|
RenderScope renderScope = new RenderScopeImpl(context.getMatrices(),
|
||||||
((DrawContextAccessor) context).getVertexConsumers());
|
((DrawContextAccessor) context).getVertexConsumers());
|
||||||
|
|
||||||
renderScope.matrices.push();
|
renderScope.getMatrixStack().push();
|
||||||
|
|
||||||
renderScope.matrices.scale(0.5f, 0.5f, 0.5f);
|
renderScope.getMatrixStack().scale(0.5f, 0.5f, 0.5f);
|
||||||
|
|
||||||
ElementRenderer.render(new ArrayList<>(elements), elapsed, renderScope, mouseX, mouseY);
|
ElementRenderer.render(new ArrayList<>(elements), elapsed, renderScope, mouseX, mouseY);
|
||||||
|
|
||||||
renderScope.matrices.pop();
|
renderScope.getMatrixStack().pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,18 +6,15 @@ 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 net.minecraft.client.render.RenderLayer;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
|
|
||||||
public class CosmeticPreview extends Element {
|
public class CosmeticPreview extends Element {
|
||||||
static int padding = 14;
|
static int padding = 14;
|
||||||
|
|
||||||
Identifier sprite;
|
SaturnIdentifier 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, SaturnIdentifier sprite, Runnable onClick) {
|
||||||
this.sprite = (Identifier) sprite.inner;
|
this.sprite = sprite;
|
||||||
this.onClick = onClick;
|
this.onClick = onClick;
|
||||||
this.isSelected = isSelected;
|
this.isSelected = isSelected;
|
||||||
|
|
||||||
@@ -30,8 +27,6 @@ public class CosmeticPreview extends Element {
|
|||||||
renderScope.drawRoundedRectangle(0, 0, width, height, Theme.WIDGET_RADIUS.value,
|
renderScope.drawRoundedRectangle(0, 0, width, height, Theme.WIDGET_RADIUS.value,
|
||||||
isSelected ? Theme.ACCENT.value : Theme.PRIMARY.value);
|
isSelected ? Theme.ACCENT.value : Theme.PRIMARY.value);
|
||||||
|
|
||||||
renderScope.setRenderLayer(RenderLayer::getGuiTextured);
|
|
||||||
|
|
||||||
int texWidth = width - padding;
|
int texWidth = width - padding;
|
||||||
int texHeight = height - padding;
|
int texHeight = height - padding;
|
||||||
|
|
||||||
|
|||||||
@@ -23,13 +23,12 @@ public class ElementRenderer {
|
|||||||
for (Element element : elements) {
|
for (Element element : elements) {
|
||||||
element.playAnimationFrame(elapsed);
|
element.playAnimationFrame(elapsed);
|
||||||
|
|
||||||
renderScope.matrices.push();
|
renderScope.getMatrixStack().push();
|
||||||
renderScope.setOpacity(element.opacity);
|
renderScope.setOpacity(element.opacity);
|
||||||
renderScope.matrices.translate(element.x, element.y, 0);
|
renderScope.getMatrixStack().translate(element.x, element.y, 0);
|
||||||
renderScope.matrices.scale(element.scale, element.scale, 1.0f);
|
renderScope.getMatrixStack().scale(element.scale, element.scale, 1.0f);
|
||||||
element.render(renderScope, new ElementContext(elapsed, mouseX, mouseY, element));
|
element.render(renderScope, new ElementContext(elapsed, mouseX, mouseY, element));
|
||||||
renderScope.matrices.pop();
|
renderScope.getMatrixStack().pop();
|
||||||
renderScope.setRenderLayer(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,155 +11,151 @@ import org.saturnclient.ui.resources.Fonts;
|
|||||||
import org.saturnclient.ui.resources.Textures;
|
import org.saturnclient.ui.resources.Textures;
|
||||||
import org.saturnclient.ui.screens.ConfigEditor;
|
import org.saturnclient.ui.screens.ConfigEditor;
|
||||||
|
|
||||||
import net.minecraft.client.render.RenderLayer;
|
|
||||||
|
|
||||||
public class SaturnModule extends Element {
|
public class SaturnModule extends Element {
|
||||||
|
|
||||||
private final Module mod;
|
private final Module mod;
|
||||||
|
|
||||||
static int p = 10; // padding
|
static int p = 10; // padding
|
||||||
static int s = 14; // settings icon size
|
static int s = 14; // settings icon size
|
||||||
static int expand = 5; // settings icon click area
|
static int expand = 5; // settings icon click area
|
||||||
|
|
||||||
public SaturnModule(Module mod) {
|
public SaturnModule(Module mod) {
|
||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
this.width = 160;
|
this.width = 160;
|
||||||
this.height = 50;
|
this.height = 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(RenderScope renderScope, ElementContext ctx) {
|
||||||
|
boolean hovered = ctx.isHovering();
|
||||||
|
boolean enabled = mod.isEnabled();
|
||||||
|
|
||||||
|
int iconX = width - s - p;
|
||||||
|
int iconY = height - s - p;
|
||||||
|
|
||||||
|
boolean settingsHover = ctx.isHovering(
|
||||||
|
getSettingsX(),
|
||||||
|
getSettingsY(),
|
||||||
|
getSettingsHitBox(),
|
||||||
|
getSettingsHitBox());
|
||||||
|
|
||||||
|
// Resolve theme colors
|
||||||
|
int bgColor = Theme.PRIMARY.value;
|
||||||
|
int fgColor = hovered && !settingsHover ? Theme.ACCENT.value : Theme.PRIMARY_FG.value;
|
||||||
|
|
||||||
|
int iconBg = enabled ? Theme.ACCENT.value : Theme.PRIMARY.value;
|
||||||
|
int iconFg = enabled ? Theme.ACCENT_FG.value : fgColor;
|
||||||
|
|
||||||
|
int settingsColor = settingsHover
|
||||||
|
? Theme.ACCENT.value
|
||||||
|
: Theme.withAlpha(160, fgColor);
|
||||||
|
|
||||||
|
int h = height - (p * 2);
|
||||||
|
|
||||||
|
// Main background
|
||||||
|
renderScope.drawRoundedRectangle(
|
||||||
|
0, 0,
|
||||||
|
width, height,
|
||||||
|
Theme.WIDGET_RADIUS.value,
|
||||||
|
bgColor);
|
||||||
|
|
||||||
|
// Icon background
|
||||||
|
renderScope.drawRoundedRectangle(
|
||||||
|
p, p,
|
||||||
|
h, h,
|
||||||
|
Theme.WIDGET_RADIUS.value,
|
||||||
|
iconBg);
|
||||||
|
|
||||||
|
// Icon
|
||||||
|
renderScope.drawTexture(
|
||||||
|
mod.getIconTexture(),
|
||||||
|
p + (p / 2),
|
||||||
|
p + (p / 2),
|
||||||
|
0, 0,
|
||||||
|
h - p,
|
||||||
|
h - p,
|
||||||
|
iconFg);
|
||||||
|
|
||||||
|
// Module name
|
||||||
|
renderScope.drawText(
|
||||||
|
0.6f,
|
||||||
|
mod.getName(),
|
||||||
|
p + h + 4,
|
||||||
|
p + 1,
|
||||||
|
Theme.FONT.value,
|
||||||
|
fgColor);
|
||||||
|
|
||||||
|
// Version (right aligned)
|
||||||
|
String version = mod.getVersion();
|
||||||
|
int versionWidth = (int) (Fonts.getWidth(version, Theme.FONT.value) * 0.35f);
|
||||||
|
|
||||||
|
renderScope.drawText(
|
||||||
|
0.35f,
|
||||||
|
version,
|
||||||
|
width - p - versionWidth,
|
||||||
|
p + 1,
|
||||||
|
Theme.FONT.value,
|
||||||
|
fgColor);
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
int xt = p + h + 4;
|
||||||
|
for (String tag : mod.getTags()) {
|
||||||
|
int tagWidth = (int) (Fonts.getWidth(tag, Theme.FONT.value) * 0.4f);
|
||||||
|
|
||||||
|
renderScope.drawRoundedRectangle(
|
||||||
|
xt,
|
||||||
|
p + (h / 2),
|
||||||
|
tagWidth + 6,
|
||||||
|
12,
|
||||||
|
5,
|
||||||
|
Theme.ACCENT.value);
|
||||||
|
|
||||||
|
renderScope.drawText(
|
||||||
|
0.4f,
|
||||||
|
tag,
|
||||||
|
xt + 2,
|
||||||
|
p + (h / 2) + 3,
|
||||||
|
Theme.FONT.value,
|
||||||
|
Theme.ACCENT_FG.value);
|
||||||
|
|
||||||
|
xt += tagWidth + 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// Settings icon
|
||||||
public void render(RenderScope renderScope, ElementContext ctx) {
|
renderScope.drawTexture(
|
||||||
boolean hovered = ctx.isHovering();
|
Textures.SETTINGS,
|
||||||
boolean enabled = mod.isEnabled();
|
iconX,
|
||||||
|
iconY,
|
||||||
|
0, 0,
|
||||||
|
s, s,
|
||||||
|
settingsColor);
|
||||||
|
}
|
||||||
|
|
||||||
int iconX = width - s - p;
|
@Override
|
||||||
int iconY = height - s - p;
|
public void click(int mouseX, int mouseY) {
|
||||||
|
boolean settingsHover = Utils.isHovering(
|
||||||
|
mouseX - getSettingsX(),
|
||||||
|
mouseY - getSettingsY(),
|
||||||
|
getSettingsHitBox(),
|
||||||
|
getSettingsHitBox(),
|
||||||
|
1.0f);
|
||||||
|
|
||||||
boolean settingsHover = ctx.isHovering(
|
if (settingsHover) {
|
||||||
getSettingsX(),
|
SaturnClient.client.setScreen(new ConfigEditor(mod.getConfig()));
|
||||||
getSettingsY(),
|
} else {
|
||||||
getSettingsHitBox(),
|
mod.setEnabled(!mod.isEnabled());
|
||||||
getSettingsHitBox());
|
|
||||||
|
|
||||||
renderScope.setRenderLayer(RenderLayer::getGuiTextured);
|
|
||||||
|
|
||||||
// Resolve theme colors
|
|
||||||
int bgColor = Theme.PRIMARY.value;
|
|
||||||
int fgColor = hovered && !settingsHover ? Theme.ACCENT.value : Theme.PRIMARY_FG.value;
|
|
||||||
|
|
||||||
int iconBg = enabled ? Theme.ACCENT.value : Theme.PRIMARY.value;
|
|
||||||
int iconFg = enabled ? Theme.ACCENT_FG.value : fgColor;
|
|
||||||
|
|
||||||
int settingsColor = settingsHover
|
|
||||||
? Theme.ACCENT.value
|
|
||||||
: Theme.withAlpha(160, fgColor);
|
|
||||||
|
|
||||||
int h = height - (p * 2);
|
|
||||||
|
|
||||||
// Main background
|
|
||||||
renderScope.drawRoundedRectangle(
|
|
||||||
0, 0,
|
|
||||||
width, height,
|
|
||||||
Theme.WIDGET_RADIUS.value,
|
|
||||||
bgColor);
|
|
||||||
|
|
||||||
// Icon background
|
|
||||||
renderScope.drawRoundedRectangle(
|
|
||||||
p, p,
|
|
||||||
h, h,
|
|
||||||
Theme.WIDGET_RADIUS.value,
|
|
||||||
iconBg);
|
|
||||||
|
|
||||||
// Icon
|
|
||||||
renderScope.drawTexture(
|
|
||||||
mod.getIconTexture(),
|
|
||||||
p + (p / 2),
|
|
||||||
p + (p / 2),
|
|
||||||
0, 0,
|
|
||||||
h - p,
|
|
||||||
h - p,
|
|
||||||
iconFg);
|
|
||||||
|
|
||||||
// Module name
|
|
||||||
renderScope.drawText(
|
|
||||||
0.6f,
|
|
||||||
mod.getName(),
|
|
||||||
p + h + 4,
|
|
||||||
p + 1,
|
|
||||||
Theme.FONT.value,
|
|
||||||
fgColor);
|
|
||||||
|
|
||||||
// Version (right aligned)
|
|
||||||
String version = mod.getVersion();
|
|
||||||
int versionWidth = (int) (Fonts.getWidth(version, Theme.FONT.value) * 0.35f);
|
|
||||||
|
|
||||||
renderScope.drawText(
|
|
||||||
0.35f,
|
|
||||||
version,
|
|
||||||
width - p - versionWidth,
|
|
||||||
p + 1,
|
|
||||||
Theme.FONT.value,
|
|
||||||
fgColor);
|
|
||||||
|
|
||||||
// Tags
|
|
||||||
int xt = p + h + 4;
|
|
||||||
for (String tag : mod.getTags()) {
|
|
||||||
int tagWidth = (int) (Fonts.getWidth(tag, Theme.FONT.value) * 0.4f);
|
|
||||||
|
|
||||||
renderScope.drawRoundedRectangle(
|
|
||||||
xt,
|
|
||||||
p + (h / 2),
|
|
||||||
tagWidth + 6,
|
|
||||||
12,
|
|
||||||
5,
|
|
||||||
Theme.ACCENT.value);
|
|
||||||
|
|
||||||
renderScope.drawText(
|
|
||||||
0.4f,
|
|
||||||
tag,
|
|
||||||
xt + 2,
|
|
||||||
p + (h / 2) + 3,
|
|
||||||
Theme.FONT.value,
|
|
||||||
Theme.ACCENT_FG.value);
|
|
||||||
|
|
||||||
xt += tagWidth + 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Settings icon
|
|
||||||
renderScope.drawTexture(
|
|
||||||
Textures.SETTINGS,
|
|
||||||
iconX,
|
|
||||||
iconY,
|
|
||||||
0, 0,
|
|
||||||
s, s,
|
|
||||||
settingsColor);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
private int getSettingsX() {
|
||||||
public void click(int mouseX, int mouseY) {
|
return width - s - p - expand;
|
||||||
boolean settingsHover = Utils.isHovering(
|
}
|
||||||
mouseX - getSettingsX(),
|
|
||||||
mouseY - getSettingsY(),
|
|
||||||
getSettingsHitBox(),
|
|
||||||
getSettingsHitBox(),
|
|
||||||
1.0f);
|
|
||||||
|
|
||||||
if (settingsHover) {
|
private int getSettingsY() {
|
||||||
SaturnClient.client.setScreen(new ConfigEditor(mod.getConfig()));
|
return height - s - p - expand;
|
||||||
} else {
|
}
|
||||||
mod.setEnabled(!mod.isEnabled());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getSettingsX() {
|
private int getSettingsHitBox() {
|
||||||
return width - s - p - expand;
|
return s + expand * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getSettingsY() {
|
|
||||||
return height - s - p - expand;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getSettingsHitBox() {
|
|
||||||
return s + expand * 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -14,19 +14,16 @@ import org.saturnclient.ui.screens.ModMenu;
|
|||||||
import org.saturnclient.ui.screens.cosmetics.CloakMenu;
|
import org.saturnclient.ui.screens.cosmetics.CloakMenu;
|
||||||
import org.saturnclient.ui.screens.store.CloakStore;
|
import org.saturnclient.ui.screens.store.CloakStore;
|
||||||
|
|
||||||
import net.minecraft.client.render.RenderLayer;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
|
|
||||||
public class Sidebar extends Element {
|
public class Sidebar extends Element {
|
||||||
public static class SidebarComponent {
|
public static class SidebarComponent {
|
||||||
Runnable onClick;
|
Runnable onClick;
|
||||||
boolean end;
|
boolean end;
|
||||||
Identifier sprite;
|
SaturnIdentifier sprite;
|
||||||
|
|
||||||
public SidebarComponent(SaturnIdentifier sprite, Runnable onClick, boolean end) {
|
public SidebarComponent(SaturnIdentifier sprite, Runnable onClick, boolean end) {
|
||||||
this.onClick = onClick;
|
this.onClick = onClick;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
this.sprite = (Identifier) sprite.inner;
|
this.sprite = sprite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,8 +68,6 @@ public class Sidebar extends Element {
|
|||||||
int s = 30 - (padding * 2);
|
int s = 30 - (padding * 2);
|
||||||
int s2 = s + padding;
|
int s2 = s + padding;
|
||||||
|
|
||||||
renderScope.setRenderLayer(RenderLayer::getGuiTextured);
|
|
||||||
|
|
||||||
renderScope.drawRoundedRectangle(0, 0, width, height, Theme.BG_RADIUS.value, Theme.BACKGROUND.value);
|
renderScope.drawRoundedRectangle(0, 0, width, height, Theme.BG_RADIUS.value, Theme.BACKGROUND.value);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.saturnclient.ui.components;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.joml.Quaternionf;
|
import org.joml.Quaternionf;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
|
import org.saturnclient.common.minecraft.bindings.SaturnQuaternionf;
|
||||||
import org.saturnclient.saturnclient.SaturnClient;
|
import org.saturnclient.saturnclient.SaturnClient;
|
||||||
import org.saturnclient.ui.Element;
|
import org.saturnclient.ui.Element;
|
||||||
import org.saturnclient.ui.ElementContext;
|
import org.saturnclient.ui.ElementContext;
|
||||||
@@ -21,7 +22,8 @@ public class SkinPreview extends Element {
|
|||||||
this.negativeAngle = negativeAngle;
|
this.negativeAngle = negativeAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawEntity(RenderScope renderScope, int x1, int y1, int x2, int y2, int size, float f, float mouseX,
|
public static void drawEntity(RenderScope renderScope, int x1, int y1, int x2, int y2, int size, float f,
|
||||||
|
float mouseX,
|
||||||
float mouseY, LivingEntity entity, float angle, boolean negativeAngle) {
|
float mouseY, LivingEntity entity, float angle, boolean negativeAngle) {
|
||||||
float g = (float) (x1 + x2) / 2.0F;
|
float g = (float) (x1 + x2) / 2.0F;
|
||||||
float h = (float) (y1 + y2) / 2.0F;
|
float h = (float) (y1 + y2) / 2.0F;
|
||||||
@@ -57,23 +59,24 @@ public class SkinPreview extends Element {
|
|||||||
|
|
||||||
public static void drawEntity(RenderScope renderScope, float x, float y, float size, Vector3f vector3f,
|
public static void drawEntity(RenderScope renderScope, float x, float y, float size, Vector3f vector3f,
|
||||||
Quaternionf quaternionf, @Nullable Quaternionf quaternionf2, LivingEntity entity) {
|
Quaternionf quaternionf, @Nullable Quaternionf quaternionf2, LivingEntity entity) {
|
||||||
renderScope.matrices.push();
|
renderScope.getMatrixStack().push();
|
||||||
renderScope.matrices.translate((double) x, (double) y, 50.0);
|
renderScope.getMatrixStack().translate((double) x, (double) y, 50.0);
|
||||||
renderScope.matrices.scale(size, size, -size);
|
renderScope.getMatrixStack().scale(size, size, -size);
|
||||||
renderScope.matrices.translate(vector3f.x, vector3f.y, vector3f.z);
|
renderScope.getMatrixStack().translate(vector3f.x, vector3f.y, vector3f.z);
|
||||||
renderScope.matrices.multiply(quaternionf);
|
renderScope.getMatrixStack().multiply(new SaturnQuaternionf(quaternionf));
|
||||||
renderScope.draw();
|
renderScope.draw();
|
||||||
DiffuseLighting.method_34742();
|
DiffuseLighting.method_34742();
|
||||||
EntityRenderDispatcher entityRenderDispatcher = SaturnClient.client.getEntityRenderDispatcher();
|
EntityRenderDispatcher entityRenderDispatcher = SaturnClient.client.getEntityRenderDispatcher();
|
||||||
|
|
||||||
entityRenderDispatcher.setRenderShadows(false);
|
entityRenderDispatcher.setRenderShadows(false);
|
||||||
renderScope.draw((vertexConsumers) -> {
|
// TODO add the method draw with vertex consumers
|
||||||
entityRenderDispatcher.render(entity, 0.0, 0.0, 0.0, 1.0F, renderScope.matrices, vertexConsumers,
|
// renderScope.draw((vertexConsumers) -> {
|
||||||
15728880);
|
// entityRenderDispatcher.render(entity, 0.0, 0.0, 0.0, 1.0F, renderScope.getMatrixStack(), vertexConsumers,
|
||||||
});
|
// 15728880);
|
||||||
|
// });
|
||||||
renderScope.draw();
|
renderScope.draw();
|
||||||
entityRenderDispatcher.setRenderShadows(true);
|
entityRenderDispatcher.setRenderShadows(true);
|
||||||
renderScope.matrices.pop();
|
renderScope.getMatrixStack().pop();
|
||||||
DiffuseLighting.enableGuiDepthLighting();
|
DiffuseLighting.enableGuiDepthLighting();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +84,8 @@ public class SkinPreview extends Element {
|
|||||||
public void render(RenderScope renderScope, ElementContext ctx) {
|
public void render(RenderScope renderScope, ElementContext ctx) {
|
||||||
LivingEntity entity = SaturnClient.client.player;
|
LivingEntity entity = SaturnClient.client.player;
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
drawEntity(renderScope, 0, 0, 75, 78, 30, 0.0625F, ctx.mouseX / scale, ctx.mouseY / scale, entity, angle, negativeAngle);
|
drawEntity(renderScope, 0, 0, 75, 78, 30, 0.0625F, ctx.mouseX / scale, ctx.mouseY / scale, entity, angle,
|
||||||
|
negativeAngle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class CloakStore extends SaturnScreen {
|
|||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
|
||||||
if (now - lastPurchaseTime >= 3000) {
|
if (now - lastPurchaseTime >= 3000) {
|
||||||
Utils.notify(NotificationKind.Info, "Purchase processing", "Please wait");
|
// Utils.notify(NotificationKind.Info, "Purchase processing", "Please wait");
|
||||||
|
|
||||||
ServiceClient.buyCloak(cloak);
|
ServiceClient.buyCloak(cloak);
|
||||||
lastPurchaseTime = now;
|
lastPurchaseTime = now;
|
||||||
@@ -129,16 +129,16 @@ public class CloakStore extends SaturnScreen {
|
|||||||
|
|
||||||
RenderSystem.recordRenderCall(() -> {
|
RenderSystem.recordRenderCall(() -> {
|
||||||
SaturnClient.client.setScreen(new CloakStore(now));
|
SaturnClient.client.setScreen(new CloakStore(now));
|
||||||
Utils.notify(NotificationKind.Success,
|
// Utils.notify(NotificationKind.Success,
|
||||||
"Purchase complete",
|
// "Purchase complete",
|
||||||
"Congrats, enjoy your new cloak!");
|
// "Congrats, enjoy your new cloak!");
|
||||||
});
|
});
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Utils.notify(NotificationKind.Error,
|
// Utils.notify(NotificationKind.Error,
|
||||||
"Timeout error",
|
// "Timeout error",
|
||||||
"Please wait 3 seconds");
|
// "Please wait 3 seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class HatStore extends SaturnScreen {
|
|||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
|
||||||
if (now - lastPurchaseTime >= 3000) {
|
if (now - lastPurchaseTime >= 3000) {
|
||||||
Utils.notify(NotificationKind.Info, "Purchase processing", "Please wait");
|
// Utils.notify(NotificationKind.Info, "Purchase processing", "Please wait");
|
||||||
|
|
||||||
ServiceClient.buyHat(hat);
|
ServiceClient.buyHat(hat);
|
||||||
lastPurchaseTime = now;
|
lastPurchaseTime = now;
|
||||||
@@ -130,16 +130,16 @@ public class HatStore extends SaturnScreen {
|
|||||||
|
|
||||||
RenderSystem.recordRenderCall(() -> {
|
RenderSystem.recordRenderCall(() -> {
|
||||||
SaturnClient.client.setScreen(new HatStore(now));
|
SaturnClient.client.setScreen(new HatStore(now));
|
||||||
Utils.notify(NotificationKind.Success,
|
// Utils.notify(NotificationKind.Success,
|
||||||
"Purchase complete",
|
// "Purchase complete",
|
||||||
"Congrats, enjoy your new hat!");
|
// "Congrats, enjoy your new hat!");
|
||||||
});
|
});
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Utils.notify(NotificationKind.Error,
|
// Utils.notify(NotificationKind.Error,
|
||||||
"Timeout error",
|
// "Timeout error",
|
||||||
"Please wait 3 seconds");
|
// "Please wait 3 seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user