mirror of
https://github.com/Miasmusa/Shadow.git
synced 2024-11-14 19:04:54 -05:00
saturn is high
This commit is contained in:
parent
37ae74f328
commit
817089d020
20 changed files with 195 additions and 186 deletions
|
@ -5,8 +5,8 @@
|
|||
package net.shadow.client.feature.command;
|
||||
|
||||
import net.shadow.client.feature.command.exception.CommandException;
|
||||
import net.shadow.client.feature.command.impl.*;
|
||||
import net.shadow.client.feature.command.impl.Void;
|
||||
import net.shadow.client.feature.command.impl.*;
|
||||
import net.shadow.client.helper.util.Utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.shadow.client.helper.nbt.NbtGroup;
|
|||
import net.shadow.client.helper.nbt.NbtList;
|
||||
import net.shadow.client.helper.nbt.NbtObject;
|
||||
import net.shadow.client.helper.nbt.NbtProperty;
|
||||
import net.shadow.client.helper.render.Renderer;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
package net.shadow.client.feature.command.impl;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
import net.minecraft.client.texture.NativeImageBackedTexture;
|
||||
import net.shadow.client.ShadowMain;
|
||||
import net.shadow.client.feature.command.Command;
|
||||
import net.shadow.client.feature.command.exception.CommandException;
|
||||
|
@ -16,24 +14,18 @@ import net.shadow.client.helper.event.Events;
|
|||
import net.shadow.client.helper.util.Utils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.imageio.ImageReader;
|
||||
import javax.imageio.metadata.IIOMetadata;
|
||||
import javax.imageio.stream.ImageInputStream;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class Taco extends Command {
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ConfigDisplay extends Element {
|
|||
bases.add(bse);
|
||||
} else if (setting instanceof DoubleSetting set) {
|
||||
if (set.getName().equalsIgnoreCase("keybind")) {
|
||||
KeybindEditor ke = new KeybindEditor(0,0,width-padding-paddingLeft,set);
|
||||
KeybindEditor ke = new KeybindEditor(0, 0, width - padding - paddingLeft, set);
|
||||
bases.add(ke);
|
||||
} else {
|
||||
DoubleSettingEditor dse = new DoubleSettingEditor(0, 0, width - padding - paddingLeft, set);
|
||||
|
|
|
@ -14,9 +14,10 @@ import java.awt.*;
|
|||
import java.lang.reflect.Field;
|
||||
|
||||
public class KeybindEditor extends ConfigBase<DoubleSetting> {
|
||||
static double h = FontRenderers.getRenderer().getFontHeight()+2;
|
||||
static double h = FontRenderers.getRenderer().getFontHeight() + 2;
|
||||
boolean selecting = false;
|
||||
boolean cancelNextCharTyped = false;
|
||||
|
||||
public KeybindEditor(double x, double y, double width, DoubleSetting configValue) {
|
||||
super(x, y, width, h, configValue);
|
||||
}
|
||||
|
@ -28,7 +29,7 @@ public class KeybindEditor extends ConfigBase<DoubleSetting> {
|
|||
|
||||
@Override
|
||||
public boolean clicked(double x, double y, int button) {
|
||||
if (inBounds(x,y)) {
|
||||
if (inBounds(x, y)) {
|
||||
selecting = !selecting;
|
||||
return true;
|
||||
}
|
||||
|
@ -44,7 +45,8 @@ public class KeybindEditor extends ConfigBase<DoubleSetting> {
|
|||
public boolean released() {
|
||||
return false;
|
||||
}
|
||||
// long lastUpdate = System.currentTimeMillis();
|
||||
|
||||
// long lastUpdate = System.currentTimeMillis();
|
||||
@Override
|
||||
public boolean keyPressed(int keycode, int modifiers) {
|
||||
if (selecting) {
|
||||
|
@ -55,7 +57,7 @@ public class KeybindEditor extends ConfigBase<DoubleSetting> {
|
|||
return true;
|
||||
}
|
||||
if (keycode == GLFW.GLFW_KEY_BACKSPACE) keycode = -1;
|
||||
configValue.setValue(keycode+0d);
|
||||
configValue.setValue(keycode + 0d);
|
||||
selecting = false;
|
||||
return true;
|
||||
}
|
||||
|
@ -68,8 +70,7 @@ public class KeybindEditor extends ConfigBase<DoubleSetting> {
|
|||
int keybind = getKeybind();
|
||||
if (selecting) {
|
||||
keyName = "...";
|
||||
}
|
||||
else if (keybind == -1) {
|
||||
} else if (keybind == -1) {
|
||||
keyName = "None";
|
||||
} else {
|
||||
keyName = GLFW.glfwGetKeyName(keybind, GLFW.glfwGetKeyScancode(keybind));
|
||||
|
@ -89,12 +90,12 @@ public class KeybindEditor extends ConfigBase<DoubleSetting> {
|
|||
}
|
||||
} else keyName = keyName.toUpperCase();
|
||||
}
|
||||
Renderer.R2D.renderRoundedQuad(matrices, new Color(40, 40, 40),x,y,x+width,y+h,5,20);
|
||||
FontRenderers.getRenderer().drawCenteredString(matrices,keyName,x+width/2d,y+h/2d-FontRenderers.getRenderer().getMarginHeight()/2d,1f,1f,1f,1f);
|
||||
Renderer.R2D.renderRoundedQuad(matrices, new Color(40, 40, 40), x, y, x + width, y + h, 5, 20);
|
||||
FontRenderers.getRenderer().drawCenteredString(matrices, keyName, x + width / 2d, y + h / 2d - FontRenderers.getRenderer().getMarginHeight() / 2d, 1f, 1f, 1f, 1f);
|
||||
}
|
||||
|
||||
int getKeybind() {
|
||||
return (int) (configValue.getValue()+0);
|
||||
return (int) (configValue.getValue() + 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,30 +1,29 @@
|
|||
package net.shadow.client.feature.gui.panels;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.shadow.client.ShadowMain;
|
||||
import net.shadow.client.feature.gui.FastTickable;
|
||||
import net.shadow.client.feature.gui.panels.elements.PanelFrame;
|
||||
import net.shadow.client.helper.render.MSAAFramebuffer;
|
||||
import net.shadow.client.feature.gui.screen.ClientScreen;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class PanelsGui extends Screen{
|
||||
PanelFrame[] renders;
|
||||
public class PanelsGui extends ClientScreen implements FastTickable {
|
||||
PanelFrame[] renders;
|
||||
|
||||
public PanelsGui(PanelFrame[] renders) {
|
||||
super(Text.of(""));
|
||||
this.renders = renders;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFastTick() {
|
||||
for (PanelFrame render : renders) {
|
||||
render.onFastTick();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
@ -33,8 +32,8 @@ public class PanelsGui extends Screen{
|
|||
|
||||
@Override
|
||||
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
|
||||
|
||||
for(PanelFrame pf : renders){
|
||||
|
||||
for (PanelFrame pf : renders) {
|
||||
pf.scroll(mouseX, mouseY, amount);
|
||||
}
|
||||
return true;
|
||||
|
@ -42,17 +41,17 @@ public class PanelsGui extends Screen{
|
|||
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
MSAAFramebuffer.use(MSAAFramebuffer.MAX_SAMPLES, () -> {
|
||||
for(PanelFrame pf : renders){
|
||||
pf.render(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
});
|
||||
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(stack);
|
||||
for (PanelFrame pf : renders) {
|
||||
pf.render(stack, mouseX, mouseY, delta);
|
||||
}
|
||||
super.renderInternal(stack, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
for(PanelFrame pf : renders){
|
||||
for (PanelFrame pf : renders) {
|
||||
pf.clicked(mouseX, mouseY, button);
|
||||
}
|
||||
return super.mouseClicked(mouseX, mouseY, button);
|
||||
|
@ -60,7 +59,7 @@ public class PanelsGui extends Screen{
|
|||
|
||||
@Override
|
||||
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
||||
for(PanelFrame pf : renders){
|
||||
for (PanelFrame pf : renders) {
|
||||
pf.released();
|
||||
}
|
||||
return super.mouseReleased(mouseX, mouseY, button);
|
||||
|
@ -68,7 +67,7 @@ public class PanelsGui extends Screen{
|
|||
|
||||
@Override
|
||||
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
||||
for(PanelFrame pf : renders){
|
||||
for (PanelFrame pf : renders) {
|
||||
pf.dragged(mouseX, mouseY, deltaX, deltaY, button);
|
||||
}
|
||||
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
||||
|
@ -77,7 +76,7 @@ public class PanelsGui extends Screen{
|
|||
|
||||
@Override
|
||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||
for(PanelFrame pf : renders){
|
||||
for (PanelFrame pf : renders) {
|
||||
pf.keyPressed(keyCode, modifiers);
|
||||
}
|
||||
return super.keyPressed(keyCode, scanCode, modifiers);
|
||||
|
@ -90,7 +89,7 @@ public class PanelsGui extends Screen{
|
|||
|
||||
@Override
|
||||
public boolean charTyped(char chr, int modifiers) {
|
||||
for(PanelFrame pf : renders){
|
||||
for (PanelFrame pf : renders) {
|
||||
pf.charTyped(chr, modifiers);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -5,17 +5,14 @@
|
|||
package net.shadow.client.feature.gui.panels.elements;
|
||||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.shadow.client.feature.config.DoubleSetting;
|
||||
import net.shadow.client.feature.gui.clickgui.element.Element;
|
||||
import net.shadow.client.helper.font.FontRenderers;
|
||||
import net.shadow.client.helper.render.Renderer;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.awt.*;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class PanelButton extends Element {
|
||||
static double h = FontRenderers.getRenderer().getFontHeight()+2;
|
||||
static double h = FontRenderers.getRenderer().getFontHeight() + 2;
|
||||
boolean selecting = false;
|
||||
boolean cancelNextCharTyped = false;
|
||||
Runnable code;
|
||||
|
@ -35,7 +32,7 @@ public class PanelButton extends Element {
|
|||
|
||||
@Override
|
||||
public boolean clicked(double x, double y, int button) {
|
||||
if (inBounds(x,y)) {
|
||||
if (inBounds(x, y)) {
|
||||
code.run();
|
||||
return true;
|
||||
}
|
||||
|
@ -51,7 +48,8 @@ public class PanelButton extends Element {
|
|||
public boolean released() {
|
||||
return false;
|
||||
}
|
||||
// long lastUpdate = System.currentTimeMillis();
|
||||
|
||||
// long lastUpdate = System.currentTimeMillis();
|
||||
@Override
|
||||
public boolean keyPressed(int keycode, int modifiers) {
|
||||
return false;
|
||||
|
@ -59,8 +57,8 @@ public class PanelButton extends Element {
|
|||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
|
||||
Renderer.R2D.renderRoundedQuad(matrices, new Color(40, 40, 40),x,y,x+width,y+h,5,20);
|
||||
FontRenderers.getRenderer().drawCenteredString(matrices,title,x+width/2d,y+h/2d-FontRenderers.getRenderer().getMarginHeight()/2d,1f,1f,1f,1f);
|
||||
Renderer.R2D.renderRoundedQuad(matrices, new Color(40, 40, 40), x, y, x + width, y + h, 5, 20);
|
||||
FontRenderers.getRenderer().drawCenteredString(matrices, title, x + width / 2d, y + h / 2d - FontRenderers.getRenderer().getMarginHeight() / 2d, 1f, 1f, 1f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,26 +2,26 @@ package net.shadow.client.feature.gui.panels.elements;
|
|||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.shadow.client.feature.gui.FastTickable;
|
||||
import net.shadow.client.feature.gui.clickgui.element.Element;
|
||||
import net.shadow.client.feature.gui.clickgui.theme.ThemeManager;
|
||||
import net.shadow.client.helper.font.FontRenderers;
|
||||
import net.shadow.client.helper.render.ClipStack;
|
||||
import net.shadow.client.helper.render.Rectangle;
|
||||
import net.shadow.client.helper.render.Renderer;
|
||||
import net.shadow.client.helper.util.Transitions;
|
||||
import java.util.Set;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class PanelFrame extends Element {
|
||||
public class PanelFrame extends Element implements FastTickable {
|
||||
String title;
|
||||
Element[] elements;
|
||||
HashMap<Element, double[]> positions = new HashMap<Element, double[]>();
|
||||
HashMap<Element, double[]> positions = new HashMap<>();
|
||||
boolean selected = false;
|
||||
boolean open = true;
|
||||
double xGoal, yGoal;
|
||||
double smoothTransition = 0;
|
||||
double realglobal;
|
||||
double smoothInit = 0;
|
||||
boolean resizer = false;
|
||||
|
||||
public PanelFrame(double x, double y, double w, double h, String title, Element[] elements) {
|
||||
|
@ -30,14 +30,15 @@ public class PanelFrame extends Element {
|
|||
this.elements = elements;
|
||||
this.xGoal = x;
|
||||
this.yGoal = y;
|
||||
for(Element el : this.elements){
|
||||
for (Element el : this.elements) {
|
||||
positions.put(el, new double[]{el.getX(), el.getY(), el.getWidth(), el.getHeight()});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clicked(double x, double y, int button) {
|
||||
if(x >= this.x + this.width - 15 && x < this.x + this.width && y >= this.y + (realglobal * height) - 15&& y < this.y + (realglobal * height)){
|
||||
double real = easeInOutQuint(smoothInit);
|
||||
if (x >= this.x + this.width - 15 && x < this.x + this.width && y >= this.y + (real * height) - 15 && y < this.y + (real * height)) {
|
||||
System.out.println("real");
|
||||
resizer = true;
|
||||
return false;
|
||||
|
@ -50,7 +51,7 @@ public class PanelFrame extends Element {
|
|||
open = !open;
|
||||
}
|
||||
}
|
||||
for(Element pb : elements){
|
||||
for (Element pb : elements) {
|
||||
pb.clicked(x, y, button);
|
||||
}
|
||||
return false;
|
||||
|
@ -58,15 +59,17 @@ public class PanelFrame extends Element {
|
|||
|
||||
@Override
|
||||
public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
|
||||
if(selected){
|
||||
if (selected) {
|
||||
this.xGoal += deltaX;
|
||||
this.yGoal += deltaY;
|
||||
}
|
||||
if(resizer){
|
||||
if (resizer) {
|
||||
this.width += deltaX;
|
||||
this.width = Math.max(50, this.width);
|
||||
this.height += deltaY;
|
||||
this.height = Math.max(50, this.height);
|
||||
}
|
||||
for(Element pb : elements){
|
||||
for (Element pb : elements) {
|
||||
pb.dragged(x, y, deltaX, deltaY, button);
|
||||
}
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -77,7 +80,7 @@ public class PanelFrame extends Element {
|
|||
public boolean released() {
|
||||
selected = false;
|
||||
resizer = false;
|
||||
for(Element pb : elements){
|
||||
for (Element pb : elements) {
|
||||
pb.released();
|
||||
}
|
||||
return false;
|
||||
|
@ -85,7 +88,7 @@ public class PanelFrame extends Element {
|
|||
|
||||
@Override
|
||||
public boolean keyPressed(int keycode, int modifiers) {
|
||||
for(Element pb : elements){
|
||||
for (Element pb : elements) {
|
||||
pb.keyPressed(keycode, modifiers);
|
||||
}
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -98,52 +101,61 @@ public class PanelFrame extends Element {
|
|||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
|
||||
this.x = Transitions.transition(this.x, this.xGoal, 4);
|
||||
this.y = Transitions.transition(this.y, this.yGoal, 4);
|
||||
double d = 0.03;
|
||||
if(open) {
|
||||
d *= -1;
|
||||
}
|
||||
smoothTransition += d;
|
||||
smoothTransition = MathHelper.clamp(smoothTransition, 0, 1);
|
||||
double real = easeInOutQuint(smoothTransition);
|
||||
if(real > 0.09){
|
||||
Renderer.R2D.renderRoundedQuad(matrices, ThemeManager.getMainTheme().getInactive(), x, y, x + width, y + (real * height), 5, 10);
|
||||
realglobal = real;
|
||||
|
||||
double real = easeInOutQuint(smoothInit);
|
||||
Renderer.R2D.renderRoundedQuad(matrices, new Color(30, 30, 30), x, y, x + width, y + 15 + (real * (height - 15)), 5, 10);
|
||||
if (real > 0.09) {
|
||||
|
||||
Renderer.R2D.renderRoundedQuad(matrices, ThemeManager.getMainTheme().getConfig(), x + width - 15, y + (real * height) - 15, x + width, y + (real * height), 5, 10);
|
||||
}
|
||||
Renderer.R2D.beginScissor(x, y, x + width, y + (real * width));
|
||||
for(Element pb : elements){
|
||||
ClipStack.globalInstance.addWindow(matrices, new Rectangle(x, y, x + width, y + (real * height)));
|
||||
// Renderer.R2D.beginScissor(x, y, x + width, y + (real * width));
|
||||
for (Element pb : elements) {
|
||||
// why?
|
||||
pb.setX(this.x + positions.get(pb)[0] + 5);
|
||||
pb.setY(this.y + 15 + positions.get(pb)[1]);
|
||||
if(positions.get(pb)[2] < 0){
|
||||
pb.setWidth(this.width - 10);
|
||||
}
|
||||
if(positions.get(pb)[3] < 0){
|
||||
pb.setHeight(this.height - 10);
|
||||
}
|
||||
pb.setWidth(positions.get(pb)[2]);
|
||||
pb.setHeight(positions.get(pb)[3]);
|
||||
// if(positions.get(pb)[2] < 0){
|
||||
// pb.setWidth(this.width - 10);
|
||||
// }
|
||||
// if(positions.get(pb)[3] < 0){
|
||||
// pb.setHeight(this.height - 10);
|
||||
// }
|
||||
}
|
||||
for(Element pb : elements){
|
||||
for (Element pb : elements) {
|
||||
pb.render(matrices, mouseX, mouseY, scrollBeingUsed);
|
||||
}
|
||||
Renderer.R2D.endScissor();
|
||||
// Renderer.R2D.endScissor();
|
||||
ClipStack.globalInstance.popWindow();
|
||||
Renderer.R2D.renderRoundedQuad(matrices, ThemeManager.getMainTheme().getHeader(), x, y, x + width, y + 15, 5, 10);
|
||||
FontRenderers.getRenderer().drawString(matrices, title, x + (width/2) - FontRenderers.getRenderer().getStringWidth(title) / 2, y + 3, new Color(255, 255, 255, 255).getRGB());
|
||||
FontRenderers.getRenderer().drawString(matrices, title, x + (width / 2) - FontRenderers.getRenderer().getStringWidth(title) / 2, y + 3, new Color(255, 255, 255, 255).getRGB());
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFastTick() {
|
||||
this.x = Transitions.transition(this.x, this.xGoal, 4);
|
||||
this.y = Transitions.transition(this.y, this.yGoal, 4);
|
||||
double d = 0.03;
|
||||
if (open) {
|
||||
d *= -1;
|
||||
}
|
||||
smoothInit += d;
|
||||
smoothInit = MathHelper.clamp(smoothInit, 0, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickAnim() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean charTyped(char c, int mods) {
|
||||
for(Element pb : elements){
|
||||
pb.charTyped(c, mods);
|
||||
for (Element pb : elements) {
|
||||
if (pb.charTyped(c, mods)) return true;
|
||||
}
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
|
|
|
@ -22,6 +22,8 @@ import net.shadow.client.feature.gui.FastTickable;
|
|||
import net.shadow.client.feature.gui.clickgui.ParticleRenderer;
|
||||
import net.shadow.client.feature.gui.clickgui.element.Element;
|
||||
import net.shadow.client.feature.gui.clickgui.element.impl.config.DoubleSettingEditor;
|
||||
import net.shadow.client.feature.gui.panels.PanelsGui;
|
||||
import net.shadow.client.feature.gui.panels.elements.PanelFrame;
|
||||
import net.shadow.client.feature.gui.widget.RoundButton;
|
||||
import net.shadow.client.helper.Texture;
|
||||
import net.shadow.client.helper.font.FontRenderers;
|
||||
|
@ -32,8 +34,6 @@ import net.shadow.client.helper.util.Utils;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL40C;
|
||||
import net.shadow.client.feature.gui.panels.*;
|
||||
import net.shadow.client.feature.gui.panels.elements.PanelFrame;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
|
@ -129,11 +129,11 @@ public class HomeScreen extends ClientScreen implements FastTickable {
|
|||
buttonsMap.add(new AbstractMap.SimpleEntry<>("Alts", () -> ShadowMain.client.setScreen(
|
||||
//AltManagerScreen.instance()
|
||||
// new TestScreen()
|
||||
new PanelsGui(new PanelFrame[]{
|
||||
new PanelFrame(0, 0, 100, 150, "hello chat", new Element[]{
|
||||
new DoubleSettingEditor(0, 0, 25, dub)
|
||||
new PanelsGui(new PanelFrame[]{
|
||||
new PanelFrame(0, 0, 100, 150, "hello chat", new Element[]{
|
||||
new DoubleSettingEditor(0, 0, 25, dub)
|
||||
})
|
||||
})
|
||||
})
|
||||
)));
|
||||
buttonsMap.add(new AbstractMap.SimpleEntry<>("Settings", () -> ShadowMain.client.setScreen(new OptionsScreen(this, ShadowMain.client.options))));
|
||||
double totalHeight = buttonsMap.size() * (widgetHeight + widPad) - widPad;
|
||||
|
|
|
@ -6,12 +6,12 @@ package net.shadow.client.feature.gui.screen;
|
|||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.shadow.client.helper.GifPlayer;
|
||||
import net.shadow.client.helper.font.FontRenderers;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class TestScreen extends ClientScreen {
|
||||
private static GifPlayer gp = GifPlayer.createFromFile(new File("/home/x150/Downloads/img.gif"),30);
|
||||
private static final GifPlayer gp = GifPlayer.createFromFile(new File("/home/x150/Downloads/img.gif"), 30);
|
||||
|
||||
public TestScreen() {
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class TestScreen extends ClientScreen {
|
|||
@Override
|
||||
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(stack);
|
||||
gp.renderFrame(stack,10,10,300,300);
|
||||
gp.renderFrame(stack, 10, 10, 300, 300);
|
||||
// FontRenderers.getRenderer().drawString(stack, "among us", mouseX, mouseY, 1f, 1f, 1f, 1f);
|
||||
// FontRenderers.getMono().drawString(stack, "among us", mouseX, mouseY + FontRenderers.getRenderer().getMarginHeight(), 1f, 1f, 1f, 1f);
|
||||
super.renderInternal(stack, mouseX, mouseY, delta);
|
||||
|
|
|
@ -111,7 +111,7 @@ public class RoundButton implements Element, Drawable, Selectable, FastTickable,
|
|||
double originX = -width / 2d;
|
||||
double originY = -height / 2d;
|
||||
Renderer.R2D.renderRoundedQuad(matrices, color, originX, originY, width / 2d, height / 2d, Math.min(height / 2d, 5), 20);
|
||||
FontRenderers.getRenderer().drawString(matrices, text, -(FontRenderers.getRenderer().getStringWidth(text) ) / 2f, -FontRenderers.getRenderer()
|
||||
FontRenderers.getRenderer().drawString(matrices, text, -(FontRenderers.getRenderer().getStringWidth(text)) / 2f, -FontRenderers.getRenderer()
|
||||
.getMarginHeight() / 2f, isEnabled() ? 0xFFFFFF : 0xAAAAAA, false);
|
||||
matrices.pop();
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ import net.shadow.client.feature.module.NoNotificationDefault;
|
|||
|
||||
@NoNotificationDefault
|
||||
public class ClickGUI extends Module {
|
||||
DoubleSetting dub = new DoubleSetting(10D, "realDouble", "some dumbass shit", 1, 0, 100);
|
||||
public final DoubleSetting radius = this.config.create(new DoubleSetting.Builder(5).name("Round radius").precision(1).min(0).max(10).description("How round the clickgui is").get());
|
||||
DoubleSetting dub = new DoubleSetting(10D, "realDouble", "some dumbass shit", 1, 0, 100);
|
||||
int t = 2;
|
||||
|
||||
public ClickGUI() {
|
||||
|
@ -31,13 +31,13 @@ public class ClickGUI extends Module {
|
|||
t--;
|
||||
if (t == 0) {
|
||||
ShadowMain.client.setScreen(new PanelsGui(new PanelFrame[]{
|
||||
new PanelFrame(0, 0, 100, 150, "hello chat", new Element[]{
|
||||
new DoubleSettingEditor(0, 0, -1, dub),
|
||||
new PanelButton(0, 50, -1, "real shit", () -> {
|
||||
System.out.println("hello shidders");
|
||||
System.out.println(dub.getValue() + "");
|
||||
new PanelFrame(0, 0, 100, 150, "hello chat", new Element[]{
|
||||
new DoubleSettingEditor(0, 0, -1, dub),
|
||||
new PanelButton(0, 50, -1, "real shit", () -> {
|
||||
System.out.println("hello shidders");
|
||||
System.out.println(dub.getValue() + "");
|
||||
})
|
||||
})
|
||||
})
|
||||
}));
|
||||
setEnabled(false);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ package net.shadow.client.feature.module.impl.render;
|
|||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.network.packet.s2c.play.WorldTimeUpdateS2CPacket;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -219,7 +217,7 @@ public class Hud extends Module {
|
|||
RenderSystem.enableBlend();
|
||||
double imgWidth = 507 / 5d;
|
||||
double imgHeight = 167 / 5d;
|
||||
|
||||
|
||||
double widgetWidth = Math.max(Math.max(imgWidth, width), 160) + 6;
|
||||
double widgetHeight = 3 + imgHeight + 3 + FontRenderers.getRenderer().getMarginHeight() + 3;
|
||||
double widgetX = 0;
|
||||
|
|
|
@ -28,10 +28,12 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
public class GifPlayer {
|
||||
Object gifFile;
|
||||
Object gifFile;
|
||||
int fps;
|
||||
long currentFrame = 0;
|
||||
List<Frame> frameList = new ArrayList<>();
|
||||
long lastRender = System.currentTimeMillis();
|
||||
|
||||
private GifPlayer(Object file, int fps) {
|
||||
this.gifFile = file;
|
||||
this.fps = fps;
|
||||
|
@ -83,7 +85,7 @@ Object gifFile;
|
|||
for (int j = 0; j < children.getLength(); j++) {
|
||||
Node nodeItem = children.item(j);
|
||||
|
||||
if(nodeItem.getNodeName().equals("ImageDescriptor")){
|
||||
if (nodeItem.getNodeName().equals("ImageDescriptor")) {
|
||||
Map<String, Integer> imageAttr = new HashMap<>();
|
||||
|
||||
for (String s : imageatt) {
|
||||
|
@ -91,13 +93,13 @@ Object gifFile;
|
|||
Node attnode = attr.getNamedItem(s);
|
||||
imageAttr.put(s, Integer.valueOf(attnode.getNodeValue()));
|
||||
}
|
||||
if(master == null){
|
||||
if (master == null) {
|
||||
master = new BufferedImage(imageAttr.get("imageWidth"), imageAttr.get("imageHeight"), BufferedImage.TYPE_INT_ARGB);
|
||||
}
|
||||
master.getGraphics().drawImage(image, imageAttr.get("imageLeftPosition"), imageAttr.get("imageTopPosition"), null);
|
||||
}
|
||||
}
|
||||
Frame f = new Frame("lmfao",master);
|
||||
Frame f = new Frame("lmfao", master);
|
||||
frameList.add(f);
|
||||
// ImageIO.write(master, "GIF", new File( i + ".gif"));
|
||||
}
|
||||
|
@ -106,41 +108,45 @@ Object gifFile;
|
|||
}
|
||||
currentFrame = 0;
|
||||
}
|
||||
|
||||
public void progressFrame() {
|
||||
currentFrame++;
|
||||
currentFrame %= frameList.size();
|
||||
}
|
||||
|
||||
public Frame getCurrentFrame() {
|
||||
return frameList.get((int) currentFrame);
|
||||
}
|
||||
|
||||
long lastRender = System.currentTimeMillis();
|
||||
public void renderFrame(MatrixStack stack, double x, double y, double width, double height) {
|
||||
long timeDelta = System.currentTimeMillis()-lastRender;
|
||||
long eachXmsFrame = 1000/fps;
|
||||
int framesToProgress = (int) (timeDelta/eachXmsFrame);
|
||||
long timeDelta = System.currentTimeMillis() - lastRender;
|
||||
long eachXmsFrame = 1000 / fps;
|
||||
int framesToProgress = (int) (timeDelta / eachXmsFrame);
|
||||
if (framesToProgress > 0) lastRender = System.currentTimeMillis();
|
||||
for(int i = 0;i<framesToProgress;i++) {
|
||||
for (int i = 0; i < framesToProgress; i++) {
|
||||
progressFrame();
|
||||
}
|
||||
Frame current = getCurrentFrame();
|
||||
RenderSystem.setShaderTexture(0, current.getTexture());
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
Renderer.R2D.renderTexture(stack,x,y,width,height,0,0,width,height,width,height);
|
||||
FontRenderers.getRenderer().drawString(stack,currentFrame+"/"+frameList.size(),x,y,0);
|
||||
Renderer.R2D.renderTexture(stack, x, y, width, height, 0, 0, width, height, width, height);
|
||||
FontRenderers.getRenderer().drawString(stack, currentFrame + "/" + frameList.size(), x, y, 0);
|
||||
}
|
||||
|
||||
static class Frame {
|
||||
Texture texture;
|
||||
|
||||
public Frame(String id, BufferedImage bi) {
|
||||
String rndId = Integer.toHexString((int) Math.floor(Math.random()*0xFFFFFF));
|
||||
this.texture = new Texture("gifPlayer/"+id+"-"+rndId);
|
||||
Utils.registerBufferedImageTexture(texture,bi);
|
||||
String rndId = Integer.toHexString((int) Math.floor(Math.random() * 0xFFFFFF));
|
||||
this.texture = new Texture("gifPlayer/" + id + "-" + rndId);
|
||||
Utils.registerBufferedImageTexture(texture, bi);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
MinecraftClient.getInstance().execute(() -> MinecraftClient.getInstance().getTextureManager().destroyTexture(texture));
|
||||
}
|
||||
|
||||
public Texture getTexture() {
|
||||
return texture;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.nbt.visitor.NbtElementVisitor;
|
|||
import net.minecraft.util.Util;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import net.shadow.client.feature.module.ModuleRegistry;
|
|||
import net.shadow.client.feature.module.impl.misc.ClientSettings;
|
||||
import net.shadow.client.feature.module.impl.misc.InfChatLength;
|
||||
import net.shadow.client.helper.font.FontRenderers;
|
||||
import net.shadow.client.helper.render.MSAAFramebuffer;
|
||||
import net.shadow.client.helper.render.Renderer;
|
||||
import net.shadow.client.helper.util.Utils;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
|
|
@ -5,9 +5,6 @@
|
|||
package net.shadow.client.mixin;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.gui.screen.GameModeSelectionScreen;
|
||||
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.SliderWidget;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
|
@ -31,17 +28,17 @@ import java.awt.*;
|
|||
@Mixin(ClickableWidget.class)
|
||||
public abstract class ButtonWidgetMixin implements DoesMSAA, FastTickable {
|
||||
|
||||
@Shadow public abstract boolean isHovered();
|
||||
|
||||
@Shadow public int x;
|
||||
|
||||
@Shadow public int y;
|
||||
|
||||
@Shadow protected int width;
|
||||
|
||||
@Shadow protected int height;
|
||||
|
||||
@Shadow public abstract Text getMessage();
|
||||
@Shadow
|
||||
public int x;
|
||||
@Shadow
|
||||
public int y;
|
||||
@Shadow
|
||||
protected int width;
|
||||
@Shadow
|
||||
protected int height;
|
||||
Color c = new Color(30, 30, 30);
|
||||
Color c1 = new Color(15, 15, 15);
|
||||
double anim = 0;
|
||||
|
||||
private static void renderRoundedQuadOutline(MatrixStack matrices, Color c, double fromX, double fromY, double toX, double toY, double rad, double samples) {
|
||||
|
||||
|
@ -62,6 +59,7 @@ public abstract class ButtonWidgetMixin implements DoesMSAA, FastTickable {
|
|||
RenderSystem.disableBlend();
|
||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
|
||||
}
|
||||
|
||||
private static void drawRoundOutline(Matrix4f matrix, float cr, float cg, float cb, float ca, double fromX, double fromY, double toX, double toY, double rad, double samples) {
|
||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
||||
bufferBuilder.begin(VertexFormat.DrawMode.TRIANGLE_STRIP, VertexFormats.POSITION_COLOR);
|
||||
|
@ -90,9 +88,12 @@ public abstract class ButtonWidgetMixin implements DoesMSAA, FastTickable {
|
|||
bufferBuilder.end();
|
||||
BufferRenderer.draw(bufferBuilder);
|
||||
}
|
||||
Color c = new Color(30,30,30);
|
||||
Color c1 = new Color(15,15,15);
|
||||
double anim = 0;
|
||||
|
||||
@Shadow
|
||||
public abstract boolean isHovered();
|
||||
|
||||
@Shadow
|
||||
public abstract Text getMessage();
|
||||
|
||||
@Override
|
||||
public void onFastTick() {
|
||||
|
@ -102,13 +103,13 @@ public abstract class ButtonWidgetMixin implements DoesMSAA, FastTickable {
|
|||
anim = MathHelper.clamp(anim, 0, 1);
|
||||
}
|
||||
|
||||
@Inject(method="renderButton",at=@At("HEAD"),cancellable = true)
|
||||
@Inject(method = "renderButton", at = @At("HEAD"), cancellable = true)
|
||||
void p(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
if (((Object) this) instanceof SliderWidget || ((Object) this) instanceof TextFieldWidget) return;
|
||||
ci.cancel();
|
||||
|
||||
Renderer.R2D.renderRoundedQuad(matrices,Renderer.Util.lerp(c1.brighter(), c1, anim),x,y,x+width,y+height,5,15);
|
||||
renderRoundedQuadOutline(matrices,Renderer.Util.lerp(c.brighter(), c, anim),x,y,x+width,y+height,5,15);
|
||||
FontRenderers.getRenderer().drawCenteredString(matrices,getMessage().getString(),x+width/2d,y+height/2d-FontRenderers.getRenderer().getMarginHeight()/2d,1f,1f,1f,1f);
|
||||
Renderer.R2D.renderRoundedQuad(matrices, Renderer.Util.lerp(c1.brighter(), c1, anim), x, y, x + width, y + height, 5, 15);
|
||||
renderRoundedQuadOutline(matrices, Renderer.Util.lerp(c.brighter(), c, anim), x, y, x + width, y + height, 5, 15);
|
||||
FontRenderers.getRenderer().drawCenteredString(matrices, getMessage().getString(), x + width / 2d, y + height / 2d - FontRenderers.getRenderer().getMarginHeight() / 2d, 1f, 1f, 1f, 1f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,47 +6,49 @@ package net.shadow.client.mixin;
|
|||
|
||||
import net.minecraft.client.gui.widget.EntryListWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.shadow.client.helper.render.ClipStack;
|
||||
import net.shadow.client.helper.render.Rectangle;
|
||||
import net.shadow.client.helper.render.Renderer;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(EntryListWidget.class)
|
||||
public class EntryListWidgetMixin {
|
||||
@Shadow protected int left;
|
||||
@Shadow
|
||||
protected int left;
|
||||
|
||||
@Shadow protected int top;
|
||||
@Shadow
|
||||
protected int top;
|
||||
|
||||
@Shadow protected int right;
|
||||
@Shadow
|
||||
protected int right;
|
||||
|
||||
@Shadow protected int bottom;
|
||||
@Shadow
|
||||
protected int bottom;
|
||||
|
||||
@Shadow protected int height;
|
||||
@Shadow
|
||||
protected int height;
|
||||
|
||||
@Shadow protected int width;
|
||||
@Shadow
|
||||
protected int width;
|
||||
|
||||
@Redirect(method="render",at=@At(
|
||||
value="FIELD",
|
||||
target="Lnet/minecraft/client/gui/widget/EntryListWidget;renderHorizontalShadows:Z",
|
||||
@Redirect(method = "render", at = @At(
|
||||
value = "FIELD",
|
||||
target = "Lnet/minecraft/client/gui/widget/EntryListWidget;renderHorizontalShadows:Z",
|
||||
opcode = Opcodes.GETFIELD
|
||||
))
|
||||
boolean r(EntryListWidget<?> instance, MatrixStack stack) {
|
||||
// ClipStack.globalInstance.addWindow(stack,new Rectangle(left,top,width-right,height-bottom));
|
||||
return false;
|
||||
}
|
||||
// @Inject(method="render",at=@At("RETURN"))
|
||||
|
||||
// @Inject(method="render",at=@At("RETURN"))
|
||||
// void e(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
// ClipStack.globalInstance.popWindow();
|
||||
// }
|
||||
@Redirect(method="render",at=@At(
|
||||
value="FIELD",
|
||||
target="Lnet/minecraft/client/gui/widget/EntryListWidget;renderBackground:Z",
|
||||
@Redirect(method = "render", at = @At(
|
||||
value = "FIELD",
|
||||
target = "Lnet/minecraft/client/gui/widget/EntryListWidget;renderBackground:Z",
|
||||
opcode = Opcodes.GETFIELD
|
||||
))
|
||||
boolean r1(EntryListWidget<?> instance) {
|
||||
|
|
|
@ -17,26 +17,28 @@ import java.awt.*;
|
|||
|
||||
@Mixin(Screen.class)
|
||||
public class ScreenMixin {
|
||||
private static final Color c = new Color(10,10,10);
|
||||
@Shadow public int height;
|
||||
private static final Color c = new Color(10, 10, 10);
|
||||
@Shadow
|
||||
public int height;
|
||||
|
||||
@Shadow public int width;
|
||||
@Shadow
|
||||
public int width;
|
||||
|
||||
@Inject(method="renderBackgroundTexture",at=@At("HEAD"),cancellable = true)
|
||||
@Inject(method = "renderBackgroundTexture", at = @At("HEAD"), cancellable = true)
|
||||
void real(int vOffset, CallbackInfo ci) {
|
||||
float r = c.getRed()/255f;
|
||||
float g = c.getGreen()/255f;
|
||||
float b = c.getBlue()/255f;
|
||||
float r = c.getRed() / 255f;
|
||||
float g = c.getGreen() / 255f;
|
||||
float b = c.getBlue() / 255f;
|
||||
ci.cancel();
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
|
||||
bufferBuilder.vertex(0.0D, this.height, 0.0D).color(r,g,b,1f).next();
|
||||
bufferBuilder.vertex(this.width, this.height, 0.0D).color(r,g,b,1f).next();
|
||||
bufferBuilder.vertex(this.width, 0.0D, 0.0D).color(r,g,b,1f).next();
|
||||
bufferBuilder.vertex(0.0D, 0.0D, 0.0D).color(r,g,b,1f).next();
|
||||
bufferBuilder.vertex(0.0D, this.height, 0.0D).color(r, g, b, 1f).next();
|
||||
bufferBuilder.vertex(this.width, this.height, 0.0D).color(r, g, b, 1f).next();
|
||||
bufferBuilder.vertex(this.width, 0.0D, 0.0D).color(r, g, b, 1f).next();
|
||||
bufferBuilder.vertex(0.0D, 0.0D, 0.0D).color(r, g, b, 1f).next();
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@ public class SelectWorldScreen extends Screen {
|
|||
public SelectWorldScreen() {
|
||||
super(Text.of(""));
|
||||
}
|
||||
@Inject(method="render",at=@At("HEAD"))
|
||||
|
||||
@Inject(method = "render", at = @At("HEAD"))
|
||||
void a(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
renderBackground(matrices);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue