Skip to content

Commit

Permalink
Update to 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
TangyKiwi committed Jun 14, 2023
1 parent 127f821 commit ab81bca
Show file tree
Hide file tree
Showing 55 changed files with 386 additions and 354 deletions.
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -60,6 +60,9 @@ dependencies {
implementation "com.github.Vatuu:discord-rpc:1.6.2"
include "com.github.Vatuu:discord-rpc:1.6.2"

implementation "com.github.LlamaLad7.MixinExtras:mixinextras-fabric:0.2.0-beta.8"
annotationProcessor "com.github.LlamaLad7.MixinExtras:mixinextras-fabric:0.2.0-beta.8"

modImplementation "com.ptsmods:devlogin:3.1.1"
}

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.1
loader_version=0.14.17
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.1
loader_version=0.14.21

# Mod Properties
mod_version = 7.14.50
maven_group = com.tangykiwi.kiwiclient
archives_base_name = kiwiclient

# Dependencies
fabric_version=0.76.0+1.19.4
fabric_version=0.83.1+1.20.1
# Sodium (https://github.com/CaffeineMC/sodium-fabric)
sodium_version=mc1.19.4-0.4.10
sodium_version=mc1.20-0.4.10
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.tangykiwi.kiwiclient.event;

import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.gui.DrawContext;

public class DrawOverlayEvent extends Event {

private MatrixStack matrix;
private DrawContext context;

public DrawOverlayEvent(MatrixStack matrix) {
this.matrix = matrix;
public DrawOverlayEvent(DrawContext context) {
this.context = context;
}

public MatrixStack getMatrix() {
return matrix;
public DrawContext getContext() {
return context;
}
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.tangykiwi.kiwiclient.gui;

import com.tangykiwi.kiwiclient.util.Utils;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
Expand All @@ -27,10 +28,10 @@ public AccountButtonWidget(Screen screen, int x, int y, PressAction pressAction)
}

@Override
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta)
public void renderButton(DrawContext context, int mouseX, int mouseY, float delta)
{
// Cascade the rendering
super.renderButton(matrices, mouseX, mouseY, delta);
super.renderButton(context, mouseX, mouseY, delta);

// Render the current session status
RenderSystem.setShaderTexture(0, texture);
Expand All @@ -47,6 +48,6 @@ public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float del
}
}
}
drawTexture(matrices, getX() + width - 6, getY() - 1, u, 60, 8, 8, 128, 128);
drawTexture(context, texture, getX() + width - 6, getY() - 1, u, 60, 0, 8, 8, 128, 128);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
import com.tangykiwi.kiwiclient.util.auth.LoginEncrypter;
import com.tangykiwi.kiwiclient.util.auth.LoginHelper;
import com.tangykiwi.kiwiclient.util.font.IFont;
import net.minecraft.client.gui.DrawContext;
import org.apache.commons.lang3.tuple.Pair;
import com.tangykiwi.kiwiclient.gui.window.Window;
import com.tangykiwi.kiwiclient.gui.window.WindowScreen;
import com.tangykiwi.kiwiclient.gui.window.widget.*;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.client.util.DefaultSkinHelper;
import net.minecraft.client.util.Session;
Expand Down Expand Up @@ -138,17 +138,17 @@ public void init() {
() -> openAddAccWindow(AccountType.CRACKED, "Cracked", new ItemStack(Items.BARRIER)), 40));
}

public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackground(matrices);
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
this.renderBackground(context);

IFont.CONSOLAS.drawString(matrices, client.getSession().getUsername(), 5, this.height - IFont.CONSOLAS.getFontHeight() - 2, Color.WHITE.hashCode(), 1.0F);
IFont.CONSOLAS.drawString(context.getMatrices(), client.getSession().getUsername(), 5, this.height - IFont.CONSOLAS.getFontHeight() - 2, Color.WHITE.hashCode(), 1.0F);

hovered = -1;
super.render(matrices, mouseX, mouseY, delta);
super.render(context, mouseX, mouseY, delta);
}

