This commit is contained in:
0x3C50 2022-03-10 19:11:04 +01:00
parent 9446e1248c
commit 7974027f82
19 changed files with 184 additions and 53 deletions

3
.gitignore vendored
View file

@ -17,4 +17,5 @@ classes/
.project
#fabric
run/
run/
bin/

Binary file not shown.

View file

@ -36,10 +36,10 @@ public class ParticleRenderer {
return;
}
Particle n = new Particle();
n.x = Math.random() * ShadowMain.client.getWindow().getScaledWidth();
n.y = -10;
n.velY = (Math.random() + 1);
n.decline = MathHelper.lerp(Math.random(), 0.05, 0.2);
n.x = ShadowMain.client.getWindow().getScaledWidth()*Math.random();
n.y = ShadowMain.client.getWindow().getScaledHeight()*Math.random();
n.velY = (Math.random()-.5)/4;
n.velX = (Math.random()-.5)/4;
particles.add(n);
}
@ -61,18 +61,15 @@ public class ParticleRenderer {
addParticle();
}
for (Particle particle : particles) {
particle.render(stack);
particle.render(particles, stack);
}
RenderSystem.setShaderColor(1, 1, 1, 1);
}
static class Particle {
final long rotSpeed = (long) MathHelper.lerp(Math.random(), 3000, 10000);
final long rotSpeed2 = (long) MathHelper.lerp(Math.random(), 3000, 10000);
final double velX = 0;
final boolean spinsReverse = Math.random() > .5;
final boolean spinsReverse2 = Math.random() > .5;
double x = 0, y = 0, size = 10, decline = 0.1;
double velX = 0;
double x = 0;
double y = 0;
double velY = 0;
public static BufferBuilder renderPrepare(Color color) {
@ -142,26 +139,60 @@ public class ParticleRenderer {
buffer.vertex(matrix, x1, y1, z2).next();
buffer.vertex(matrix, x1, y2, z2).next();
}
long origLife = (long) (20*MathHelper.lerp(Math.random(),4,6));
long life = origLife;
void move() {
size -= decline;
size = Math.max(0, size);
life--;
life = Math.max(0, life);
// size -= decline;
// size = Math.max(0, size);
x += velX;
y += velY;
double h = ShadowMain.client.getWindow().getScaledHeight();
double w = ShadowMain.client.getWindow().getScaledWidth();
if (x > w || x < 0) {
velX *= -1;
}
if (y > h || y < 0) {
velY *= -1;
}
x = MathHelper.clamp(x,0,w);
y = MathHelper.clamp(y,0,h);
}
void render(MatrixStack stack) {
void render(List<Particle> others, MatrixStack stack) {
long fadeTime = 40;
long startDelta = Math.min(origLife-life,fadeTime);
long endDelta = Math.min(life,fadeTime);
long deltaOverall = Math.min(startDelta,endDelta);
double pk = (deltaOverall/(double)fadeTime);
// ShadowMain.client.textRenderer.draw(stack,pk+"",(float)x,(float)y,0xFFFFFF);
Theme theme = ThemeManager.getMainTheme();
stack.push();
stack.translate(x, y, 0);
stack.multiply(new Quaternion(0, (System.currentTimeMillis() % rotSpeed2) / ((float) rotSpeed2) * 360f * (spinsReverse2 ? -1 : 1), (System.currentTimeMillis() % rotSpeed) / ((float) rotSpeed) * 360f * (spinsReverse ? -1 : 1), true));
// Renderer.R2D.fill(stack, Renderer.Util.lerp(theme.getAccent(), DYING, size / 10d), -size, -size, size, size);
renderOutline(new Vec3d(-size, -size, -size), new Vec3d(size, size, size).multiply(2), Renderer.Util.lerp(theme.getAccent(), DYING, size / 10d), stack);
// stack.translate(x, y, 0);
// stack.multiply(new Quaternion(0, (System.currentTimeMillis() % rotSpeed2) / ((float) rotSpeed2) * 360f * (spinsReverse2 ? -1 : 1), (System.currentTimeMillis() % rotSpeed) / ((float) rotSpeed) * 360f * (spinsReverse ? -1 : 1), true));
// // Renderer.R2D.fill(stack, Renderer.Util.lerp(theme.getAccent(), DYING, size / 10d), -size, -size, size, size);
// renderOutline(new Vec3d(-size, -size, -size), new Vec3d(size, size, size).multiply(2), Renderer.Util.lerp(theme.getAccent(), DYING, size / 10d), stack);
double maxDist = 100;
for (Particle particle : others.stream().filter(particle -> particle != this).toList()) {
double px = particle.x;
double py = particle.y;
double dist = Math.sqrt(Math.pow((px-this.x), 2)+Math.pow((py-this.y),2));
if (dist < maxDist) {
long sd1 = Math.min(particle.origLife-particle.life,fadeTime);
long ed1 = Math.min(particle.life,fadeTime);
long do1 = Math.min(sd1,ed1);
double pk1 = (do1/(double)fadeTime);
double p = 1-(dist/maxDist);
p = Math.min(p, Math.min(pk1, pk));
Renderer.R2D.renderLine(stack,Renderer.Util.lerp(theme.getAccent(),DYING,p),this.x,this.y,px,py);
}
}
stack.pop();
}
boolean isDead() {
return size <= 0;
return life == 0;
}
}
}

View file

@ -109,11 +109,14 @@ public class CategoryDisplay extends Element {
@Override
public boolean scroll(double mouseX, double mouseY, double amount) {
// not needed for now
// for (ModuleDisplay module : getModules()) {
// if (module.scroll(mouseX, mouseY, amount)) return true;
// }
if (amount == 0 || inBounds(mouseX, mouseY)) {
scroll += amount * 10;
double contentHeight = getModules().stream().map(ModuleDisplay::getHeight).reduce(Double::sum).orElse(0d);
double viewerHeight = Math.min(contentHeight, 200);
double viewerHeight = Math.min(contentHeight, 350);
double elScroll = contentHeight - viewerHeight;
scroll = MathHelper.clamp(scroll, -elScroll, 0);
smoothScroll = MathHelper.clamp(smoothScroll, -elScroll, 0);
@ -142,7 +145,7 @@ public class CategoryDisplay extends Element {
double modHeight = getModules().stream().map(ModuleDisplay::getHeight).reduce(Double::sum).orElse(0d);
double modHeightUnclamped = modHeight;
modHeight = Math.min(modHeight, 200);
modHeight = Math.min(modHeight, 350);
modHeight = Math.min(modHeight, modHeight * openAnim); // looks weird but works
this.height = headerHeight() + modHeight; // pre calc height
@ -187,7 +190,7 @@ public class CategoryDisplay extends Element {
}
matrices.pop();
ClipStack.globalInstance.popWindow();
if (modHeightUnclamped > 200) {
if (modHeightUnclamped > 350) {
double elScroll = modHeightUnclamped - modHeight;
double scrollIndex = (smoothScroll * -1) / elScroll;

View file

@ -136,6 +136,14 @@ public class ConfigDisplay extends Element {
}
@Override
public boolean scroll(double mouseX, double mouseY, double amount) {
for (ConfigBase<?> basis : bases) {
if (basis.scroll(mouseX, mouseY, amount)) return true;
}
return super.scroll(mouseX, mouseY, amount);
}
@Override
public boolean charTyped(char c, int mods) {
for (ConfigBase<?> basis : getBases()) {

View file

@ -109,6 +109,14 @@ public class ModuleDisplay extends Element {
cd.tickAnim();
}
@Override
public boolean scroll(double mouseX, double mouseY, double amount) {
if (extendAnim > 0) {
if(cd.scroll(mouseX, mouseY, amount)) return true;
}
return super.scroll(mouseX, mouseY, amount);
}
@Override
public boolean charTyped(char c, int mods) {
return extended && cd.charTyped(c, mods);

View file

@ -9,8 +9,8 @@ import net.shadow.client.helper.font.FontRenderers;
import net.shadow.client.helper.render.Renderer;
public class BooleanSettingEditor extends ConfigBase<BooleanSetting> {
final double rw = 14;
final double rh = 5;
final double rw = 12;
final double rh = 2;
final double rid = 4;
final double margin = .5;
double animProgress = 0;
@ -42,7 +42,7 @@ public class BooleanSettingEditor extends ConfigBase<BooleanSetting> {
double getPreferredX() {
double smoothAnimProgress = easeInOutCubic(animProgress);
return MathHelper.lerp(smoothAnimProgress, x + margin, x + rw - rid - margin);
return MathHelper.lerp(smoothAnimProgress, x, x + rw - rid);
// return configValue.getValue() ? x + rw - rid - margin : x + margin;
}

View file

@ -76,6 +76,17 @@ public class DoubleSettingEditor extends ConfigBase<DoubleSetting> {
}
@Override
public boolean scroll(double mouseX, double mouseY, double amount) {
if (inBounds(mouseX, mouseY)) {
double delta = 1/(double) (configValue.getPrecision()+1);
delta *= amount;
configValue.setValue(MathHelper.clamp(Utils.Math.roundToDecimal(configValue.getValue()+delta, configValue.getPrecision()),configValue.getMin(),configValue.getMax()));
return true;
}
return super.scroll(mouseX, mouseY, amount);
}
@Override
public boolean charTyped(char c, int mods) {
return false;

View file

@ -1,15 +1,21 @@
package net.shadow.client.feature.gui.clickgui.theme;
import net.shadow.client.feature.gui.clickgui.theme.impl.Custom;
import net.shadow.client.feature.gui.clickgui.theme.impl.SipoverV1;
import net.shadow.client.feature.gui.clickgui.theme.impl.Coffee;
import net.shadow.client.feature.gui.clickgui.theme.impl.Shadow;
import net.shadow.client.feature.module.ModuleRegistry;
public class ThemeManager {
static net.shadow.client.feature.module.impl.render.Theme t = ModuleRegistry.getByClass(net.shadow.client.feature.module.impl.render.Theme.class);
static Theme custom = new Custom();
static Theme sippy = new SipoverV1();
static Theme shadow = new Shadow();
static Theme bestThemeEver = new Coffee();
public static Theme getMainTheme() {
return t.isEnabled() ? custom : sippy;
return switch (t.modeSetting.getValue()) {
case Coffee -> bestThemeEver;
case Custom -> custom;
case Shadow -> shadow;
};
}
}

View file

@ -4,7 +4,7 @@ import net.shadow.client.feature.gui.clickgui.theme.Theme;
import java.awt.*;
public class SipoverV1 implements Theme {
public class Coffee implements Theme {
static final Color accent = new Color(0x3AD99D);
static final Color header = new Color(0xFF1D2525, true);
@ -15,7 +15,7 @@ public class SipoverV1 implements Theme {
@Override
public String getName() {
return "Sipover V1";
return "Coffee";
}
@Override

View file

@ -0,0 +1,49 @@
package net.shadow.client.feature.gui.clickgui.theme.impl;
import net.shadow.client.feature.gui.clickgui.theme.Theme;
import java.awt.*;
public class Shadow implements Theme {
static final Color accent = new Color(214,255,255);
static final Color header = new Color(23, 23, 23);
static final Color module = new Color(20,20,20);
static final Color config = new Color(23,23,23);
static final Color active = new Color(101,101,101);
static final Color inactive = new Color(53,53,53);
@Override
public String getName() {
return "Shadow";
}
@Override
public Color getAccent() {
return accent;
}
@Override
public Color getHeader() {
return header;
}
@Override
public Color getModule() {
return module;
}
@Override
public Color getConfig() {
return config;
}
@Override
public Color getActive() {
return active;
}
@Override
public Color getInactive() {
return inactive;
}
}

View file

@ -301,8 +301,8 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
Renderer.R2D.renderQuad(stack, bg, 0, 0, width, height);
title.drawString(stack, "Coffee", 10, 10, 0xFFFFFF, false);
titleSmall.drawString(stack, "Alt manager", 10 + title.getStringWidth("Coffee") + 5, 10 + title.getMarginHeight() - titleSmall.getMarginHeight() - 1, 0xFFFFFF, false);
title.drawString(stack, "Shadow", 10, 10, 0xFFFFFF, false);
titleSmall.drawString(stack, "Alt manager", 10 + title.getStringWidth("Shadow") + 5, 10 + title.getMarginHeight() - titleSmall.getMarginHeight() - 1, 0xFFFFFF, false);
censorMail.render(stack, mouseX, mouseY);
add.render(stack, mouseX, mouseY);
exit.render(stack, mouseX, mouseY);

View file

@ -23,9 +23,9 @@ import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
public class ConsoleScreen extends ClientScreen implements FastTickable {
static final Color BACKGROUND = new Color(60, 60, 60);
private static CoffeeConsoleScreen instance;
private static ConsoleScreen instance;
final Color background = new Color(0, 0, 0, 120);
final List<LogEntry> logs = new ArrayList<>();
ClientScreen parent = null;
@ -34,21 +34,21 @@ public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
double smoothScroll = 0;
double lastLogsHeight = 0;
private CoffeeConsoleScreen() {
private ConsoleScreen() {
super(MSAAFramebuffer.MAX_SAMPLES);
}
public static CoffeeConsoleScreen instance(ClientScreen parent) {
public static ConsoleScreen instance(ClientScreen parent) {
if (instance == null) {
instance = new CoffeeConsoleScreen();
instance = new ConsoleScreen();
}
instance.parent = parent;
return instance;
}
public static CoffeeConsoleScreen instance() {
public static ConsoleScreen instance() {
if (instance == null) {
instance = new CoffeeConsoleScreen();
instance = new ConsoleScreen();
}
return instance;
}

View file

@ -244,8 +244,8 @@ public class HomeScreen extends ClientScreen implements FastTickable {
double totalHeight = 30;
stack.translate(0, (totalHeight + padding) * heiProg, 0);
Renderer.R2D.renderRoundedQuad(stack, new Color(20, 20, 20, 170), padding, height - padding - totalHeight, width - padding, height - padding, 10, 14);
title.drawString(stack, "Coffee", 10f, (float) (height - padding - totalHeight / 2f - title.getMarginHeight() / 2f), 0xFFFFFF, false);
double fw = title.getStringWidth("Coffee") + 5;
title.drawString(stack, "Shadow", 10f, (float) (height - padding - totalHeight / 2f - title.getMarginHeight() / 2f), 0xFFFFFF, false);
double fw = title.getStringWidth("Shadow") + 5;
smaller.drawString(stack, "v" + version + (isDev ? "-dev" : ""), (float) (10f + fw), (float) (height - padding - totalHeight / 2f - title.getMarginHeight() / 2f) + title.getMarginHeight() - smaller.getMarginHeight() - 1, 0xFFFFFF, false);
super.renderInternal(stack, mouseX, mouseY, delta); // render bottom row widgets
stack.pop();

View file

@ -164,7 +164,7 @@ public class LoadingScreen extends ClientScreen implements FastTickable {
}
}
Renderer.R2D.renderQuad(stack, new Color(0, 0, 0, (float) opacity), 0, 0, width, height);
String coffee = "Loading Coffee..";
String coffee = "Loading Shadow...";
double pad = 5;
double textWidth = title.getStringWidth(coffee) + 1;
double textHeight = title.getMarginHeight();

View file

@ -188,7 +188,7 @@ public class Hud extends Module {
values.add(bp.getX() + " " + bp.getY() + " " + bp.getZ());
}
String drawStr = String.join(" | ", values);
double titleWidth = getTitleFr().getStringWidth("Coffee");
double titleWidth = getTitleFr().getStringWidth("Shadow");
double width = titleWidth + 5 + FontRenderers.getRenderer().getStringWidth(drawStr) + 5;
if (values.isEmpty()) {
width = titleWidth + 5;
@ -197,7 +197,7 @@ public class Hud extends Module {
Renderer.R2D.renderQuad(ms, ThemeManager.getMainTheme().getActive(), rootX, rootY, rootX + 1, rootY + height);
Renderer.R2D.renderQuad(ms, ThemeManager.getMainTheme().getModule(), rootX + 1, rootY, rootX + width, rootY + height);
getTitleFr().drawString(ms, "Coffee", rootX + 2, rootY + height / 2d - getTitleFr().getMarginHeight() / 2d, 0xFFFFFF);
getTitleFr().drawString(ms, "Shadow", rootX + 2, rootY + height / 2d - getTitleFr().getMarginHeight() / 2d, 0xFFFFFF);
FontRenderers.getRenderer().drawString(ms, drawStr, rootX + 2 + titleWidth + 5, rootY + height / 2d - FontRenderers.getRenderer().getMarginHeight() / 2d, 0xAAAAAA);
}

View file

@ -2,6 +2,8 @@ package net.shadow.client.feature.module.impl.render;
import net.minecraft.client.util.math.MatrixStack;
import net.shadow.client.feature.config.ColorSetting;
import net.shadow.client.feature.config.EnumSetting;
import net.shadow.client.feature.config.SettingBase;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType;
@ -33,9 +35,21 @@ public class Theme extends Module {
.description("The inactive color")
.get());
public Theme() {
super("CustomTheme", "Allows you to edit the client's appearance (enable to apply)", ModuleType.RENDER);
public enum Mode {
Custom, Shadow, Coffee
}
public EnumSetting<Mode> modeSetting = this.config.create(new EnumSetting.Builder<>(Mode.Shadow)
.name("Theme")
.description("Which preset theme to use")
.get());
public Theme() {
super("Theme", "Allows you to edit the client's appearance", ModuleType.RENDER);
for (SettingBase<?> settingBase : new SettingBase<?>[] {
accent, header, module, configC, active, inactive
}) {
settingBase.showIf(() -> modeSetting.getValue() == Mode.Custom);
}
}
@Override

View file

@ -25,7 +25,7 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.world.RaycastContext;
import net.minecraft.world.World;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.gui.screen.CoffeeConsoleScreen;
import net.shadow.client.feature.gui.screen.ConsoleScreen;
import net.shadow.client.helper.Texture;
import net.shadow.client.helper.font.adapter.FontAdapter;
import net.shadow.client.mixin.IMinecraftClientAccessor;
@ -380,7 +380,7 @@ public class Utils {
t.setStyle(t.getStyle().withColor(TextColor.fromRgb(c.getRGB())));
if (ShadowMain.client.player != null) ShadowMain.client.player.sendMessage(t, false);
// if (c.equals(Color.WHITE)) c = Color.BLACK;
CoffeeConsoleScreen.instance().addLog(new CoffeeConsoleScreen.LogEntry(n, c));
ConsoleScreen.instance().addLog(new ConsoleScreen.LogEntry(n, c));
}
}

View file

@ -8,7 +8,7 @@ import net.minecraft.text.Text;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.CommandRegistry;
import net.shadow.client.feature.gui.screen.CoffeeConsoleScreen;
import net.shadow.client.feature.gui.screen.ConsoleScreen;
import net.shadow.client.feature.module.ModuleRegistry;
import net.shadow.client.feature.module.impl.misc.InfChatLength;
import net.shadow.client.helper.font.FontRenderers;
@ -45,7 +45,7 @@ public class AChatScreenMixin extends Screen {
if (s.startsWith(".")) { // filter all messages starting with .
ShadowMain.client.inGameHud.getChatHud().addToMessageHistory(s);
if (s.equalsIgnoreCase(".console")) {
Utils.TickManager.runInNTicks(2, () -> ShadowMain.client.setScreen(CoffeeConsoleScreen.instance()));
Utils.TickManager.runInNTicks(2, () -> ShadowMain.client.setScreen(ConsoleScreen.instance()));
} else {
CommandRegistry.execute(s.substring(1)); // cut off prefix
}