Skip to content

Commit

Permalink
Update to 1.20 (#3708)
Browse files Browse the repository at this point in the history
  • Loading branch information
Big-Iron-Cheems authored Jun 10, 2023
1 parent d29a4b0 commit 531155c
Show file tree
Hide file tree
Showing 77 changed files with 520 additions and 499 deletions.
34 changes: 17 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "fabric-loom" version "1.1-SNAPSHOT"
id "fabric-loom" version "1.2-SNAPSHOT"
id "maven-publish"
id "com.github.johnrengelman.shadow" version "7.1.2"
}
Expand All @@ -12,9 +12,9 @@ group = project.maven_group

repositories {
maven {
name = "meteor-maven"
url = "https://maven.meteordev.org/releases"
}
name = "meteor-maven"
url = "https://maven.meteordev.org/releases"
}
maven {
name = "meteor-maven-snapshots"
url = "https://maven.meteordev.org/snapshots"
Expand Down Expand Up @@ -45,20 +45,20 @@ configurations {
}

dependencies {
// Fabric
// Fabric
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modInclude fabricApi.module("fabric-resource-loader-v0", project.fapi_version)

// Compat fixes
// Compat fixes
modCompileOnly fabricApi.module("fabric-renderer-indigo", project.fapi_version)
modCompileOnly("maven.modrinth:sodium:${project.sodium_version}") { transitive = false }
modCompileOnly("maven.modrinth:lithium:${project.lithium_version}") { transitive = false }
modCompileOnly("maven.modrinth:iris:${project.iris_version}") { transitive = false }
//modCompileOnly("io.vram:canvas-fabric-mc119:1.0.+") { transitive = false } // TODO: 1.19.3

// Baritone (https://github.com/MeteorDevelopment/baritone)
// Baritone (https://github.com/MeteorDevelopment/baritone)
modInclude "baritone:fabric:${project.minecraft_version}-SNAPSHOT"

// Libraries
Expand Down Expand Up @@ -86,7 +86,7 @@ afterEvaluate {
}

shadowJar {
configurations = [ project.configurations.shadow ]
configurations = [project.configurations.shadow]

dependencies {
exclude {
Expand All @@ -98,22 +98,22 @@ shadowJar {
processResources {
filesMatching("fabric.mod.json") {
expand "version": project.version,
"devbuild": project.findProperty("devbuild") ?: "",
"commit": project.findProperty("commit") ?: ""
"devbuild": project.findProperty("devbuild") ?: "",
"commit": project.findProperty("commit") ?: ""
}
}

jar {
from "LICENSE"
from "LICENSE"

manifest {
attributes("Main-Class": "meteordevelopment.meteorclient.Main")
}
manifest {
attributes("Main-Class": "meteordevelopment.meteorclient.Main")
}
}

remapJar {
dependsOn shadowJar
inputFile.set(shadowJar.archiveFile)
dependsOn shadowJar
inputFile.set(shadowJar.archiveFile)
}

javadoc {
Expand All @@ -123,7 +123,7 @@ javadoc {

task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set("sources")
from sourceSets.main.allSource
from sourceSets.main.allSource
}

task javadocJar(type: Jar) {
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
org.gradle.jvmargs=-Xmx2G

# Fabric (https://fabricmc.net/develop)
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.1
loader_version=0.14.17
fapi_version=0.75.3+1.19.4
minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.14.21
fapi_version=0.83.0+1.20

# Mod Properties
mod_version=0.5.4
Expand All @@ -14,13 +14,13 @@ archives_base_name=meteor-client
# Dependency Versions

# Sodium (https://github.com/CaffeineMC/sodium-fabric)
sodium_version=mc1.19.4-0.4.10
sodium_version=mc1.20-0.4.10

# Lithium (https://github.com/CaffeineMC/lithium-fabric)
lithium_version=mc1.19.4-0.11.1
lithium_version=mc1.20-0.11.2

# Iris (https://github.com/IrisShaders/Iris)
iris_version=1.6.1+1.19.4
iris_version=1.6.4+1.20

# Orbit (https://github.com/MeteorDevelopment/orbit)
orbit_version=0.2.3
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
19 changes: 12 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
package meteordevelopment.meteorclient.events.render;

import meteordevelopment.meteorclient.utils.Utils;
import net.minecraft.client.gui.DrawContext;

public class Render2DEvent {
private static final Render2DEvent INSTANCE = new Render2DEvent();

public DrawContext drawContext;
public int screenWidth, screenHeight;
public double frameTime;
public float tickDelta;

public static Render2DEvent get(int screenWidth, int screenHeight, float tickDelta) {
public static Render2DEvent get(DrawContext drawContext, int screenWidth, int screenHeight, float tickDelta) {
INSTANCE.drawContext = drawContext;
INSTANCE.screenWidth = screenWidth;
INSTANCE.screenHeight = screenHeight;
INSTANCE.frameTime = Utils.frameTime;
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/meteordevelopment/meteorclient/gui/WidgetScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import meteordevelopment.meteorclient.utils.misc.CursorStyle;
import meteordevelopment.meteorclient.utils.misc.input.Input;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -244,8 +245,8 @@ public boolean charTyped(char chr, int keyCode) {
}

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

double s = mc.getWindow().getScaleFactor();
mouseX *= s;
Expand All @@ -259,20 +260,22 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
// Apply projection without scaling
Utils.unscaledProjection();

onRenderBefore(delta);
onRenderBefore(context, delta);

RENDERER.theme = theme;
theme.beforeRender();

RENDERER.begin(matrices);
RENDERER.begin(context);
RENDERER.setAlpha(animProgress);
root.render(RENDERER, mouseX, mouseY, delta / 20);
RENDERER.setAlpha(1);
RENDERER.end(matrices);
RENDERER.end();

boolean tooltip = RENDERER.renderTooltip(mouseX, mouseY, delta / 20, matrices);
boolean tooltip = RENDERER.renderTooltip(context, mouseX, mouseY, delta / 20);

if (debug) {
MatrixStack matrices = context.getMatrices();

DEBUG_RENDERER.render(root, matrices);
if (tooltip) DEBUG_RENDERER.render(RENDERER.tooltipWidget, matrices);
}
Expand All @@ -289,7 +292,7 @@ protected void runAfterRenderTasks() {
}
}

protected void onRenderBefore(float delta) {}
protected void onRenderBefore(DrawContext drawContext, float delta) {}

@Override
public void resize(MinecraftClient client, int width, int height) {
Expand Down Expand Up @@ -318,10 +321,7 @@ public void removed() {
Input.setCursorStyle(CursorStyle.Default);

loopWidgets(root, widget -> {
if (widget instanceof WTextBox textBox) {

if (textBox.isFocused()) textBox.setFocused(false);
}
if (widget instanceof WTextBox textBox && textBox.isFocused()) textBox.setFocused(false);
});

MeteorClient.EVENT_BUS.unsubscribe(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
import meteordevelopment.meteorclient.utils.misc.MeteorIdentifier;
import meteordevelopment.meteorclient.utils.misc.Pool;
import meteordevelopment.meteorclient.utils.render.ByteTexture;
import meteordevelopment.meteorclient.utils.render.RenderUtils;
import meteordevelopment.meteorclient.utils.render.color.Color;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;

import java.util.ArrayList;
Expand Down Expand Up @@ -58,7 +60,7 @@ public class GuiRenderer {
public WWidget tooltipWidget;
private double tooltipAnimProgress;

private MatrixStack matrices;
private DrawContext drawContext;

public static GuiTexture addTexture(Identifier id) {
return TEXTURE_PACKER.add(id);
Expand All @@ -76,17 +78,15 @@ public static void init() {
TEXTURE = TEXTURE_PACKER.pack();
}

public void begin(MatrixStack matrices) {
this.matrices = matrices;
public void begin(DrawContext drawContext) {
this.drawContext = drawContext;

GL.enableBlend();
GL.enableScissorTest();
scissorStart(0, 0, getWindowWidth(), getWindowHeight());
}

public void end(MatrixStack matrices) {
this.matrices = matrices;

public void end() {
scissorEnd();

for (Runnable task : postTasks) task.run();
Expand All @@ -104,24 +104,24 @@ public void endRender() {
r.end();
rTex.end();

r.render(matrices);
r.render(drawContext.getMatrices());

GL.bindTexture(TEXTURE.getGlId());
rTex.render(matrices);
rTex.render(drawContext.getMatrices());

// Normal text
theme.textRenderer().begin(theme.scale(1));
for (TextOperation text : texts) {
if (!text.title) text.run(textPool);
}
theme.textRenderer().end(matrices);
theme.textRenderer().end(drawContext.getMatrices());

// Title text
theme.textRenderer().begin(theme.scale(1.25));
for (TextOperation text : texts) {
if (text.title) text.run(textPool);
}
theme.textRenderer().end(matrices);
theme.textRenderer().end(drawContext.getMatrices());

texts.clear();
}
Expand Down Expand Up @@ -155,7 +155,7 @@ public void scissorEnd() {
scissorPool.free(scissor);
}

public boolean renderTooltip(double mouseX, double mouseY, double delta, MatrixStack matrices) {
public boolean renderTooltip(DrawContext drawContext, double mouseX, double mouseY, double delta) {
tooltipAnimProgress += (tooltip != null ? 1 : -1) * delta * 14;
tooltipAnimProgress = Utils.clamp(tooltipAnimProgress, 0, 1);

Expand All @@ -171,9 +171,9 @@ public boolean renderTooltip(double mouseX, double mouseY, double delta, MatrixS

setAlpha(tooltipAnimProgress);

begin(matrices);
begin(drawContext);
tooltipWidget.render(this, mouseX, mouseY, delta);
end(matrices);
end();

setAlpha(1);

Expand Down Expand Up @@ -231,14 +231,18 @@ public void texture(double x, double y, double width, double height, double rota
rTex.end();

texture.bind();
rTex.render(matrices);
rTex.render(drawContext.getMatrices());
});
}

public void post(Runnable task) {
scissorStack.peek().postTasks.add(task);
}

public void item(ItemStack itemStack, int x, int y, float scale, boolean overlay) {
RenderUtils.drawItem(drawContext, itemStack, x, y, scale, overlay);
}

public void absolutePost(Runnable task) {
postTasks.add(task);
}
Expand Down
Loading

0 comments on commit 531155c

Please sign in to comment.