mirror of
https://github.com/Miasmusa/Shadow.git
synced 2024-11-25 08:47:51 -05:00
ok
This commit is contained in:
parent
8ebda27415
commit
987a496b5b
35 changed files with 585 additions and 221 deletions
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
package me.x150.sipprivate.feature.gui;
|
||||
|
||||
public interface DoesMSAA {
|
||||
}
|
|
@ -66,7 +66,7 @@ public class AltManagerScreen extends AntiAliasedScreen implements FastTickable
|
|||
ClientFontRenderer title = FontRenderers.getCustomNormal(40);
|
||||
double scroll = 0;
|
||||
double scrollSmooth = 0;
|
||||
Identifier currentAccountTexture = new Identifier("atomic", "tex_currentaccount");
|
||||
Identifier currentAccountTexture = new Identifier("coffee", "tex_currentaccount");
|
||||
boolean currentAccountTextureLoaded = false;
|
||||
AtomicBoolean isLoggingIn = new AtomicBoolean(false);
|
||||
|
||||
|
@ -606,7 +606,7 @@ public class AltManagerScreen extends AntiAliasedScreen implements FastTickable
|
|||
}
|
||||
}
|
||||
|
||||
class AltContainer {
|
||||
public class AltContainer {
|
||||
Identifier tex;
|
||||
boolean texLoaded = false;
|
||||
float animProgress = 0;
|
||||
|
@ -643,7 +643,7 @@ public class AltManagerScreen extends AntiAliasedScreen implements FastTickable
|
|||
NativeImageBackedTexture texture = new NativeImageBackedTexture(img);
|
||||
|
||||
CoffeeClientMain.client.execute(() -> {
|
||||
this.tex = new Identifier("atomic", "tex_" + this.storage.cachedUuid.hashCode() + "_" + (Math.random() + "").split("\\.")[1]);
|
||||
this.tex = new Identifier("coffee", "tex_" + this.storage.cachedUuid.hashCode() + "_" + (Math.random() + "").split("\\.")[1]);
|
||||
CoffeeClientMain.client.getTextureManager().registerTexture(this.tex, texture);
|
||||
texCache.put(this.storage.cachedUuid, this.tex);
|
||||
texLoaded = true;
|
||||
|
@ -674,7 +674,7 @@ public class AltManagerScreen extends AntiAliasedScreen implements FastTickable
|
|||
storage.valid = true;
|
||||
storage.cachedUuid = UUID.randomUUID();
|
||||
storage.cachedName = storage.email;
|
||||
storage.accessToken = "AtomicOnTop";
|
||||
storage.accessToken = "coffee";
|
||||
return;
|
||||
}
|
||||
if (token == null) {
|
||||
|
@ -771,7 +771,7 @@ public class AltManagerScreen extends AntiAliasedScreen implements FastTickable
|
|||
}
|
||||
}
|
||||
|
||||
record PropEntry(String name, FontAdapter cfr, int color) {
|
||||
public static record PropEntry(String name, FontAdapter cfr, int color) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.client.gui.screen.Screen;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public abstract class AntiAliasedScreen extends Screen {
|
||||
public class AntiAliasedScreen extends Screen {
|
||||
int samples;
|
||||
|
||||
public AntiAliasedScreen(int samples) {
|
||||
|
@ -13,15 +13,18 @@ public abstract class AntiAliasedScreen extends Screen {
|
|||
this.samples = samples;
|
||||
}
|
||||
|
||||
public abstract void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta);
|
||||
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
|
||||
super.render(stack, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
if (samples != -1) {
|
||||
MSAAFramebuffer.use(samples, () -> renderInternal(matrices, mouseX, mouseY, delta));
|
||||
MSAAFramebuffer.use(samples, () -> {
|
||||
renderInternal(matrices, mouseX, mouseY, delta);
|
||||
});
|
||||
} else {
|
||||
renderInternal(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,277 @@
|
|||
package me.x150.sipprivate.feature.gui.screen;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import me.x150.sipprivate.CoffeeClientMain;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.text.Text;
|
||||
import me.x150.sipprivate.feature.gui.FastTickable;
|
||||
import me.x150.sipprivate.feature.gui.widget.RoundButton;
|
||||
import me.x150.sipprivate.helper.font.FontRenderers;
|
||||
import me.x150.sipprivate.helper.font.adapter.impl.ClientFontRenderer;
|
||||
import me.x150.sipprivate.helper.render.MSAAFramebuffer;
|
||||
import me.x150.sipprivate.helper.render.Renderer;
|
||||
import me.x150.sipprivate.helper.util.Utils;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.gui.screen.option.OptionsScreen;
|
||||
import net.minecraft.client.gui.screen.world.SelectWorldScreen;
|
||||
import net.minecraft.client.realms.gui.screen.RealmsMainScreen;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
import net.minecraft.client.texture.NativeImageBackedTexture;
|
||||
import net.minecraft.client.util.DefaultSkinHelper;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL40C;
|
||||
|
||||
public class HomeScreen extends Screen {
|
||||
public HomeScreen() {
|
||||
super(Text.of(""));
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class HomeScreen extends AntiAliasedScreen implements FastTickable {
|
||||
static final double padding = 5;
|
||||
static boolean isDev = false;
|
||||
static String version = "unknown";
|
||||
static String changelog = "";
|
||||
static Identifier background = new Identifier("coffeeclient", "background.jpg");
|
||||
static HttpClient downloader = HttpClient.newHttpClient();
|
||||
private static HomeScreen instance;
|
||||
boolean loaded = false;
|
||||
long initTime = System.currentTimeMillis();
|
||||
double prog = 0;
|
||||
boolean fadeOut = false;
|
||||
ClientFontRenderer title = FontRenderers.getCustomNormal(40);
|
||||
ClientFontRenderer smaller = FontRenderers.getCustomNormal(30);
|
||||
ClientFontRenderer propFr = FontRenderers.getCustomNormal(22);
|
||||
double initProg = 0;
|
||||
Identifier currentAccountTexture = new Identifier("coffee", "tex_currentaccount_home");
|
||||
boolean currentAccountTextureLoaded = false;
|
||||
UUID previousChecked = null;
|
||||
|
||||
private HomeScreen() {
|
||||
super(MSAAFramebuffer.MAX_SAMPLES);
|
||||
}
|
||||
|
||||
public static HomeScreen instance() {
|
||||
if (instance == null) instance = new HomeScreen();
|
||||
return instance;
|
||||
}
|
||||
|
||||
void load() {
|
||||
loaded = true;
|
||||
try {
|
||||
File execF = new File(HomeScreen.class.getProtectionDomain().getCodeSource().getLocation().toURI());
|
||||
File changelog = new File(Objects.requireNonNull(HomeScreen.class.getClassLoader().getResource("changelogLatest.txt")).toURI());
|
||||
File version = new File(Objects.requireNonNull(HomeScreen.class.getClassLoader().getResource("version.txt")).toURI());
|
||||
isDev = execF.isDirectory();
|
||||
HomeScreen.version = Files.readString(version.toPath(), StandardCharsets.UTF_8);
|
||||
HomeScreen.changelog = Files.readString(changelog.toPath(), StandardCharsets.UTF_8);
|
||||
updateCurrentAccount(this::complete);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
complete();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(MinecraftClient client, int width, int height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
initWidgets();
|
||||
}
|
||||
|
||||
void initWidgets() {
|
||||
double centerWidgetsY = height - padding - 25;
|
||||
double rightPad = width - padding;
|
||||
Color bg = new Color(240, 240, 240);
|
||||
RoundButton single = new RoundButton(bg, rightPad - (padding + 60), centerWidgetsY, 60, 20, "Singleplayer", () -> CoffeeClientMain.client.setScreen(new SelectWorldScreen(this)));
|
||||
RoundButton multi = new RoundButton(bg, rightPad - (padding + 60) * 2, centerWidgetsY, 60, 20, "Multiplayer", () -> CoffeeClientMain.client.setScreen(new MultiplayerScreen(this)));
|
||||
RoundButton realms = new RoundButton(bg, rightPad - (padding + 60) * 3, centerWidgetsY, 60, 20, "Realms", () -> CoffeeClientMain.client.setScreen(new RealmsMainScreen(this)));
|
||||
RoundButton alts = new RoundButton(bg, rightPad - (padding + 60) * 4, centerWidgetsY, 60, 20, "Alts", () -> CoffeeClientMain.client.setScreen(AltManagerScreen.instance()));
|
||||
RoundButton settings = new RoundButton(bg, rightPad - (padding + 60) * 5, centerWidgetsY, 60, 20, "Options", () -> CoffeeClientMain.client.setScreen(new OptionsScreen(this, CoffeeClientMain.client.options)));
|
||||
RoundButton quit = new RoundButton(bg, rightPad - (padding + 60) * 5 - padding - 20, centerWidgetsY, 20, 20, "X", CoffeeClientMain.client::scheduleStop);
|
||||
addDrawableChild(single);
|
||||
addDrawableChild(multi);
|
||||
addDrawableChild(settings);
|
||||
addDrawableChild(alts);
|
||||
addDrawableChild(realms);
|
||||
addDrawableChild(quit);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
CoffeeClientMain.client.setScreen(new TitleScreen());
|
||||
super.init();
|
||||
initTime = System.currentTimeMillis();
|
||||
initWidgets();
|
||||
if (loaded) updateCurrentAccount(() -> {
|
||||
}); // already loaded this instance, refresh on the fly
|
||||
}
|
||||
|
||||
void complete() {
|
||||
fadeOut = true;
|
||||
}
|
||||
|
||||
void updateCurrentAccount(Runnable callback) {
|
||||
UUID uid = CoffeeClientMain.client.getSession().getProfile().getId();
|
||||
if (previousChecked != null && previousChecked.equals(uid)) {
|
||||
callback.run();
|
||||
return;
|
||||
}
|
||||
previousChecked = uid;
|
||||
|
||||
HttpRequest hr = HttpRequest.newBuilder().uri(URI.create("https://crafatar.com/avatars/" + uid + "?overlay")).header("User-Agent", "why").build();
|
||||
downloader.sendAsync(hr, HttpResponse.BodyHandlers.ofByteArray()).thenAccept(httpResponse -> {
|
||||
try {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
ImageIO.write(ImageIO.read(new ByteArrayInputStream(httpResponse.body())), "png", stream);
|
||||
byte[] bytes = stream.toByteArray();
|
||||
|
||||
ByteBuffer data = BufferUtils.createByteBuffer(bytes.length).put(bytes);
|
||||
data.flip();
|
||||
NativeImage img = NativeImage.read(data);
|
||||
System.out.println(img);
|
||||
NativeImageBackedTexture texture = new NativeImageBackedTexture(img);
|
||||
|
||||
CoffeeClientMain.client.execute(() -> {
|
||||
CoffeeClientMain.client.getTextureManager().registerTexture(currentAccountTexture, texture);
|
||||
currentAccountTextureLoaded = true;
|
||||
callback.run();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
callback.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
|
||||
double initProg = this.initProg * 2;
|
||||
|
||||
Renderer.R2D.renderQuad(stack, new Color(210, 210, 210), 0, 0, width, height);
|
||||
|
||||
RenderSystem.setShaderTexture(0, background);
|
||||
Renderer.R2D.renderTexture(stack, 0, 0, width, height, 0, 0, width, height, width, height);
|
||||
|
||||
stack.push();
|
||||
double ap = 1 - easeOutBack(MathHelper.clamp(initProg, .5, 1.5) - .5);
|
||||
double h = padding + propFr.getMarginHeight() + 2 + changelog.split("\n").length * FontRenderers.getNormal().getMarginHeight() + padding;
|
||||
double w = 100;
|
||||
for (String s : changelog.split("\n")) {
|
||||
w = Math.max(w, 10 + FontRenderers.getNormal().getStringWidth(s));
|
||||
}
|
||||
stack.translate(0, ap * -(padding + h + 1), 0);
|
||||
Renderer.R2D.renderRoundedQuad(stack, new Color(20, 20, 20, 170), padding, padding, padding + w + padding * 2, padding + h, 10, 14);
|
||||
propFr.drawString(stack, "Changelog", (float) (padding * 2f), (float) (padding * 2f), 0xFFFFFF, false);
|
||||
double yoff = padding * 2 + propFr.getMarginHeight() + 2;
|
||||
for (String s : changelog.split("\n")) {
|
||||
FontRenderers.getNormal().drawString(stack, s, (float) (padding * 2 + padding), (float) yoff, 0xAAAAAA, false);
|
||||
yoff += FontRenderers.getNormal().getMarginHeight();
|
||||
}
|
||||
stack.pop();
|
||||
|
||||
stack.push();
|
||||
double widRHeight = 50 + padding * 2;
|
||||
double ap1 = 1 - easeOutBack(MathHelper.clamp(initProg, 1, 2) - 1);
|
||||
stack.translate(0, ap1 * -(padding + widRHeight + 1), 0);
|
||||
|
||||
double fromX = width - (200 + padding);
|
||||
double toX = width - padding;
|
||||
double fromY;
|
||||
double toY;
|
||||
toY = padding + widRHeight;
|
||||
fromY = toY - widRHeight;
|
||||
Renderer.R2D.renderRoundedQuad(stack, new Color(20, 20, 20, 170), fromX, fromY, toX, toY, 10, 10);
|
||||
double texDim = widRHeight - padding * 2;
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.colorMask(false, false, false, true);
|
||||
RenderSystem.clearColor(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
RenderSystem.clear(GL40C.GL_COLOR_BUFFER_BIT, false);
|
||||
RenderSystem.colorMask(true, true, true, true);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
Renderer.R2D.renderRoundedQuadInternal(stack.peek().getPositionMatrix(), 0, 0, 0, 1, fromX + padding, fromY + padding, fromX + padding + texDim, fromY + padding + texDim, 6, 10);
|
||||
|
||||
RenderSystem.blendFunc(GL40C.GL_DST_ALPHA, GL40C.GL_ONE_MINUS_DST_ALPHA);
|
||||
RenderSystem.setShaderTexture(0, currentAccountTextureLoaded ? currentAccountTexture : DefaultSkinHelper.getTexture());
|
||||
if (currentAccountTextureLoaded)
|
||||
Renderer.R2D.renderTexture(stack, fromX + padding, fromY + padding, texDim, texDim, 0, 0, 64, 64, 64, 64);
|
||||
else Renderer.R2D.renderTexture(stack, fromX + padding, fromY + padding, texDim, texDim, 8, 8, 8, 8, 64, 64);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
String uuid = CoffeeClientMain.client.getSession().getUuid();
|
||||
double uuidWid = FontRenderers.getNormal().getStringWidth(uuid);
|
||||
double maxWid = 200 - texDim - padding * 3;
|
||||
if (uuidWid > maxWid) {
|
||||
double threeDotWidth = FontRenderers.getNormal().getStringWidth("...");
|
||||
uuid = FontRenderers.getNormal().trimStringToWidth(uuid, maxWid - 1 - threeDotWidth);
|
||||
uuid += "...";
|
||||
}
|
||||
AltManagerScreen.AltContainer.PropEntry[] props = new AltManagerScreen.AltContainer.PropEntry[]{new AltManagerScreen.AltContainer.PropEntry(CoffeeClientMain.client.getSession().getUsername(), FontRenderers.getCustomNormal(22), 0xFFFFFF),
|
||||
new AltManagerScreen.AltContainer.PropEntry(uuid, FontRenderers.getNormal(), 0xAAAAAA)};
|
||||
float propsOffset = (float) (fromY + padding);
|
||||
for (AltManagerScreen.AltContainer.PropEntry prop : props) {
|
||||
prop.cfr().drawString(stack, prop.name(), (float) (fromX + padding + texDim + padding), propsOffset, prop.color(), false);
|
||||
propsOffset += prop.cfr().getMarginHeight();
|
||||
}
|
||||
stack.pop();
|
||||
|
||||
stack.push();
|
||||
double heiProg = 1 - easeOutBack(MathHelper.clamp(initProg, 0, 1));
|
||||
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;
|
||||
smaller.drawString(stack, "version " + 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();
|
||||
|
||||
|
||||
double spinnerProg = prog;
|
||||
spinnerProg = MathHelper.clamp(spinnerProg, 0, 1); // fucking floating point precision istg
|
||||
float fadeProg = fadeOut ? (float) prog : 1f;
|
||||
fadeProg = MathHelper.clamp(fadeProg, 0, 1);
|
||||
Renderer.R2D.renderQuad(stack, new Color(1f, 1f, 1f, fadeProg), 0, 0, width, height);
|
||||
Renderer.R2D.renderLoadingSpinner(stack, Renderer.Util.modify(Utils.getCurrentRGB(), -1, -1, -1, (int) (spinnerProg * 255)), width - 15, height - 15, 10, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFastTick() {
|
||||
if (System.currentTimeMillis() - initTime > 1000 && !loaded) load();
|
||||
double delta = 10 / 600d;
|
||||
if (fadeOut) delta *= -1;
|
||||
prog += delta;
|
||||
prog = MathHelper.clamp(prog, 0, 1);
|
||||
|
||||
if (loaded && prog == 0 && fadeOut) {
|
||||
double d = 0.01;
|
||||
initProg += d;
|
||||
initProg = MathHelper.clamp(initProg, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
if (prog != 0 || !fadeOut) return false;
|
||||
return super.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
double easeOutBack(double x) {
|
||||
double c1 = 1.70158;
|
||||
double c3 = c1 + 1;
|
||||
|
||||
return 1 + c3 * Math.pow(x - 1, 3) + c1 * Math.pow(x - 1, 2);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
package me.x150.sipprivate.feature.gui.widget;
|
||||
|
||||
import me.x150.sipprivate.feature.gui.FastTickable;
|
||||
import me.x150.sipprivate.helper.font.FontRenderers;
|
||||
import me.x150.sipprivate.helper.render.Renderer;
|
||||
import net.minecraft.client.gui.Drawable;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.Selectable;
|
||||
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class RoundButton implements Element, Drawable, Selectable, FastTickable {
|
||||
String text;
|
||||
Runnable onPress;
|
||||
double x, y, width, height;
|
||||
double animProgress = 0;
|
||||
boolean isHovered = false;
|
||||
boolean enabled = true;
|
||||
Color color;
|
||||
|
||||
|
||||
public RoundButton(Color color, 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;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public void onFastTick() {
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
isHovered = inBounds(mouseX, mouseY) && 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, color, originX, originY, width / 2d, height / 2d, 10, 10);
|
||||
FontRenderers.getNormal().drawString(matrices, text, -(FontRenderers.getNormal().getStringWidth(text) + 2) / 2f, -FontRenderers.getNormal().getMarginHeight() / 2f, isEnabled() ? 0 : 0x333333, false);
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SelectionType getType() {
|
||||
return isHovered ? SelectionType.HOVERED : SelectionType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendNarrations(NarrationMessageBuilder builder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
if (inBounds(mouseX, mouseY) && isEnabled() && button == 0) {
|
||||
onPress.run();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
|
||||
public abstract class Module {
|
||||
|
||||
protected static MinecraftClient client = CoffeeClientMain.client;
|
||||
public final ModuleConfig config;
|
||||
public final DoubleSetting keybind;
|
||||
private final BooleanSetting debuggerEnabled;
|
||||
|
@ -24,8 +25,6 @@ public abstract class Module {
|
|||
private final BooleanSetting toasts;
|
||||
private boolean enabled = false;
|
||||
|
||||
protected static MinecraftClient client = CoffeeClientMain.client;
|
||||
|
||||
public Module(String n, String d, ModuleType type) {
|
||||
this.name = n;
|
||||
this.description = d;
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
package me.x150.sipprivate.feature.module;
|
||||
|
||||
|
||||
import me.x150.sipprivate.feature.module.impl.combat.*;
|
||||
import me.x150.sipprivate.feature.module.impl.exploit.*;
|
||||
import me.x150.sipprivate.feature.module.impl.fun.*;
|
||||
import me.x150.sipprivate.feature.module.impl.misc.*;
|
||||
import me.x150.sipprivate.feature.module.impl.movement.*;
|
||||
import me.x150.sipprivate.feature.module.impl.render.*;
|
||||
import me.x150.sipprivate.feature.module.impl.world.*;
|
||||
import me.x150.sipprivate.feature.module.impl.combat.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
|
||||
package me.x150.sipprivate.feature.module.impl.combat;
|
||||
|
||||
import me.x150.sipprivate.CoffeeClientMain;
|
||||
import me.x150.sipprivate.feature.module.Module;
|
||||
import me.x150.sipprivate.feature.module.ModuleType;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.EntityHitResult;
|
||||
|
||||
|
@ -18,8 +16,9 @@ public class AutoAttack extends Module {
|
|||
|
||||
@Override
|
||||
public void tick() {
|
||||
if(CoffeeClientMain.client.crosshairTarget == null || !(CoffeeClientMain.client.crosshairTarget instanceof EntityHitResult) || CoffeeClientMain.client.player.getAttackCooldownProgress(0) < 1) return;
|
||||
CoffeeClientMain.client.interactionManager.attackEntity(CoffeeClientMain.client.player, ((EntityHitResult)CoffeeClientMain.client.crosshairTarget).getEntity());
|
||||
if (CoffeeClientMain.client.crosshairTarget == null || !(CoffeeClientMain.client.crosshairTarget instanceof EntityHitResult) || CoffeeClientMain.client.player.getAttackCooldownProgress(0) < 1)
|
||||
return;
|
||||
CoffeeClientMain.client.interactionManager.attackEntity(CoffeeClientMain.client.player, ((EntityHitResult) CoffeeClientMain.client.crosshairTarget).getEntity());
|
||||
CoffeeClientMain.client.player.swingHand(Hand.MAIN_HAND);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ public class AntiAntiXray extends Module {
|
|||
int scanned = 0;
|
||||
int delayPassed = 0;
|
||||
BlockPos latestGoal = null;
|
||||
|
||||
public AntiAntiXray() {
|
||||
super("AntiAntiXray", "fuck you antixray i hope you choke on garlic", ModuleType.EXPLOIT);
|
||||
//this.config.createPropGroup("Post", mineBaritone);
|
||||
|
|
|
@ -15,27 +15,33 @@ public class Deadmau5 extends Module {
|
|||
super("Deadmau5", "deadmau5 ears for everyone", ModuleType.FUN);
|
||||
}
|
||||
|
||||
@Override public void tick() {
|
||||
@Override
|
||||
public void tick() {
|
||||
|
||||
}
|
||||
|
||||
@Override public void enable() {
|
||||
@Override
|
||||
public void enable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public void disable() {
|
||||
@Override
|
||||
public void disable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public String getContext() {
|
||||
@Override
|
||||
public String getContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public void onWorldRender(MatrixStack matrices) {
|
||||
@Override
|
||||
public void onWorldRender(MatrixStack matrices) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onHudRender() {
|
||||
@Override
|
||||
public void onHudRender() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,8 @@ import java.util.Objects;
|
|||
|
||||
public class SpinAutism extends Module {
|
||||
|
||||
// final SliderValue speed = (SliderValue) this.config.create("Timeout", 5, 0, 100, 0).description("How much to wait between rotations");
|
||||
final double r = 0;
|
||||
// final SliderValue speed = (SliderValue) this.config.create("Timeout", 5, 0, 100, 0).description("How much to wait between rotations");
|
||||
DoubleSetting speed = this.config.create(new DoubleSetting.Builder(5)
|
||||
.name("Delay")
|
||||
.description("How much to wait when spinning")
|
||||
|
@ -27,32 +28,37 @@ public class SpinAutism extends Module {
|
|||
.max(100)
|
||||
.precision(0)
|
||||
.get());
|
||||
final double r = 0;
|
||||
int timeout = 0;
|
||||
|
||||
public SpinAutism() {
|
||||
super("SpinAutism", "Spins around like a maniac and throws whatever you have", ModuleType.FUN);
|
||||
}
|
||||
|
||||
@Override public void tick() {
|
||||
@Override
|
||||
public void tick() {
|
||||
}
|
||||
|
||||
@Override public void enable() {
|
||||
@Override
|
||||
public void enable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public void disable() {
|
||||
@Override
|
||||
public void disable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public String getContext() {
|
||||
@Override
|
||||
public String getContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public void onWorldRender(MatrixStack matrices) {
|
||||
@Override
|
||||
public void onWorldRender(MatrixStack matrices) {
|
||||
}
|
||||
|
||||
@Override public void onFastTick() {
|
||||
@Override
|
||||
public void onFastTick() {
|
||||
timeout--; // decrease timeout
|
||||
if (timeout > 0) {
|
||||
return; // if timeout isn't expired, do nothing
|
||||
|
@ -66,7 +72,8 @@ public class SpinAutism extends Module {
|
|||
CoffeeClientMain.client.getNetworkHandler().sendPacket(p1);
|
||||
}
|
||||
|
||||
@Override public void onHudRender() {
|
||||
@Override
|
||||
public void onHudRender() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,27 +15,33 @@ public class AllowFormatCodes extends Module {
|
|||
super("AllowFormatCodes", "Allows you to type format codes with the paragraph symbol", ModuleType.MISC);
|
||||
}
|
||||
|
||||
@Override public void tick() {
|
||||
@Override
|
||||
public void tick() {
|
||||
|
||||
}
|
||||
|
||||
@Override public void enable() {
|
||||
@Override
|
||||
public void enable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public void disable() {
|
||||
@Override
|
||||
public void disable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public String getContext() {
|
||||
@Override
|
||||
public String getContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public void onWorldRender(MatrixStack matrices) {
|
||||
@Override
|
||||
public void onWorldRender(MatrixStack matrices) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onHudRender() {
|
||||
@Override
|
||||
public void onHudRender() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,27 +15,33 @@ public class InfChatLength extends Module {
|
|||
super("InfChatLength", "Completely removes the length limit for the chat (Server side too, be careful!)", ModuleType.MISC);
|
||||
}
|
||||
|
||||
@Override public void tick() {
|
||||
@Override
|
||||
public void tick() {
|
||||
|
||||
}
|
||||
|
||||
@Override public void enable() {
|
||||
@Override
|
||||
public void enable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public void disable() {
|
||||
@Override
|
||||
public void disable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public String getContext() {
|
||||
@Override
|
||||
public String getContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public void onWorldRender(MatrixStack matrices) {
|
||||
@Override
|
||||
public void onWorldRender(MatrixStack matrices) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onHudRender() {
|
||||
@Override
|
||||
public void onHudRender() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,26 +46,32 @@ public class NoTitles extends Module {
|
|||
});
|
||||
}
|
||||
|
||||
@Override public void tick() {
|
||||
@Override
|
||||
public void tick() {
|
||||
}
|
||||
|
||||
@Override public void enable() {
|
||||
@Override
|
||||
public void enable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public void disable() {
|
||||
@Override
|
||||
public void disable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public String getContext() {
|
||||
@Override
|
||||
public String getContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public void onWorldRender(MatrixStack matrices) {
|
||||
@Override
|
||||
public void onWorldRender(MatrixStack matrices) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onHudRender() {
|
||||
@Override
|
||||
public void onHudRender() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,27 +15,33 @@ public class PortalGUI extends Module {
|
|||
super("PortalGUI", "Allows you to open GUIs while being inside a portal", ModuleType.MISC);
|
||||
}
|
||||
|
||||
@Override public void tick() {
|
||||
@Override
|
||||
public void tick() {
|
||||
|
||||
}
|
||||
|
||||
@Override public void enable() {
|
||||
@Override
|
||||
public void enable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public void disable() {
|
||||
@Override
|
||||
public void disable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public String getContext() {
|
||||
@Override
|
||||
public String getContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public void onWorldRender(MatrixStack matrices) {
|
||||
@Override
|
||||
public void onWorldRender(MatrixStack matrices) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onHudRender() {
|
||||
@Override
|
||||
public void onHudRender() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
|
||||
public class Timer extends Module {
|
||||
|
||||
// final SliderValue newTps = this.config.create("New TPS", 20, 0.1, 100, 1);
|
||||
// final SliderValue newTps = this.config.create("New TPS", 20, 0.1, 100, 1);
|
||||
DoubleSetting newTps = this.config.create(new DoubleSetting.Builder(20)
|
||||
.name("New TPS")
|
||||
.description("To what to set the new tps to")
|
||||
|
@ -26,27 +26,33 @@ public class Timer extends Module {
|
|||
super("Timer", "changes client side tps", ModuleType.MISC);
|
||||
}
|
||||
|
||||
@Override public void tick() {
|
||||
@Override
|
||||
public void tick() {
|
||||
Utils.setClientTps((float) (newTps.getValue() + 0d));
|
||||
}
|
||||
|
||||
@Override public void enable() {
|
||||
@Override
|
||||
public void enable() {
|
||||
|
||||
}
|
||||
|
||||
@Override public void disable() {
|
||||
@Override
|
||||
public void disable() {
|
||||
Utils.setClientTps(20f);
|
||||
}
|
||||
|
||||
@Override public String getContext() {
|
||||
@Override
|
||||
public String getContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public void onWorldRender(MatrixStack matrices) {
|
||||
@Override
|
||||
public void onWorldRender(MatrixStack matrices) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onHudRender() {
|
||||
@Override
|
||||
public void onHudRender() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,17 +5,15 @@ import me.x150.sipprivate.feature.module.ModuleType;
|
|||
import me.x150.sipprivate.helper.event.EventType;
|
||||
import me.x150.sipprivate.helper.event.Events;
|
||||
import me.x150.sipprivate.helper.event.events.PacketEvent;
|
||||
import me.x150.sipprivate.mixin.IPlayerMoveC2SPacketAccessor;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||
|
||||
public class XCarry extends Module {
|
||||
|
||||
public XCarry() {
|
||||
super("XCarry", "lets you store stuff in your crafting grid", ModuleType.MISC);
|
||||
Events.registerEventHandler(EventType.PACKET_SEND, event -> {
|
||||
if(!this.isEnabled()) return;
|
||||
if (!this.isEnabled()) return;
|
||||
PacketEvent pe = (PacketEvent) event;
|
||||
if (pe.getPacket() instanceof CloseHandledScreenC2SPacket packet) {
|
||||
pe.setCancelled(true);
|
||||
|
|
|
@ -25,6 +25,7 @@ public class Blink extends Module {
|
|||
.name("Mode")
|
||||
.description("Whether to delay or remove the packets being sent")
|
||||
.get());
|
||||
|
||||
public Blink() {
|
||||
super("Blink", "confuses chinese anticheats", ModuleType.MOVEMENT);
|
||||
Events.registerEventHandler(EventType.PACKET_SEND, event1 -> {
|
||||
|
|
|
@ -52,6 +52,7 @@ public class LongJump extends Module {
|
|||
.precision(3)
|
||||
.get());
|
||||
boolean jumped = false;
|
||||
|
||||
public LongJump() {
|
||||
super("LongJump", "Jumps a long distance", ModuleType.MOVEMENT);
|
||||
glideVelocity.showIf(glide::getValue);
|
||||
|
|
|
@ -3,13 +3,11 @@ package me.x150.sipprivate.feature.module.impl.world;
|
|||
import me.x150.sipprivate.CoffeeClientMain;
|
||||
import me.x150.sipprivate.feature.module.Module;
|
||||
import me.x150.sipprivate.feature.module.ModuleType;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
|
||||
public class InstantMine extends Module {
|
||||
|
||||
|
@ -19,11 +17,13 @@ public class InstantMine extends Module {
|
|||
|
||||
@Override
|
||||
public void tick() {
|
||||
if(CoffeeClientMain.client.interactionManager.isBreakingBlock()){
|
||||
try{
|
||||
if (CoffeeClientMain.client.interactionManager.isBreakingBlock()) {
|
||||
try {
|
||||
BlockPos killmeplz = ((BlockHitResult) CoffeeClientMain.client.crosshairTarget).getBlockPos();
|
||||
for(int i = 0; i < 20; i++) CoffeeClientMain.client.player.networkHandler.sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, killmeplz, Direction.UP));
|
||||
}catch(ClassCastException e){}
|
||||
for (int i = 0; i < 20; i++)
|
||||
CoffeeClientMain.client.player.networkHandler.sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, killmeplz, Direction.UP));
|
||||
} catch (ClassCastException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,12 @@ public class Nuker extends Module {
|
|||
|
||||
@Override
|
||||
public void tick() {
|
||||
for(int x = -7; x < 8; x++) for(int y = -7; y < 8; y++) for(int z = -7; z < 8; z++){
|
||||
for (int x = -7; x < 8; x++)
|
||||
for (int y = -7; y < 8; y++)
|
||||
for (int z = -7; z < 8; z++) {
|
||||
BlockPos pos = CoffeeClientMain.client.player.getBlockPos().add(new BlockPos(x, y, z));
|
||||
if(new Vec3d(pos.getX(), pos.getY(), pos.getZ()).distanceTo(CoffeeClientMain.client.player.getPos()) > CoffeeClientMain.client.interactionManager.getReachDistance() - 1 || CoffeeClientMain.client.world.getBlockState(pos).isAir() || CoffeeClientMain.client.world.getBlockState(pos).getBlock() == Blocks.WATER || CoffeeClientMain.client.world.getBlockState(pos).getBlock() == Blocks.LAVA) continue;
|
||||
if (new Vec3d(pos.getX(), pos.getY(), pos.getZ()).distanceTo(CoffeeClientMain.client.player.getPos()) > CoffeeClientMain.client.interactionManager.getReachDistance() - 1 || CoffeeClientMain.client.world.getBlockState(pos).isAir() || CoffeeClientMain.client.world.getBlockState(pos).getBlock() == Blocks.WATER || CoffeeClientMain.client.world.getBlockState(pos).getBlock() == Blocks.LAVA)
|
||||
continue;
|
||||
CoffeeClientMain.client.interactionManager.attackBlock(pos, Direction.DOWN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ public class Renderer {
|
|||
|
||||
public static class R2D {
|
||||
|
||||
public static final Identifier OPTIONS_BACKGROUND_TEXTURE = new Identifier("sipoverprivate", "background.jpg");
|
||||
public static final Identifier OPTIONS_BACKGROUND_TEXTURE = new Identifier("coffeeclient", "background.jpg");
|
||||
|
||||
public static void beginScissor(MatrixStack stack, double x, double y, double endX, double endY) {
|
||||
Matrix4f matrix = stack.peek().getPositionMatrix();
|
||||
|
@ -549,6 +549,48 @@ public class Renderer {
|
|||
//
|
||||
// }
|
||||
|
||||
public static void renderQuadGradientVert(MatrixStack matrices, Color c1, Color c2, double x1, double y1, double x2, double y2) {
|
||||
float r1 = c1.getRed() / 255f;
|
||||
float g1 = c1.getGreen() / 255f;
|
||||
float b1 = c1.getBlue() / 255f;
|
||||
float a1 = c1.getAlpha() / 255f;
|
||||
float r2 = c2.getRed() / 255f;
|
||||
float g2 = c2.getGreen() / 255f;
|
||||
float b2 = c2.getBlue() / 255f;
|
||||
float a2 = c2.getAlpha() / 255f;
|
||||
|
||||
double j;
|
||||
|
||||
if (x1 < x2) {
|
||||
j = x1;
|
||||
x1 = x2;
|
||||
x2 = j;
|
||||
}
|
||||
|
||||
if (y1 < y2) {
|
||||
j = y1;
|
||||
y1 = y2;
|
||||
y2 = j;
|
||||
}
|
||||
Matrix4f matrix = matrices.peek().getPositionMatrix();
|
||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.disableTexture();
|
||||
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
|
||||
bufferBuilder.vertex(matrix, (float) x1, (float) y1, 0.0F).color(r1, g1, b1, a1).next();
|
||||
bufferBuilder.vertex(matrix, (float) x1, (float) y2, 0.0F).color(r2, g2, b2, a2).next();
|
||||
bufferBuilder.vertex(matrix, (float) x2, (float) y2, 0.0F).color(r2, g2, b2, a2).next();
|
||||
bufferBuilder.vertex(matrix, (float) x2, (float) y1, 0.0F).color(r1, g1, b1, a1).next();
|
||||
bufferBuilder.end();
|
||||
BufferRenderer.draw(bufferBuilder);
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.disableBlend();
|
||||
|
||||
}
|
||||
|
||||
public static void renderQuadGradient(MatrixStack matrices, Color c2, Color c1, double x1, double y1, double x2, double y2) {
|
||||
float r1 = c1.getRed() / 255f;
|
||||
float g1 = c1.getGreen() / 255f;
|
||||
|
@ -637,12 +679,12 @@ public class Renderer {
|
|||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
|
||||
}
|
||||
|
||||
public static void renderLine(Color c, double x, double y, double x1, double y1) {
|
||||
public static void renderLine(MatrixStack stack, Color c, double x, double y, double x1, double y1) {
|
||||
float g = c.getRed() / 255f;
|
||||
float h = c.getGreen() / 255f;
|
||||
float k = c.getBlue() / 255f;
|
||||
float f = c.getAlpha() / 255f;
|
||||
Matrix4f m = R3D.getEmptyMatrixStack().peek().getPositionMatrix();
|
||||
Matrix4f m = stack.peek().getPositionMatrix();
|
||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableBlend();
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
package me.x150.sipprivate.mixin;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import me.x150.sipprivate.feature.gui.FastTickable;
|
||||
import me.x150.sipprivate.feature.gui.clickgui.ClickGUI;
|
||||
import me.x150.sipprivate.helper.font.FontRenderers;
|
||||
import me.x150.sipprivate.helper.render.Renderer;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.CyclingButtonWidget;
|
||||
import net.minecraft.client.gui.widget.SliderWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
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.callback.CallbackInfo;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Mixin(ClickableWidget.class)
|
||||
public abstract class AButtonWidgetMixin implements FastTickable {
|
||||
|
||||
final Color unselectedColor = new Color(25, 44, 49, 70);
|
||||
final Color disabledColor = new Color(0, 0, 0, 70);
|
||||
@Shadow
|
||||
public int x;
|
||||
@Shadow
|
||||
public int y;
|
||||
@Shadow
|
||||
public boolean active;
|
||||
@Shadow
|
||||
protected int width;
|
||||
@Shadow
|
||||
protected int height;
|
||||
double animProg = 0;
|
||||
|
||||
@Shadow
|
||||
public abstract boolean isHovered();
|
||||
|
||||
@Shadow
|
||||
public abstract Text getMessage();
|
||||
|
||||
@Override
|
||||
public void onFastTick() {
|
||||
double e = 0.03d;
|
||||
if (!this.isHovered() || !this.active) {
|
||||
e *= -1;
|
||||
}
|
||||
//else if (animProg < 0.3) animProg = 0.3d;
|
||||
animProg += e;
|
||||
animProg = MathHelper.clamp(animProg, 0, 1);
|
||||
}
|
||||
|
||||
@Inject(method = "renderButton", at = @At("HEAD"), cancellable = true)
|
||||
public void atomic_renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
double dxStart, dyStart, dWidth, dHeight;
|
||||
|
||||
if ((((Object) this) instanceof ButtonWidget) || (((Object) this) instanceof CyclingButtonWidget<?>)) {
|
||||
dxStart = x;
|
||||
dyStart = y;
|
||||
dWidth = width;
|
||||
dHeight = height;
|
||||
} else if (((Object) this) instanceof SliderWidget inst) {
|
||||
ISliderWidgetAccessor accessor = (ISliderWidgetAccessor) inst;
|
||||
double sliderValueProg = accessor.getValue();
|
||||
dHeight = 20;
|
||||
dWidth = 2;
|
||||
dxStart = (int) (x + (sliderValueProg * (width - 1))); // wtf why
|
||||
dyStart = y;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
ci.cancel();
|
||||
|
||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
|
||||
animProg = MathHelper.clamp(animProg, 0, 1);
|
||||
double interpolatedAProg = ease(this.animProg);
|
||||
boolean isSlider = ((Object) this) instanceof SliderWidget;
|
||||
if (!isSlider) {
|
||||
// double rw = Renderer.Util.lerp(width, 0, interpolatedAProg) / 2d;
|
||||
if (interpolatedAProg != 0) {
|
||||
// Renderer.R2D.fill(matrices, ClickGUI.theme.getAccent(), x + (width / 2d) - rw, y + height - 1, x + (width / 2d) + rw, y + height);
|
||||
Renderer.R2D.renderQuad(matrices, ClickGUI.theme.getAccent(), x, y, x + 1, y + interpolatedAProg * height);
|
||||
}
|
||||
} else {
|
||||
Renderer.R2D.renderQuad(matrices, ClickGUI.theme.getAccent(), dxStart, dyStart, dxStart + dWidth, dyStart + dHeight);
|
||||
}
|
||||
|
||||
Renderer.R2D.renderQuad(matrices, this.active ? Renderer.Util.lerp(new Color(38, 83, 92, 100), unselectedColor, interpolatedAProg) : disabledColor, x, y, x + width, y + height);
|
||||
FontRenderers.getNormal()
|
||||
.drawCenteredString(matrices, this.getMessage().getString(), this.x + this.width / 2f, this.y + (this.height - FontRenderers.getNormal().getFontHeight()) / 2f, 0xFFFFFF);
|
||||
}
|
||||
|
||||
double ease(double x) {
|
||||
return x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,12 +5,9 @@ import me.x150.sipprivate.feature.command.CommandRegistry;
|
|||
import me.x150.sipprivate.feature.gui.screen.CoffeeConsoleScreen;
|
||||
import me.x150.sipprivate.feature.module.ModuleRegistry;
|
||||
import me.x150.sipprivate.feature.module.impl.misc.InfChatLength;
|
||||
import me.x150.sipprivate.helper.font.FontRenderers;
|
||||
import me.x150.sipprivate.helper.render.Renderer;
|
||||
import me.x150.sipprivate.helper.util.Utils;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -20,7 +17,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
|
||||
@Mixin(ChatScreen.class)
|
||||
public class AChatScreenMixin {
|
||||
@Shadow protected TextFieldWidget chatField;
|
||||
@Shadow
|
||||
protected TextFieldWidget chatField;
|
||||
|
||||
@Redirect(method = "keyPressed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ChatScreen;sendMessage(Ljava/lang/String;)V"))
|
||||
void atomic_interceptChatMessage(ChatScreen instance, String s) {
|
||||
|
@ -34,7 +32,8 @@ public class AChatScreenMixin {
|
|||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onChatFieldUpdate", at = @At("HEAD")) public void atomic_preChatFieldUpdate(String chatText, CallbackInfo ci) {
|
||||
@Inject(method = "onChatFieldUpdate", at = @At("HEAD"))
|
||||
public void atomic_preChatFieldUpdate(String chatText, CallbackInfo ci) {
|
||||
chatField.setMaxLength((ModuleRegistry.getByClass(InfChatLength.class).isEnabled()) ? Integer.MAX_VALUE : 256);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ public class ClientPlayerEntityMixin {
|
|||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "updateNausea", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;isPauseScreen()Z")) public boolean atomic_overwriteIsPauseScreen(Screen screen) {
|
||||
@Redirect(method = "updateNausea", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;isPauseScreen()Z"))
|
||||
public boolean atomic_overwriteIsPauseScreen(Screen screen) {
|
||||
return Objects.requireNonNull(ModuleRegistry.getByClass(PortalGUI.class)).isEnabled() || screen.isPauseScreen();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,12 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
|
||||
@Mixin(Deadmau5FeatureRenderer.class) public class Deadmau5FeatureRendererMixin {
|
||||
@Mixin(Deadmau5FeatureRenderer.class)
|
||||
public class Deadmau5FeatureRendererMixin {
|
||||
|
||||
@Redirect(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/network/AbstractClientPlayerEntity;FFFFFF)V",
|
||||
at = @At(value = "INVOKE", target = "Ljava/lang/String;equals(Ljava/lang/Object;)Z")) boolean atomic_overwriteNameMatcher(String s, Object anObject) {
|
||||
at = @At(value = "INVOKE", target = "Ljava/lang/String;equals(Ljava/lang/Object;)Z"))
|
||||
boolean atomic_overwriteNameMatcher(String s, Object anObject) {
|
||||
if (ModuleRegistry.getByClass(Deadmau5.class).isEnabled()) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
package me.x150.sipprivate.mixin;
|
||||
|
||||
import me.x150.sipprivate.CoffeeClientMain;
|
||||
import me.x150.sipprivate.feature.gui.DoesMSAA;
|
||||
import me.x150.sipprivate.feature.module.Module;
|
||||
import me.x150.sipprivate.feature.module.ModuleRegistry;
|
||||
import me.x150.sipprivate.helper.manager.ImGuiManager;
|
||||
import me.x150.sipprivate.helper.render.MSAAFramebuffer;
|
||||
import me.x150.sipprivate.helper.render.Renderer;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
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(GameRenderer.class)
|
||||
|
@ -48,6 +52,20 @@ public class GameRendererMixin {
|
|||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V"))
|
||||
void coffee_msaaScreenRender(Screen instance, MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
boolean shouldMsaa = false;
|
||||
for (Element child : instance.children()) {
|
||||
if (child instanceof DoesMSAA) {
|
||||
shouldMsaa = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (shouldMsaa) {
|
||||
MSAAFramebuffer.use(MSAAFramebuffer.MAX_SAMPLES, () -> instance.render(matrices, mouseX, mouseY, delta));
|
||||
} else instance.render(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "renderWorld")
|
||||
private void atomic_preRenderWorld(float tickDelta, long limitTime, MatrixStack matrix, CallbackInfo ci) {
|
||||
dis = true;
|
||||
|
|
|
@ -14,9 +14,11 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(SharedConstants.class) public class SharedConstantsMixin {
|
||||
@Mixin(SharedConstants.class)
|
||||
public class SharedConstantsMixin {
|
||||
|
||||
@Inject(method = "isValidChar", at = @At("HEAD"), cancellable = true) private static void atomic_replaceValidChar(char chr, CallbackInfoReturnable<Boolean> cir) {
|
||||
@Inject(method = "isValidChar", at = @At("HEAD"), cancellable = true)
|
||||
private static void atomic_replaceValidChar(char chr, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (ModuleRegistry.getByClass(AllowFormatCodes.class).isEnabled() && chr == '§') {
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package me.x150.sipprivate.mixin;
|
||||
|
||||
import me.x150.sipprivate.CoffeeClientMain;
|
||||
import me.x150.sipprivate.feature.gui.screen.AltManagerScreen;
|
||||
import me.x150.sipprivate.feature.gui.screen.HomeScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -19,9 +17,6 @@ public class TitleScreenMixin extends Screen {
|
|||
|
||||
@Inject(method = "init", at = @At("RETURN"))
|
||||
void real(CallbackInfo ci) {
|
||||
ButtonWidget bw = new ButtonWidget(5, 5, 100, 20, Text.of("Alts"), button -> {
|
||||
CoffeeClientMain.client.setScreen(AltManagerScreen.instance());
|
||||
});
|
||||
addDrawableChild(bw);
|
||||
client.setScreen(HomeScreen.instance());
|
||||
}
|
||||
}
|
||||
|
|
BIN
src/main/resources/assets/coffeeclient/background.jpg
Normal file
BIN
src/main/resources/assets/coffeeclient/background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
@ -1 +1,4 @@
|
|||
k
|
||||
Added home screen
|
||||
Removed custom buttons
|
||||
Reformat
|
||||
Fixed stupid bug with the alt screen
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
"mixins": [
|
||||
"AbstractBlockStateMixin",
|
||||
"AbstractClientPlayerEntityMixin",
|
||||
"AButtonWidgetMixin",
|
||||
"AChatScreenMixin",
|
||||
"AEntityRendererMixin",
|
||||
"AGenericContainerScreenMixin",
|
||||
|
|
1
src/main/resources/version.txt
Normal file
1
src/main/resources/version.txt
Normal file
|
@ -0,0 +1 @@
|
|||
0
|
Loading…
Reference in a new issue