public void onRenderWindow(MatrixStack matrices, int window, int mouseX, int mouseY) {
super.onRenderWindow(matrices, window, mouseX, mouseY);
public void onRenderWindow(DrawContext context, int window, int mouseX, int mouseY) {
super.onRenderWindow(context, window, mouseX, mouseY);

if (window == 0) {
int x = getWindow(0).x1;
Expand All @@ -165,53 +165,31 @@ public void onRenderWindow(MatrixStack matrices, int window, int mouseX, int mou
continue;

boolean hover = getWindow(0).selected && mouseX >= x + 1 && mouseX <= x + listW - (shrink ? 12 : 1) && mouseY >= curY && mouseY <= curY + 27;
drawEntry(matrices, accounts.get(c), x + 2, curY + 1, listW - (shrink ? 13 : 3), 26,
drawEntry(context, accounts.get(c), x + 2, curY + 1, listW - (shrink ? 13 : 3), 26,
selected == c ? 0x6090e090 : hover ? 0x60b070f0 : 0x60606090);

if (hover)
hovered = c;
}

fill(matrices, x + listW, y + 12, x + listW + 1, y + h - 1, 0xff606090);
context.fill(x + listW, y + 12, x + listW + 1, y + h - 1, 0xff606090);
}
}

private void drawEntry(MatrixStack matrices, Account acc, int x, int y, int width, int height, int color) {
Window.fill(matrices, x, y, x + width, y + height, color);

if (acc.bindSkin()) {
double pixelSize = (height - 6) / 8d;
DrawableHelper.fill(matrices,
x + 2, y + 2,
x + height - 2, y + height - 2,
0x60d86ceb);
DrawableHelper.drawTexture(matrices,
x + 3, y + 3,
(int) (pixelSize * 8), (int) (pixelSize * 8),
(int) (pixelSize * 8), (int) (pixelSize * 8),
(int) (pixelSize * 64), (int) (pixelSize * 64));
}
private void drawEntry(DrawContext context, Account acc, int x, int y, int width, int height, int color) {
Window.fill(context, x, y, x + width, y + height, color);

boolean extendText = acc.bindCape();
if (extendText) {
double pixelSize = ((height - 6) / 10d) * 0.625;
DrawableHelper.fill(matrices,
x + height - 1, y + 2,
(int) (x + height + pixelSize * 10 + 1) + 1, y + height - 2,
0x60d86ceb);
DrawableHelper.drawTexture(matrices,
x + height, y + 3,
(int) Math.floor(pixelSize), (int) Math.floor(pixelSize),
(int) (pixelSize * 11), (int) (pixelSize * 16),
(int) (pixelSize * 64), (int) (pixelSize * 32));
}
double pixelSize = (height - 6) / 8d;
acc.bindSkin(context, pixelSize, x, y, height);

pixelSize = ((height - 6) / 10d) * 0.625;
boolean extendText = acc.bindCape(context, pixelSize, x, y, height);

double pixelSize = ((height - 6) / 10d) * 0.625;
IFont.CONSOLAS.drawString(matrices, acc.username, extendText ? (int) (x + height + pixelSize * 10 + 3) : x + height, y + 4, Color.WHITE.hashCode(), 1.0F);
IFont.CONSOLAS.drawString(matrices, (acc.type == AccountType.CRACKED ? "Cracked" : acc.type == AccountType.MOJANG ? "Mojang" : "Microsoft"), extendText ? (int) (x + height + pixelSize * 10 + 3) : x + height, y + height - 11, (acc.type == AccountType.CRACKED ? Color.YELLOW.hashCode() : acc.type == AccountType.MOJANG ? Color.GREEN.hashCode() : 0x55FFFF), 1.0F);
IFont.CONSOLAS.drawString(context.getMatrices(), acc.username, extendText ? (int) (x + height + pixelSize * 10 + 3) : x + height, y + 4, Color.WHITE.hashCode(), 1.0F);
IFont.CONSOLAS.drawString(context.getMatrices(), (acc.type == AccountType.CRACKED ? "Cracked" : acc.type == AccountType.MOJANG ? "Mojang" : "Microsoft"), extendText ? (int) (x + height + pixelSize * 10 + 3) : x + height, y + height - 11, (acc.type == AccountType.CRACKED ? Color.YELLOW.hashCode() : acc.type == AccountType.MOJANG ? Color.GREEN.hashCode() : 0x55FFFF), 1.0F);

if (acc.type != AccountType.CRACKED) {
IFont.CONSOLAS.drawString(matrices, (acc.success == 0 ? "?" : acc.success == 1 ? "x" : "+"),
IFont.CONSOLAS.drawString(context.getMatrices(), (acc.success == 0 ? "?" : acc.success == 1 ? "x" : "+"),
x + width - 10, y + height - 11, (acc.success == 0 ? 0xFFAA00 : acc.success == 1 ? Color.RED.hashCode() : Color.GREEN.hashCode()), 1.0F);
}
}
Expand Down Expand Up @@ -417,22 +395,44 @@ public Session getSession() throws AuthenticationException {
return type.createSession(input);
}

public boolean bindSkin() {
public void bindSkin(DrawContext context, double pixelSize, int x, int y, int height) {
if (textures.containsKey(MinecraftProfileTexture.Type.SKIN)) {
RenderSystem.setShaderTexture(0, textures.get(MinecraftProfileTexture.Type.SKIN));
context.fill(
x + 2, y + 2,
x + height - 2, y + height - 2,
0x60d86ceb);
context.drawTexture(textures.get(MinecraftProfileTexture.Type.SKIN),
x + 3, y + 3,
(int) (pixelSize * 8), (int) (pixelSize * 8),
(int) (pixelSize * 8), (int) (pixelSize * 8),
(int) (pixelSize * 64), (int) (pixelSize * 64));
} else {
RenderSystem.setShaderTexture(0, DefaultSkinHelper.getTexture());
context.fill(
x + 2, y + 2,
x + height - 2, y + height - 2,
0x60d86ceb);
context.drawTexture(DefaultSkinHelper.getTexture(),
x + 3, y + 3,
(int) (pixelSize * 8), (int) (pixelSize * 8),
(int) (pixelSize * 8), (int) (pixelSize * 8),
(int) (pixelSize * 64), (int) (pixelSize * 64));
}

return true;
}

public boolean bindCape() {
public boolean bindCape(DrawContext context, double pixelSize, int x, int y, int height) {
if (textures.containsKey(MinecraftProfileTexture.Type.CAPE)) {
RenderSystem.setShaderTexture(0, textures.get(MinecraftProfileTexture.Type.CAPE));
context.fill(
x + height - 1, y + 2,
(int) (x + height + pixelSize * 10 + 1) + 1, y + height - 2,
0x60d86ceb);
context.drawTexture(textures.get(MinecraftProfileTexture.Type.CAPE),
x + height, y + 3,
(int) Math.floor(pixelSize), (int) Math.floor(pixelSize),
(int) (pixelSize * 11), (int) (pixelSize * 16),
(int) (pixelSize * 64), (int) (pixelSize * 32));

return true;
}

return false;
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/com/tangykiwi/kiwiclient/gui/BindScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.tangykiwi.kiwiclient.modules.Module;
import com.tangykiwi.kiwiclient.util.Utils;
import com.tangykiwi.kiwiclient.util.font.IFont;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
Expand All @@ -22,8 +23,10 @@ public BindScreen(Module module) {
}

@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackground(matrices);
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
this.renderBackground(context);

MatrixStack matrices = context.getMatrices();

IFont.CONSOLAS.drawCenteredString(matrices, "Press a Key", width / 2D, height / 2D - IFont.CONSOLAS.getFontHeight(), Color.WHITE.getRGB(), 1);
IFont.CONSOLAS.drawCenteredString(matrices, "ESC to quit / DEL to remove bind", width / 2D, height / 2D, Color.WHITE.getRGB(), 1);
Expand All @@ -44,7 +47,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
}
}
IFont.CONSOLAS.drawCenteredString(matrices, "Current Key: " + kn, width / 2D, height / 2D + IFont.CONSOLAS.getFontHeight(), Color.WHITE.getRGB(), 1);
super.render(matrices, mouseX, mouseY, delta);
super.render(context, mouseX, mouseY, delta);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.tangykiwi.kiwiclient.gui.window.Window;
import com.tangykiwi.kiwiclient.gui.window.WindowScreen;
import com.tangykiwi.kiwiclient.util.font.IFont;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import org.apache.commons.lang3.ArrayUtils;
Expand Down Expand Up @@ -36,17 +37,18 @@ public boolean shouldPause() {
return false;
}

public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackground(matrices);
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
this.renderBackground(context);

for (Window w : getWindows()) {
if (w instanceof ClickGuiWindow) {
((ClickGuiWindow) w).updateKeys(mouseX, mouseY, keyDown, lmDown, rmDown, lmHeld, mwScroll);
}
}

super.render(matrices, mouseX, mouseY, delta);
super.render(context, mouseX, mouseY, delta);

MatrixStack matrices = context.getMatrices();
matrices.push();
matrices.translate(0, 0, 250);

Expand All @@ -73,14 +75,14 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
int start = tooltipY + 1;
for (int l = 0; l < lines.size(); l++) {
if(lines.get(l).equals("ᴍᴀᴋᴇꜱ ʏᴏᴜʀ ᴍᴇꜱꜱᴀɢᴇꜱ ғᴀɴᴄʏ!")) {
fill(matrices, tooltip.getLeft(), start + (l * 10) - 1,
context.fill(tooltip.getLeft(), start + (l * 10) - 1,
tooltip.getLeft() + textRenderer.getWidth(lines.get(l)) + 3,
start + (l * 10) + 11, 0xff000000);

textRenderer.draw(matrices, lines.get(l), tooltip.getLeft() + 2, start + (l * 10) + 1, -1);
context.drawText(textRenderer, lines.get(l), tooltip.getLeft() + 2, start + (l * 10) + 1, -1, false);
}
else {
fill(matrices, tooltip.getLeft(), start + (l * 10) - 1,
context.fill(tooltip.getLeft(), start + (l * 10) - 1,
tooltip.getLeft() + IFont.CONSOLAS.getStringWidth(lines.get(l)) + 5,
start + (l * 10) + 11, 0xff000000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.tangykiwi.kiwiclient.gui.window.Window;
import com.tangykiwi.kiwiclient.modules.Category;
import com.tangykiwi.kiwiclient.modules.Module;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -65,7 +66,7 @@ public void initWindows() {
}
}

public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
searchField.visible = true;

searchField.setSuggestion(searchField.getText().isEmpty() ? "Search here" : "");
Expand All @@ -88,6 +89,6 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
}
}

super.render(matrices, mouseX, mouseY, delta);
super.render(context, mouseX, mouseY, delta);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.tangykiwi.kiwiclient.util.font.GlyphPageFontRenderer;
import com.tangykiwi.kiwiclient.util.render.RenderUtils;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -35,7 +36,8 @@ public boolean shouldClose(int mouseX, int mouseY) {
return false;
}

protected void drawBar(MatrixStack matrices, int mouseX, int mouseY, GlyphPageFontRenderer textRend) {
protected void drawBar(DrawContext context, int mouseX, int mouseY, GlyphPageFontRenderer textRend) {
MatrixStack matrices = context.getMatrices();
/* background */
RenderUtils.renderRoundedQuad(matrices, new Color(0xff6060b0), x1, y1, x2, y2, 5, 20);

Expand All @@ -51,8 +53,8 @@ protected void drawBar(MatrixStack matrices, int mouseX, int mouseY, GlyphPageFo
textRend.drawString(matrices, hiding ? "+" : "_", x2 - 11, y1 + (hiding ? 3 : 1), 0xffffff, 1);
}

public void render(MatrixStack matrices, int mouseX, int mouseY) {
super.render(matrices, mouseX, mouseY);
public void render(DrawContext context, int mouseX, int mouseY) {
super.render(context, mouseX, mouseY);

if (rmDown && mouseOver(x1, y1, x1 + (x2 - x1), y1 + 13)) {
mc.getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
Expand Down
Loading

0 comments on commit ab81bca

Please sign in to comment.