mirror of
https://github.com/Miasmusa/Shadow.git
synced 2024-11-14 10:54:55 -05:00
the cum fart
This commit is contained in:
parent
16220fe328
commit
9eace66715
21 changed files with 836 additions and 191 deletions
|
@ -11,6 +11,7 @@ repositories {
|
|||
name = "meteor-maven"
|
||||
url = "https://maven.meteordev.org"
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
|
@ -44,7 +45,7 @@ dependencies {
|
|||
|
||||
// Add each module as a dependency
|
||||
apiModules.forEach {
|
||||
impl(fabricApi.module(it, project.fabric_api_version))
|
||||
include(modImplementation(fabricApi.module(it, project.fabric_api_version)))
|
||||
}
|
||||
|
||||
// modImplementation ("net.fabricmc.fabric-api:fabric-resource-loader:0.1.0")
|
||||
|
|
|
@ -2,7 +2,7 @@ org.gradle.jvmargs = -Xmx1G
|
|||
|
||||
#Fabric properties
|
||||
minecraft_version = 1.18.2
|
||||
yarn_mappings = 1.18.2+build.3
|
||||
yarn_mappings = 1.18.2+build.2
|
||||
loader_version = 0.13.3
|
||||
|
||||
#Mod properties
|
||||
|
|
369
src/main/java/net/shadow/client/WhatTheFuck.java
Normal file
369
src/main/java/net/shadow/client/WhatTheFuck.java
Normal file
File diff suppressed because one or more lines are too long
|
@ -4,9 +4,17 @@
|
|||
|
||||
package net.shadow.client.feature.command.impl;
|
||||
|
||||
import io.netty.util.internal.shaded.org.jctools.util.UnsafeAccess;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.shadow.client.WhatTheFuck;
|
||||
import net.shadow.client.feature.command.Command;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
public class Test extends Command {
|
||||
public Test() {
|
||||
super("Test", "REAL", "test");
|
||||
|
@ -14,6 +22,26 @@ public class Test extends Command {
|
|||
|
||||
@Override
|
||||
public void onExecute(String[] args) {
|
||||
UnsafeAccess.UNSAFE.throwException(new ClassFormatError("AMONG US SUSSY!!!"));
|
||||
WhatTheFuck.loadTags();
|
||||
try {
|
||||
File out = new File("nbt.shit");
|
||||
FileOutputStream fos = new FileOutputStream(out);
|
||||
for (Field declaredField : WhatTheFuck.class.getDeclaredFields()) {
|
||||
if (declaredField.getType().equals(List.class)) {
|
||||
declaredField.setAccessible(true);
|
||||
List<ItemStack> l = (List<ItemStack>) declaredField.get(null);
|
||||
for (ItemStack stack : l) {
|
||||
String fName = stack.getItem().toString();
|
||||
String nbt = Base64.getEncoder().encodeToString(stack.getOrCreateNbt().toString().getBytes(StandardCharsets.UTF_8));
|
||||
String p = declaredField.getName() + ";" + fName + ";" + nbt;
|
||||
fos.write((p + "\n").getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
fos.close();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved.
|
||||
*/
|
||||
|
||||
package net.shadow.client.feature.gui;
|
||||
|
||||
public interface HasSpecialCursor {
|
||||
long getCursor();
|
||||
|
||||
boolean shouldApplyCustomCursor();
|
||||
}
|
|
@ -83,7 +83,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
final FontAdapter title = FontRenderers.getCustomSize(40);
|
||||
final AtomicBoolean isLoggingIn = new AtomicBoolean(false);
|
||||
AltContainer selectedAlt;
|
||||
ThemedButton add, exit, remove, tags, login, session, censorMail;
|
||||
net.shadow.client.feature.gui.widget.RoundButton add, exit, remove, tags, login, session, censorMail;
|
||||
RoundTextFieldWidget search;
|
||||
boolean censorEmail = true;
|
||||
double scroll = 0;
|
||||
|
@ -188,16 +188,16 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
|
||||
void toggleCensor() {
|
||||
censorEmail = !censorEmail;
|
||||
censorMail.text = censorEmail ? "Show email" : "Hide email";
|
||||
censorMail.setText(censorEmail ? "Show email" : "Hide email");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
search = new RoundTextFieldWidget(width - 200 - 5 - 100 - 5 - 60 - 5 - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 200, 20, "Search");
|
||||
addDrawableChild(search);
|
||||
censorMail = new ThemedButton(width - 100 - 5 - 60 - 5 - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 100, 20, "Show email", this::toggleCensor);
|
||||
add = new ThemedButton(width - 60 - 5 - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 60, 20, "Add", () -> client.setScreen(new AddScreenOverlay(this)));
|
||||
exit = new ThemedButton(width - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 20, 20, "X", this::close);
|
||||
censorMail = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, width - 100 - 5 - 60 - 5 - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 100, 20, "Show email", this::toggleCensor);
|
||||
add = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, width - 60 - 5 - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 60, 20, "Add", () -> client.setScreen(new AddScreenOverlay(this)));
|
||||
exit = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, width - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 20, 20, "X", this::close);
|
||||
|
||||
double padding = 5;
|
||||
double widRHeight = 64 + padding * 2;
|
||||
|
@ -207,15 +207,23 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
double fromX = width - (leftWidth + getPadding());
|
||||
double texDim = widRHeight - padding * 2;
|
||||
double buttonWidth = (toX - (fromX + texDim + padding * 2)) / 3d - padding / 4d;
|
||||
login = new ThemedButton(fromX + texDim + padding * 2, toY - 20 - padding, buttonWidth - padding, 20, "Login", this::login);
|
||||
remove = new ThemedButton(fromX + texDim + padding * 2 + buttonWidth + padding / 2d, toY - 20 - padding, buttonWidth - padding, 20, "Remove", this::remove);
|
||||
tags = new ThemedButton(fromX + texDim + padding * 2 + buttonWidth + padding / 2d + buttonWidth + padding / 2d, toY - 20 - padding, buttonWidth - padding, 20, "Tags", this::editTags);
|
||||
login = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, fromX + texDim + padding * 2, toY - 20 - padding, buttonWidth - padding, 20, "Login", this::login);
|
||||
remove = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, fromX + texDim + padding * 2 + buttonWidth + padding / 2d, toY - 20 - padding, buttonWidth - padding, 20, "Remove", this::remove);
|
||||
tags = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, fromX + texDim + padding * 2 + buttonWidth + padding / 2d + buttonWidth + padding / 2d, toY - 20 - padding, buttonWidth - padding, 20, "Tags", this::editTags);
|
||||
|
||||
toY = height - getPadding();
|
||||
buttonWidth = toX - fromX - padding * 3 - texDim;
|
||||
session = new ThemedButton(fromX + texDim + padding * 2, toY - 20 - padding, buttonWidth, 20, "Session", () -> {
|
||||
session = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, fromX + texDim + padding * 2, toY - 20 - padding, buttonWidth, 20, "Session", () -> {
|
||||
Objects.requireNonNull(client).setScreen(new SessionEditor(this, ShadowMain.client.getSession())); // this is not a session stealer
|
||||
});
|
||||
|
||||
addDrawableChild(censorMail);
|
||||
addDrawableChild(add);
|
||||
addDrawableChild(exit);
|
||||
addDrawableChild(login);
|
||||
addDrawableChild(remove);
|
||||
addDrawableChild(tags);
|
||||
addDrawableChild(session);
|
||||
}
|
||||
|
||||
void editTags() {
|
||||
|
@ -283,13 +291,6 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
for (AltContainer alt : getAlts()) {
|
||||
alt.tickAnim();
|
||||
}
|
||||
censorMail.tickAnim();
|
||||
add.tickAnim();
|
||||
exit.tickAnim();
|
||||
remove.tickAnim();
|
||||
login.tickAnim();
|
||||
tags.tickAnim();
|
||||
session.tickAnim();
|
||||
scrollSmooth = Transitions.transition(scrollSmooth, scroll, 7, 0);
|
||||
}
|
||||
|
||||
|
@ -312,9 +313,6 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
Renderer.R2D.renderQuad(stack, bg, 0, 0, width, height);
|
||||
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);
|
||||
|
||||
ClipStack.globalInstance.addWindow(stack, new Rectangle(getPadding() - 5, getHeaderHeight(), getPadding() + (width - (getPadding() + leftWidth + getPadding() * 2)) + 5, height));
|
||||
//Renderer.R2D.beginScissor(stack, getPadding(), getHeaderHeight(), getPadding() + (width - (getPadding() + leftWidth + getPadding() * 2)), height);
|
||||
|
@ -350,7 +348,12 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
double toY = fromY + widRHeight;
|
||||
|
||||
Renderer.R2D.renderRoundedQuad(stack, pillColor, fromX, fromY, toX, toY, 5, 20);
|
||||
if (selectedAlt != null) {
|
||||
boolean vis = selectedAlt != null;
|
||||
remove.setVisible(vis);
|
||||
login.setVisible(vis);
|
||||
tags.setVisible(vis);
|
||||
if (vis) {
|
||||
|
||||
double texDim = widRHeight - padding * 2;
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
|
@ -389,9 +392,6 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
prop.cfr.drawString(stack, prop.name, (float) (fromX + padding + texDim + padding), propsOffset, prop.color, false);
|
||||
propsOffset += prop.cfr.getMarginHeight();
|
||||
}
|
||||
remove.render(stack, mouseX, mouseY);
|
||||
login.render(stack, mouseX, mouseY);
|
||||
tags.render(stack, mouseX, mouseY);
|
||||
}
|
||||
|
||||
toY = height - getPadding();
|
||||
|
@ -430,7 +430,6 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
prop.cfr.drawString(stack, prop.name, (float) (fromX + padding + texDim + padding), propsOffset, prop.color, false);
|
||||
propsOffset += prop.cfr.getMarginHeight();
|
||||
}
|
||||
session.render(stack, mouseX, mouseY);
|
||||
|
||||
super.renderInternal(stack, mouseX, mouseY, delta);
|
||||
}
|
||||
|
@ -439,95 +438,86 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
Rectangle rBounds = new Rectangle(getPadding(), getHeaderHeight(), getPadding() + (width - (getPadding() + leftWidth + getPadding() * 2)), height);
|
||||
|
||||
censorMail.clicked(mouseX, mouseY);
|
||||
if (isLoggingIn.get()) {
|
||||
return false;
|
||||
}
|
||||
add.clicked(mouseX, mouseY);
|
||||
exit.clicked(mouseX, mouseY);
|
||||
if (this.selectedAlt != null) {
|
||||
login.clicked(mouseX, mouseY);
|
||||
tags.clicked(mouseX, mouseY);
|
||||
remove.clicked(mouseX, mouseY);
|
||||
}
|
||||
session.clicked(mouseX, mouseY);
|
||||
|
||||
boolean a = super.mouseClicked(mouseX, mouseY, button);
|
||||
if (a) return true;
|
||||
if (mouseX >= rBounds.getX() && mouseX <= rBounds.getX1() && mouseY >= rBounds.getY() && mouseY <= rBounds.getY1()) {
|
||||
for (AltContainer alt : getAlts()) {
|
||||
alt.clicked(mouseX, mouseY + scrollSmooth);
|
||||
}
|
||||
}
|
||||
|
||||
return super.mouseClicked(mouseX, mouseY, button);
|
||||
return false;
|
||||
}
|
||||
|
||||
static class ThemedButton {
|
||||
final Runnable onPress;
|
||||
final double width;
|
||||
final double height;
|
||||
String text;
|
||||
double x;
|
||||
double y;
|
||||
double animProgress = 0;
|
||||
boolean isHovered = false;
|
||||
boolean enabled = true;
|
||||
|
||||
|
||||
public ThemedButton(double x, double y, double w, double h, String t, Runnable a) {
|
||||
this.onPress = a;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
this.text = t;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public void tickAnim() {
|
||||
double d = 0.04;
|
||||
if (!isHovered) {
|
||||
d *= -1;
|
||||
}
|
||||
animProgress += d;
|
||||
animProgress = MathHelper.clamp(animProgress, 0, 1);
|
||||
|
||||
}
|
||||
|
||||
double easeInOutQuint(double x) {
|
||||
return x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2;
|
||||
}
|
||||
|
||||
boolean inBounds(double cx, double cy) {
|
||||
return cx >= x && cx < x + width && cy >= y && cy < y + height;
|
||||
}
|
||||
|
||||
public void render(MatrixStack matrices, double mx, double my) {
|
||||
isHovered = inBounds(mx, my) && isEnabled();
|
||||
matrices.push();
|
||||
matrices.translate(x + width / 2d, y + height / 2d, 0);
|
||||
float animProgress = (float) easeInOutQuint(this.animProgress);
|
||||
matrices.scale(MathHelper.lerp(animProgress, 1f, 0.95f), MathHelper.lerp(animProgress, 1f, 0.95f), 1f);
|
||||
double originX = -width / 2d;
|
||||
double originY = -height / 2d;
|
||||
Renderer.R2D.renderRoundedQuad(matrices, widgetColor, originX, originY, width / 2d, height / 2d, 5, 20);
|
||||
FontRenderers.getRenderer().drawString(matrices, text, -(FontRenderers.getRenderer().getStringWidth(text)) / 2f, -FontRenderers.getRenderer()
|
||||
.getMarginHeight() / 2f, isEnabled() ? 0xFFFFFF : 0xAAAAAA, false);
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
public void clicked(double mx, double my) {
|
||||
if (inBounds(mx, my) && isEnabled()) {
|
||||
onPress.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
// static class RoundButton {
|
||||
// final Runnable onPress;
|
||||
// final double width;
|
||||
// final double height;
|
||||
// String text;
|
||||
// double x;
|
||||
// double y;
|
||||
// double animProgress = 0;
|
||||
// boolean isHovered = false;
|
||||
// boolean enabled = true;
|
||||
//
|
||||
//
|
||||
// public RoundButton(double x, double y, double w, double h, String t, Runnable a) {
|
||||
// this.onPress = a;
|
||||
// this.x = x;
|
||||
// this.y = y;
|
||||
// this.width = w;
|
||||
// this.height = h;
|
||||
// this.text = t;
|
||||
// }
|
||||
//
|
||||
// public boolean isEnabled() {
|
||||
// return enabled;
|
||||
// }
|
||||
//
|
||||
// public void setEnabled(boolean enabled) {
|
||||
// this.enabled = enabled;
|
||||
// }
|
||||
//
|
||||
// public void tickAnim() {
|
||||
// double d = 0.04;
|
||||
// if (!isHovered) {
|
||||
// d *= -1;
|
||||
// }
|
||||
// animProgress += d;
|
||||
// animProgress = MathHelper.clamp(animProgress, 0, 1);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// double easeInOutQuint(double x) {
|
||||
// return x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2;
|
||||
// }
|
||||
//
|
||||
// boolean inBounds(double cx, double cy) {
|
||||
// return cx >= x && cx < x + width && cy >= y && cy < y + height;
|
||||
// }
|
||||
//
|
||||
// public void render(MatrixStack matrices, double mx, double my) {
|
||||
// isHovered = inBounds(mx, my) && isEnabled();
|
||||
// matrices.push();
|
||||
// matrices.translate(x + width / 2d, y + height / 2d, 0);
|
||||
// float animProgress = (float) easeInOutQuint(this.animProgress);
|
||||
// matrices.scale(MathHelper.lerp(animProgress, 1f, 0.95f), MathHelper.lerp(animProgress, 1f, 0.95f), 1f);
|
||||
// double originX = -width / 2d;
|
||||
// double originY = -height / 2d;
|
||||
// Renderer.R2D.renderRoundedQuad(matrices, widgetColor, originX, originY, width / 2d, height / 2d, 5, 20);
|
||||
// FontRenderers.getRenderer().drawString(matrices, text, -(FontRenderers.getRenderer().getStringWidth(text)) / 2f, -FontRenderers.getRenderer()
|
||||
// .getMarginHeight() / 2f, isEnabled() ? 0xFFFFFF : 0xAAAAAA, false);
|
||||
// matrices.pop();
|
||||
// }
|
||||
//
|
||||
// public void clicked(double mx, double my) {
|
||||
// if (inBounds(mx, my) && isEnabled()) {
|
||||
// onPress.run();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
static class AltStorage {
|
||||
final String email;
|
||||
|
@ -558,7 +548,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
final double padding = 5;
|
||||
final FontAdapter title = FontRenderers.getCustomSize(40);
|
||||
RoundTextFieldWidget access, name, uuid;
|
||||
RoundButton save;
|
||||
net.shadow.client.feature.gui.widget.RoundButton save;
|
||||
|
||||
public SessionEditor(ClientScreen parent, Session s) {
|
||||
super(MSAAFramebuffer.MAX_SAMPLES);
|
||||
|
@ -568,7 +558,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
|
||||
@Override
|
||||
protected void init() {
|
||||
RoundButton exit = new RoundButton(widgetColor, width - 20 - 5, 5, 20, 20, "X", () -> Objects.requireNonNull(client).setScreen(parent));
|
||||
net.shadow.client.feature.gui.widget.RoundButton exit = new net.shadow.client.feature.gui.widget.RoundButton(widgetColor, width - 20 - 5, 5, 20, 20, "X", () -> Objects.requireNonNull(client).setScreen(parent));
|
||||
addDrawableChild(exit);
|
||||
double y = height / 2d - widgetHei / 2d + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding;
|
||||
RoundTextFieldWidget accessToken = new RoundTextFieldWidget(width / 2d - (widgetWid - padding * 2) / 2d, y, widgetWid - padding * 2, 20, "Access token");
|
||||
|
@ -580,7 +570,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
RoundTextFieldWidget uuid = new RoundTextFieldWidget(width / 2d - (widgetWid - padding * 2) / 2d, y, widgetWid - padding * 2, 20, "UUID");
|
||||
uuid.setText(session.getUuid());
|
||||
y += uuid.getHeight() + padding;
|
||||
RoundButton save = new RoundButton(widgetColor, width / 2d - (widgetWid - padding * 2) / 2d, y, widgetWid - padding * 2, 20, "Save", () -> {
|
||||
net.shadow.client.feature.gui.widget.RoundButton save = new net.shadow.client.feature.gui.widget.RoundButton(widgetColor, width / 2d - (widgetWid - padding * 2) / 2d, y, widgetWid - padding * 2, 20, "Save", () -> {
|
||||
SessionAccessor sa = (SessionAccessor) session;
|
||||
sa.setUsername(username.get());
|
||||
sa.setAccessToken(accessToken.get());
|
||||
|
@ -645,11 +635,11 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
}
|
||||
|
||||
class TagEditor extends ClientScreen implements FastTickable {
|
||||
final List<ThemedButton> tags = new ArrayList<>();
|
||||
final List<RoundButton> tags = new ArrayList<>();
|
||||
final double widgetWidth = 300;
|
||||
final Screen parent;
|
||||
RoundTextFieldWidget tagName;
|
||||
RoundButton add;
|
||||
net.shadow.client.feature.gui.widget.RoundButton add;
|
||||
double widgetHeight = 0;
|
||||
double widgetStartX, widgetStartY;
|
||||
|
||||
|
@ -660,16 +650,16 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
|
||||
@Override
|
||||
public void onFastTick() {
|
||||
for (ThemedButton tag : tags) {
|
||||
tag.tickAnim();
|
||||
for (RoundButton tag : tags) {
|
||||
tag.onFastTick();
|
||||
}
|
||||
add.onFastTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
for (ThemedButton tag : new ArrayList<>(tags)) {
|
||||
tag.clicked(mouseX, mouseY);
|
||||
for (RoundButton tag : new ArrayList<>(tags)) {
|
||||
tag.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
tagName.mouseClicked(mouseX, mouseY, button);
|
||||
add.mouseClicked(mouseX, mouseY, button);
|
||||
|
@ -690,7 +680,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
|
||||
@Override
|
||||
protected void init() {
|
||||
RoundButton exit = new RoundButton(RoundButton.STANDARD, width - 20 - 5, 5, 20, 20, "X", this::close);
|
||||
net.shadow.client.feature.gui.widget.RoundButton exit = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, width - 20 - 5, 5, 20, 20, "X", this::close);
|
||||
addDrawableChild(exit);
|
||||
this.tags.clear();
|
||||
String tags = selectedAlt.storage.tags;
|
||||
|
@ -708,7 +698,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
xOffset = 5;
|
||||
yOffset += FontRenderers.getRenderer().getMarginHeight() + 4 + 2;
|
||||
}
|
||||
ThemedButton inst = new ThemedButton(xOffset, yOffset, width, FontRenderers.getRenderer().getMarginHeight() + 4, s, () -> {
|
||||
RoundButton inst = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, xOffset, yOffset, width, FontRenderers.getRenderer().getMarginHeight() + 4, s, () -> {
|
||||
parsedTags.remove(s);
|
||||
selectedAlt.storage.tags = String.join(",", parsedTags);
|
||||
init();
|
||||
|
@ -718,7 +708,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
}
|
||||
double yBase = parsedTags.isEmpty() ? 0 : yOffset + FontRenderers.getRenderer().getMarginHeight() + 4 + padding;
|
||||
tagName = new RoundTextFieldWidget(5, yBase, widgetWidth - 60 - padding * 3, widgetsHeight, "Tag name");
|
||||
add = new RoundButton(RoundButton.STANDARD, tagName.getX() + tagName.getWidth() + padding, yBase, 60, widgetsHeight, "Add", () -> {
|
||||
add = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, tagName.getX() + tagName.getWidth() + padding, yBase, 60, widgetsHeight, "Add", () -> {
|
||||
if (tagName.get().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -733,9 +723,9 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
widgetStartY = height / 2d - widgetHeight / 2d;
|
||||
double widgetStartY = this.widgetStartY + padding;
|
||||
|
||||
for (ThemedButton tag : this.tags) {
|
||||
tag.x += widgetStartX;
|
||||
tag.y += widgetStartY;
|
||||
for (RoundButton tag : this.tags) {
|
||||
tag.setX(tag.getX() + widgetStartX);
|
||||
tag.setY(tag.getY() + widgetStartY);
|
||||
}
|
||||
tagName.setX(tagName.getX() + widgetStartX);
|
||||
tagName.setY(tagName.getY() + widgetStartY);
|
||||
|
@ -755,8 +745,8 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
}
|
||||
Renderer.R2D.renderQuad(stack, backgroundOverlay, 0, 0, width, height);
|
||||
Renderer.R2D.renderRoundedQuad(stack, overlayBackground, widgetStartX, widgetStartY, widgetStartX + widgetWidth, widgetStartY + widgetHeight, 5, 20);
|
||||
for (ThemedButton tag : tags) {
|
||||
tag.render(stack, mouseX, mouseY);
|
||||
for (RoundButton tag : tags) {
|
||||
tag.render(stack, mouseX, mouseY, delta);
|
||||
}
|
||||
tagName.render(stack, mouseX, mouseY, delta);
|
||||
add.render(stack, mouseX, mouseY, delta);
|
||||
|
@ -768,14 +758,14 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
static final double widgetWid = 200;
|
||||
static int accountTypeI = 0;
|
||||
static double widgetHei = 0;
|
||||
final List<ThemedButton> buttons = new ArrayList<>();
|
||||
final List<RoundButton> buttons = new ArrayList<>();
|
||||
final ClientScreen parent;
|
||||
final double padding = 5;
|
||||
final FontAdapter title = FontRenderers.getCustomSize(40);
|
||||
RoundTextFieldWidget email;
|
||||
RoundTextFieldWidget passwd;
|
||||
ThemedButton type;
|
||||
ThemedButton add;
|
||||
RoundButton type;
|
||||
RoundButton add;
|
||||
|
||||
public AddScreenOverlay(ClientScreen parent) {
|
||||
super(MSAAFramebuffer.MAX_SAMPLES);
|
||||
|
@ -784,12 +774,12 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
|
||||
@Override
|
||||
protected void init() {
|
||||
ThemedButton exit = new ThemedButton(width - 20 - 5, 5, 20, 20, "X", () -> Objects.requireNonNull(client).setScreen(parent));
|
||||
RoundButton exit = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, width - 20 - 5, 5, 20, 20, "X", () -> Objects.requireNonNull(client).setScreen(parent));
|
||||
buttons.add(exit);
|
||||
email = new RoundTextFieldWidget(width / 2d - (widgetWid - padding * 2) / 2d, height / 2d - widgetHei / 2d + padding, widgetWid - padding * 2, 20, "E-Mail or username");
|
||||
passwd = new RoundTextFieldWidget(width / 2d - (widgetWid - padding * 2) / 2d, height / 2d - widgetHei / 2d + padding * 2 + 20, widgetWid - padding * 2, 20, "Password");
|
||||
type = new ThemedButton(0, 0, widgetWid / 2d - padding * 1.5, 20, "Type: " + AccountType.values()[accountTypeI].s, this::cycle);
|
||||
add = new ThemedButton(0, 0, widgetWid / 2d - padding * 1.5, 20, "Add", this::add);
|
||||
type = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, 0, 0, widgetWid / 2d - padding * 1.5, 20, "Type: " + AccountType.values()[accountTypeI].s, this::cycle);
|
||||
add = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, 0, 0, widgetWid / 2d - padding * 1.5, 20, "Add", this::add);
|
||||
}
|
||||
|
||||
void add() {
|
||||
|
@ -814,27 +804,27 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
if (accountTypeI >= AccountType.values().length) {
|
||||
accountTypeI = 0;
|
||||
}
|
||||
type.text = "Type: " + AccountType.values()[accountTypeI].s;
|
||||
type.setText("Type: " + AccountType.values()[accountTypeI].s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFastTick() {
|
||||
for (ThemedButton button : buttons) {
|
||||
button.tickAnim();
|
||||
for (RoundButton button : buttons) {
|
||||
button.onFastTick();
|
||||
}
|
||||
type.tickAnim();
|
||||
add.tickAnim();
|
||||
type.onFastTick();
|
||||
add.onFastTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
for (ThemedButton themedButton : buttons) {
|
||||
themedButton.clicked(mouseX, mouseY);
|
||||
for (RoundButton themedButton : buttons) {
|
||||
themedButton.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
email.mouseClicked(mouseX, mouseY, button);
|
||||
passwd.mouseClicked(mouseX, mouseY, button);
|
||||
type.clicked(mouseX, mouseY);
|
||||
add.clicked(mouseX, mouseY);
|
||||
type.mouseClicked(mouseX, mouseY, button);
|
||||
add.mouseClicked(mouseX, mouseY, button);
|
||||
return super.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
|
@ -845,8 +835,8 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
}
|
||||
Renderer.R2D.renderQuad(stack, backgroundOverlay, 0, 0, width, height);
|
||||
|
||||
for (ThemedButton button : buttons) {
|
||||
button.render(stack, mouseX, mouseY);
|
||||
for (RoundButton button : buttons) {
|
||||
button.render(stack, mouseX, mouseY, delta);
|
||||
}
|
||||
double centerX = width / 2d;
|
||||
double centerY = height / 2d;
|
||||
|
@ -865,15 +855,15 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
passwd.setY(originY + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding + email.getHeight() + padding);
|
||||
passwd.setWidth(widgetWid - padding * 2);
|
||||
passwd.render(stack, mouseX, mouseY, 0);
|
||||
type.x = originX + padding;
|
||||
type.y = originY + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding;
|
||||
type.render(stack, mouseX, mouseY);
|
||||
add.x = originX + padding + type.width + padding;
|
||||
add.y = originY + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding;
|
||||
type.setX(originX + padding);
|
||||
type.setY(originY + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding);
|
||||
type.render(stack, mouseX, mouseY, delta);
|
||||
add.setX(originX + padding + type.getWidth() + padding);
|
||||
add.setY(originY + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding);
|
||||
add.setEnabled(isAddApplicable());
|
||||
add.render(stack, mouseX, mouseY);
|
||||
add.render(stack, mouseX, mouseY, delta);
|
||||
widgetHei = padding + title.getMarginHeight() + FontRenderers.getRenderer()
|
||||
.getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding + type.height + padding;
|
||||
.getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding + type.getHeight() + padding;
|
||||
stack.pop();
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1065,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
float h = FontRenderers.getRenderer().getMarginHeight();
|
||||
float pad = 2;
|
||||
w += pad * 2;
|
||||
Renderer.R2D.renderRoundedQuad(stack, RoundButton.STANDARD, originX + padding + texWidth + padding + xOff, originY + getHeight() - h - pad * 2 - padding, originX + padding + texWidth + padding + xOff + w, originY + getHeight() - padding, 5, 10);
|
||||
Renderer.R2D.renderRoundedQuad(stack, net.shadow.client.feature.gui.widget.RoundButton.STANDARD, originX + padding + texWidth + padding + xOff, originY + getHeight() - h - pad * 2 - padding, originX + padding + texWidth + padding + xOff + w, originY + getHeight() - padding, 5, 10);
|
||||
FontRenderers.getRenderer()
|
||||
.drawString(stack, v, originX + padding + texWidth + padding + xOff + pad, originY + getHeight() - pad - FontRenderers.getRenderer().getMarginHeight() - padding, 0xFFFFFF);
|
||||
xOff += w + 2;
|
||||
|
@ -1094,4 +1084,4 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
|
|||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
package net.shadow.client.feature.gui.widget;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.minecraft.client.gui.Drawable;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.Selectable;
|
||||
|
@ -12,12 +14,14 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
import net.shadow.client.feature.gui.DoesMSAA;
|
||||
import net.shadow.client.feature.gui.FastTickable;
|
||||
import net.shadow.client.feature.gui.HasSpecialCursor;
|
||||
import net.shadow.client.helper.font.FontRenderers;
|
||||
import net.shadow.client.helper.render.Cursor;
|
||||
import net.shadow.client.helper.render.Renderer;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
public class RoundButton implements Element, Drawable, Selectable, FastTickable, DoesMSAA {
|
||||
public class RoundButton implements Element, Drawable, Selectable, FastTickable, DoesMSAA, HasSpecialCursor {
|
||||
|
||||
public static final Color STANDARD = new Color(40, 40, 40);
|
||||
|
||||
|
@ -28,6 +32,9 @@ public class RoundButton implements Element, Drawable, Selectable, FastTickable,
|
|||
double animProgress = 0;
|
||||
boolean isHovered = false;
|
||||
boolean enabled = true;
|
||||
@Setter
|
||||
@Getter
|
||||
boolean visible = true;
|
||||
|
||||
public RoundButton(Color color, double x, double y, double w, double h, String t, Runnable a) {
|
||||
this.onPress = a;
|
||||
|
@ -39,6 +46,16 @@ public class RoundButton implements Element, Drawable, Selectable, FastTickable,
|
|||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCursor() {
|
||||
return Cursor.CLICK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyCustomCursor() {
|
||||
return isHovered;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
@ -104,6 +121,7 @@ public class RoundButton implements Element, Drawable, Selectable, FastTickable,
|
|||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
isHovered = inBounds(mouseX, mouseY) && isEnabled();
|
||||
if (!isVisible()) return;
|
||||
matrices.push();
|
||||
matrices.translate(x + width / 2d, y + height / 2d, 0);
|
||||
float animProgress = (float) easeInOutQuint(this.animProgress);
|
||||
|
@ -129,6 +147,7 @@ public class RoundButton implements Element, Drawable, Selectable, FastTickable,
|
|||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
if (!isVisible()) return false;
|
||||
if (inBounds(mouseX, mouseY) && isEnabled() && button == 0) {
|
||||
onPress.run();
|
||||
return true;
|
||||
|
|
|
@ -13,8 +13,10 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
import net.shadow.client.ShadowMain;
|
||||
import net.shadow.client.feature.gui.DoesMSAA;
|
||||
import net.shadow.client.feature.gui.HasSpecialCursor;
|
||||
import net.shadow.client.helper.font.FontRenderers;
|
||||
import net.shadow.client.helper.render.ClipStack;
|
||||
import net.shadow.client.helper.render.Cursor;
|
||||
import net.shadow.client.helper.render.Rectangle;
|
||||
import net.shadow.client.helper.render.Renderer;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
|
@ -22,7 +24,7 @@ import org.lwjgl.glfw.GLFW;
|
|||
|
||||
import java.awt.Color;
|
||||
|
||||
public class RoundTextFieldWidget implements Element, Drawable, Selectable, DoesMSAA {
|
||||
public class RoundTextFieldWidget implements Element, Drawable, Selectable, DoesMSAA, HasSpecialCursor {
|
||||
protected final String suggestion;
|
||||
public Runnable changeListener = () -> {
|
||||
};
|
||||
|
@ -42,6 +44,16 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
|
|||
this.suggestion = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyCustomCursor() {
|
||||
return mouseOver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCursor() {
|
||||
return Cursor.TEXT_EDIT;
|
||||
}
|
||||
|
||||
protected double maxTextWidth() {
|
||||
return width - pad() * 2 - 1;
|
||||
}
|
||||
|
|
|
@ -7,25 +7,61 @@ package net.shadow.client.feature.itemMenu;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemGroupRegistry {
|
||||
public static ShadItemGroup EXPLOITS = new ShadItemGroup("Exploits", new ItemStack(Items.ARMOR_STAND));
|
||||
public static ShadItemGroup GRIEF = new ShadItemGroup("Grief", new ItemStack(Items.TNT));
|
||||
public static ShadItemGroup CRASH = new ShadItemGroup("Crash", new ItemStack(Items.FIRE_CHARGE));
|
||||
public static List<ShadItemGroupEntry> groups = Util.make(() -> {
|
||||
List<ShadItemGroupEntry> entries = new ArrayList<>();
|
||||
entries.add(new ShadItemGroupEntry(new ShadItemGroup("Exploits", new ItemStack(Items.ARMOR_STAND)), "exploit"));
|
||||
entries.add(new ShadItemGroupEntry(new ShadItemGroup("Grief", new ItemStack(Items.TNT)), "grief"));
|
||||
entries.add(new ShadItemGroupEntry(new ShadItemGroup("Special", new ItemStack(Items.STRUCTURE_VOID)), "special"));
|
||||
return entries;
|
||||
});
|
||||
|
||||
public static void addItem(ShadItemGroup group, ItemStack stack) {
|
||||
group.addItem(stack);
|
||||
public static void addItem(String id, ItemStack stack) {
|
||||
ShadItemGroupEntry se = groups.stream().filter(shadItemGroupEntry -> shadItemGroupEntry.id.equals(id)).findFirst().orElseThrow();
|
||||
se.group.addItem(stack);
|
||||
}
|
||||
|
||||
public static void addItem(ShadItemGroup group, Item item, String nbt) {
|
||||
group.addItem(item, nbt);
|
||||
public static void addItem(String id, Item item, String nbt) {
|
||||
ShadItemGroupEntry se = groups.stream().filter(shadItemGroupEntry -> shadItemGroupEntry.id.equals(id)).findFirst().orElseThrow();
|
||||
se.group.addItem(item, nbt);
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
initExploits();
|
||||
}
|
||||
|
||||
// COURTESY OF SATURNS SHITTY CODE, CONVERTED WITH A CODEGEN
|
||||
// DO NOT COMPLAIN ABOUT THIS
|
||||
static void initExploits() {
|
||||
addItem(ItemGroupRegistry.CRASH, Items.ARMOR_STAND, "{EntityTag:{CustomName:\"\\\"Amogi\\\"\", CustomNameVisible: true}}");
|
||||
try {
|
||||
InputStream is = ItemGroupRegistry.class.getClassLoader().getResourceAsStream("itemRegistry.txt");
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
String[] split = line.split(";");
|
||||
String gid = split[0];
|
||||
String iid = split[1];
|
||||
Item i = Registry.ITEM.get(new Identifier(iid));
|
||||
String nbt = new String(Base64.getDecoder().decode(split[2]));
|
||||
addItem(gid, i, nbt);
|
||||
}
|
||||
is.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
record ShadItemGroupEntry(ShadItemGroup group, String id) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,7 +218,6 @@ public class CarpetBomb extends Module {
|
|||
Renderer.R2D.renderQuad(translated, Color.RED, -.5, -10, .5, 10);
|
||||
Renderer.R2D.renderQuad(translated, Color.RED, -10, -.5, 10, .5);
|
||||
translated.pop();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.shadow.client.ShadowMain;
|
|||
import net.shadow.client.feature.module.Module;
|
||||
import net.shadow.client.feature.module.ModuleType;
|
||||
import net.shadow.client.feature.module.NoNotificationDefault;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@NoNotificationDefault
|
||||
public class ClickGUI extends Module {
|
||||
|
@ -16,6 +17,7 @@ public class ClickGUI extends Module {
|
|||
|
||||
public ClickGUI() {
|
||||
super("ClickGUI", "A visual manager for all modules", ModuleType.RENDER);
|
||||
this.keybind.accept(GLFW.GLFW_KEY_RIGHT_SHIFT + "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,17 +5,21 @@
|
|||
package net.shadow.client.feature.module.impl.render;
|
||||
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.GameMode;
|
||||
import net.shadow.client.feature.module.Module;
|
||||
import net.shadow.client.feature.module.ModuleType;
|
||||
import net.shadow.client.helper.font.FontRenderers;
|
||||
import net.shadow.client.helper.font.adapter.FontAdapter;
|
||||
import net.shadow.client.helper.render.Renderer;
|
||||
import net.shadow.client.helper.util.Utils;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Comparator;
|
||||
|
||||
import static net.shadow.client.feature.module.impl.render.TargetHud.GREEN;
|
||||
import static net.shadow.client.feature.module.impl.render.TargetHud.RED;
|
||||
|
@ -38,32 +42,62 @@ public class NameTags extends Module {
|
|||
|
||||
public void render(MatrixStack stack, AbstractClientPlayerEntity entity, Text text) {
|
||||
String t = text.getString();
|
||||
double healthHeight = 2;
|
||||
double labelHeight = 2 + FontRenderers.getRenderer().getFontHeight() + 2 + healthHeight + 2;
|
||||
Vec3d headPos = Utils.getInterpolatedEntityPosition(entity).add(0, entity.getHeight() * 2 + 0.3, 0);
|
||||
|
||||
Vec3d headPos = Utils.getInterpolatedEntityPosition(entity).add(0, entity.getHeight() + 0.3, 0);
|
||||
Vec3d a = Renderer.R2D.getScreenSpaceCoordinate(headPos, stack);
|
||||
if (Renderer.R2D.isOnScreen(a)) {
|
||||
Utils.TickManager.runOnNextRender(() -> {
|
||||
MatrixStack stack1 = Renderer.R3D.getEmptyMatrixStack();
|
||||
Vec3d actual = new Vec3d(a.x, a.y - labelHeight, a.z);
|
||||
float fontWidth = FontRenderers.getRenderer().getStringWidth(t) + 1 + 4;
|
||||
float width = fontWidth;
|
||||
width = Math.max(width, 60);
|
||||
Renderer.R2D.renderRoundedQuad(stack1, new Color(0, 0, 0, 200), actual.x - width / 2d, actual.y, actual.x + width / 2d, actual.y + labelHeight, 3, 20);
|
||||
// FontRenderers.getNormal().drawCenteredString(stack,t,actual.x,actual.y+2,0xFFFFFF);
|
||||
FontRenderers.getRenderer().drawString(stack1, t, actual.x - fontWidth / 2d + 2, actual.y + 2, 0xFFFFFF);
|
||||
Renderer.R2D.renderRoundedQuad(stack1, new Color(60, 60, 60, 255), actual.x - width / 2d + 2, actual.y + labelHeight - 2 - healthHeight, actual.x + width / 2d - 2, actual.y + labelHeight - 2, healthHeight / 2d, 10);
|
||||
float health = entity.getHealth();
|
||||
float maxHealth = entity.getMaxHealth();
|
||||
float healthPer = health / maxHealth;
|
||||
healthPer = MathHelper.clamp(healthPer, 0, 1);
|
||||
double drawTo = MathHelper.lerp(healthPer, actual.x - width / 2d + 2 + healthHeight, actual.x + width / 2d - 2);
|
||||
Color MID_END = Renderer.Util.lerp(GREEN, RED, healthPer);
|
||||
Renderer.R2D.renderRoundedQuad(stack1, MID_END, actual.x - width / 2d + 2, actual.y + labelHeight - 2 - healthHeight, drawTo, actual.y + labelHeight - 2, healthHeight / 2d, 10);
|
||||
drawInternal(a, t, entity);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
GameMode getGamemode(AbstractClientPlayerEntity p) {
|
||||
PlayerListEntry ple = client.getNetworkHandler().getPlayerListEntry(p.getUuid());
|
||||
if (ple == null) return null;
|
||||
return ple.getGameMode();
|
||||
}
|
||||
|
||||
void drawInternal(Vec3d screenPos, String text, AbstractClientPlayerEntity entity) {
|
||||
FontAdapter nameDrawer = FontRenderers.getRenderer();
|
||||
FontAdapter infoDrawer = FontRenderers.getCustomSize(12);
|
||||
double healthHeight = 2;
|
||||
double labelHeight = 2 + nameDrawer.getFontHeight() + infoDrawer.getFontHeight() + 2 + healthHeight + 2;
|
||||
int ping = -1;
|
||||
GameMode gamemode = null;
|
||||
PlayerListEntry ple = client.getNetworkHandler().getPlayerListEntry(entity.getUuid());
|
||||
if (ple != null) {
|
||||
gamemode = ple.getGameMode();
|
||||
ping = ple.getLatency();
|
||||
}
|
||||
String pingStr = (ping == 0 ? "?" : ping) + " ms";
|
||||
String gmString = "§cBot";
|
||||
if (gamemode != null) switch (gamemode) {
|
||||
case ADVENTURE -> gmString = "Adventure";
|
||||
case CREATIVE -> gmString = "Creative";
|
||||
case SURVIVAL -> gmString = "Survival";
|
||||
case SPECTATOR -> gmString = "Spectator";
|
||||
}
|
||||
MatrixStack stack1 = Renderer.R3D.getEmptyMatrixStack();
|
||||
Vec3d actual = new Vec3d(screenPos.x, screenPos.y - labelHeight, screenPos.z);
|
||||
float fontWidth = nameDrawer.getStringWidth(text) + 4;
|
||||
float width = fontWidth;
|
||||
width = Math.max(width, 70);
|
||||
Renderer.R2D.renderRoundedQuad(stack1, new Color(0, 0, 5, 200), actual.x - width / 2d, actual.y, actual.x + width / 2d, actual.y + labelHeight, 3, 20);
|
||||
nameDrawer.drawString(stack1, text, actual.x - fontWidth / 2d + 2, actual.y + 2, 0xFFFFFF);
|
||||
infoDrawer.drawString(stack1, gmString, actual.x + width / 2d - infoDrawer.getStringWidth(gmString) - 2, actual.y + 2 + nameDrawer.getFontHeight(), 0xAAAAAA);
|
||||
if (ping != -1)
|
||||
infoDrawer.drawString(stack1, pingStr, actual.x - width / 2d + 2, actual.y + 2 + nameDrawer.getFontHeight(), 0xAAAAAA);
|
||||
Renderer.R2D.renderRoundedQuad(stack1, new Color(60, 60, 60, 255), actual.x - width / 2d + 2, actual.y + labelHeight - 2 - healthHeight, actual.x + width / 2d - 2, actual.y + labelHeight - 2, healthHeight / 2d, 10);
|
||||
float health = entity.getHealth();
|
||||
float maxHealth = entity.getMaxHealth();
|
||||
float healthPer = health / maxHealth;
|
||||
healthPer = MathHelper.clamp(healthPer, 0, 1);
|
||||
double drawTo = MathHelper.lerp(healthPer, actual.x - width / 2d + 2 + healthHeight, actual.x + width / 2d - 2);
|
||||
Color MID_END = Renderer.Util.lerp(GREEN, RED, healthPer);
|
||||
Renderer.R2D.renderRoundedQuad(stack1, MID_END, actual.x - width / 2d + 2, actual.y + labelHeight - 2 - healthHeight, drawTo, actual.y + labelHeight - 2, healthHeight / 2d, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
|
||||
|
@ -76,7 +110,11 @@ public class NameTags extends Module {
|
|||
|
||||
@Override
|
||||
public void onWorldRender(MatrixStack matrices) {
|
||||
|
||||
// sort the entire thing based on the most distant to the least distant because thats how rendering works
|
||||
for (AbstractClientPlayerEntity player : client.world.getPlayers().stream().sorted(Comparator.comparingDouble(value -> -value.getPos().distanceTo(client.gameRenderer.getCamera().getPos()))).toList()) {
|
||||
// String t = player.getEntityName();
|
||||
render(matrices, player, player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
28
src/main/java/net/shadow/client/helper/render/Cursor.java
Normal file
28
src/main/java/net/shadow/client/helper/render/Cursor.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved.
|
||||
*/
|
||||
|
||||
package net.shadow.client.helper.render;
|
||||
|
||||
import net.shadow.client.ShadowMain;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class Cursor {
|
||||
public static long CLICK = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HAND_CURSOR);
|
||||
public static long STANDARD = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
|
||||
public static long TEXT_EDIT = GLFW.glfwCreateStandardCursor(GLFW.GLFW_IBEAM_CURSOR);
|
||||
public static long HSLIDER = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HRESIZE_CURSOR);
|
||||
private static long currentCursor = -1;
|
||||
|
||||
public static void setGlfwCursor(long cursor) {
|
||||
if (currentCursor == cursor) return;
|
||||
String cname = "(unknown)";
|
||||
if (CLICK == cursor) cname = "CLICK";
|
||||
if (STANDARD == cursor) cname = "STANDARD";
|
||||
if (TEXT_EDIT == cursor) cname = "TEXT_EDIT";
|
||||
if (HSLIDER == cursor) cname = "HSLIDER";
|
||||
System.out.println("set cursor: 0x" + Long.toHexString(cursor).toUpperCase() + ": " + cname);
|
||||
currentCursor = cursor;
|
||||
GLFW.glfwSetCursor(ShadowMain.client.getWindow().getHandle(), cursor);
|
||||
}
|
||||
}
|
|
@ -413,6 +413,7 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static void runOnNextRender(Runnable r) {
|
||||
if (ShadowMain.client.options.hudHidden) return;
|
||||
nextTickRunners.add(r);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,4 @@ public interface IMinecraftClientAccessor {
|
|||
|
||||
@Accessor("renderTickCounter")
|
||||
RenderTickCounter getRenderTickCounter();
|
||||
|
||||
@Accessor("currentFps")
|
||||
int getCurrentFps();
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class LivingEntityMixin {
|
|||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "jump", at = @At(value = "INVOKE", target = "net/minecraft/entity/LivingEntity.getYaw()F"), require=0)
|
||||
@Redirect(method = "jump", at = @At(value = "INVOKE", target = "net/minecraft/entity/LivingEntity.getYaw()F"), require = 0)
|
||||
private float atomic_overwriteFreelookYaw(LivingEntity instance) {
|
||||
if (instance.equals(ShadowMain.client.player) && ModuleRegistry.getByClass(FreeLook.class).isEnabled()) {
|
||||
return ModuleRegistry.getByClass(FreeLook.class).newyaw;
|
||||
|
|
|
@ -23,7 +23,7 @@ public class PlayerEntityRendererMixin {
|
|||
void real(AbstractClientPlayerEntity abstractClientPlayerEntity, Text text, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) {
|
||||
NameTags nt = ModuleRegistry.getByClass(NameTags.class);
|
||||
if (nt.isEnabled()) {
|
||||
nt.render(matrixStack, abstractClientPlayerEntity, text);
|
||||
// nt.render(matrixStack, abstractClientPlayerEntity, text);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,17 @@
|
|||
package net.shadow.client.mixin;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.gui.AbstractParentElement;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.render.VertexFormat;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.shadow.client.feature.gui.HasSpecialCursor;
|
||||
import net.shadow.client.helper.render.Cursor;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -18,9 +23,10 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(Screen.class)
|
||||
public class ScreenMixin {
|
||||
public abstract class ScreenMixin extends AbstractParentElement {
|
||||
private static final Color c = new Color(10, 10, 10);
|
||||
@Shadow
|
||||
public int height;
|
||||
|
@ -28,6 +34,13 @@ public class ScreenMixin {
|
|||
@Shadow
|
||||
public int width;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private List<Element> children;
|
||||
|
||||
@Shadow
|
||||
protected abstract void insertText(String text, boolean override);
|
||||
|
||||
@Inject(method = "renderBackgroundTexture", at = @At("HEAD"), cancellable = true)
|
||||
void real(int vOffset, CallbackInfo ci) {
|
||||
float r = c.getRed() / 255f;
|
||||
|
@ -45,4 +58,25 @@ public class ScreenMixin {
|
|||
bufferBuilder.vertex(0.0D, 0.0D, 0.0D).color(r, g, b, 1f).next();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Element> children() { // have to do this because java will shit itself when i dont overwrite this
|
||||
return this.children;
|
||||
}
|
||||
|
||||
void shadow_handleCursor(double x, double y) {
|
||||
long c = Cursor.STANDARD;
|
||||
for (Element child : this.children) {
|
||||
if (child instanceof HasSpecialCursor specialCursor) {
|
||||
if (specialCursor.shouldApplyCustomCursor()) c = specialCursor.getCursor();
|
||||
}
|
||||
}
|
||||
Cursor.setGlfwCursor(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(double mouseX, double mouseY) {
|
||||
shadow_handleCursor(mouseX, mouseY);
|
||||
super.mouseMoved(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Added a bunch of stuff
|
||||
Added automatic crash reporting
|
||||
Ported modules
|
||||
Port all the items
|
||||
Fix automated crash reports
|
||||
Sus
|
||||
|
|
80
src/main/resources/itemRegistry.txt
Normal file
80
src/main/resources/itemRegistry.txt
Normal file
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
18
|
||||
19
|
Loading…
Reference in a new issue