Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Merge branch '1.20.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Apr 29, 2024
2 parents c82df87 + bdd8d9a commit fe03ebf
Show file tree
Hide file tree
Showing 57 changed files with 427 additions and 444 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Set up Java 17
- name: Set up Java 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'microsoft'

- name: Grant execute permission for gradlew
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## Setup (for developers)

(This assumes that you are using Windows with [Eclipse](https://www.eclipse.org/downloads/) and [Java Development Kit 17](https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot) already installed.)
(This assumes that you are using Windows with [Eclipse](https://www.eclipse.org/downloads/) and [Java Development Kit 21](https://adoptium.net/?variant=openjdk21&jvmVariant=hotspot) already installed.)

1. Run this command in PowerShell:

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ plugins {

def ENV = System.getenv()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

archivesBaseName = project.archives_base_name
version = project.mod_version
Expand Down Expand Up @@ -58,8 +58,8 @@ processResources {
}

tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
// Minecraft 1.20.5 (24w14a) upwards uses Java 21.
it.options.release = 21
}

java {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ org.gradle.parallel=true
# Fabric Properties
# check these at https://fabricmc.net/develop/ and
# https://www.curseforge.com/minecraft/mc-mods/fabric-api
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
loader_version=0.15.10

#Fabric api
fabric_version=0.97.0+1.20.4
fabric_version=0.97.8+1.20.6

# Mod Properties
mod_version = v7.41.2-MC1.20.4
mod_version = v7.41.2-MC1.20.6
maven_group = net.wurstclient
archives_base_name = Wurst-Client

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/java/net/wurstclient/WurstClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public enum WurstClient
public static IMinecraftClient IMC;

public static final String VERSION = "7.41.2";
public static final String MC_VERSION = "1.20.4";
public static final String MC_VERSION = "1.20.6";

private WurstAnalytics analytics;
private EventManager eventManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
Expand Down Expand Up @@ -197,7 +198,7 @@ private static String microsoftLogin(String email, String password,

try
{
URL url = new URL(urlPost);
URL url = URI.create(urlPost).toURL();
HttpURLConnection connection =
(HttpURLConnection)url.openConnection();

Expand Down Expand Up @@ -504,7 +505,7 @@ private static URL createURL(String url)
{
try
{
return new URL(url);
return URI.create(url).toURL();

}catch(MalformedURLException e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.net.Proxy;
import java.net.Proxy.Type;
import java.net.SocketAddress;
import java.net.URI;
import java.net.URL;
import java.util.LinkedList;
import java.util.Scanner;
Expand Down Expand Up @@ -532,7 +533,7 @@ private static void dispatchRequest(String argURL, String userAgent)
{
try
{
URL url = new URL(argURL);
URL url = URI.create(argURL).toURL();
HttpURLConnection connection =
(HttpURLConnection)url.openConnection(proxy);
connection.setRequestMethod("GET");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ public void render(DrawContext context, int mouseX, int mouseY,
float partialTicks)
{
MatrixStack matrixStack = context.getMatrices();
renderBackground(context, mouseX, mouseY, partialTicks);

listGui.render(context, mouseX, mouseY, partialTicks);

matrixStack.push();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ public void render(DrawContext context, int mouseX, int mouseY,
float partialTicks)
{
MatrixStack matrixStack = context.getMatrices();
renderBackground(context, mouseX, mouseY, partialTicks);

listGui.render(context, mouseX, mouseY, partialTicks);

context.drawCenteredTextWithShadow(client.textRenderer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public void render(DrawContext context, int mouseX, int mouseY,
float partialTicks)
{
MatrixStack matrixStack = context.getMatrices();
renderBackgroundTexture(context);
renderBackground(context, mouseX, mouseY, partialTicks);

matrixStack.push();
matrixStack.translate(0, 0, 300);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ public void render(DrawContext context, int mouseX, int mouseY,
float partialTicks)
{
MatrixStack matrixStack = context.getMatrices();
renderBackground(context, mouseX, mouseY, partialTicks);

listGui.render(context, mouseX, mouseY, partialTicks);

matrixStack.push();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ public void render(DrawContext context, int mouseX, int mouseY,
float partialTicks)
{
MatrixStack matrixStack = context.getMatrices();
renderBackground(context, mouseX, mouseY, partialTicks);

listGui.render(context, mouseX, mouseY, partialTicks);

context.drawCenteredTextWithShadow(client.textRenderer,
Expand Down
21 changes: 13 additions & 8 deletions src/main/java/net/wurstclient/commands/AuthorCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
*/
package net.wurstclient.commands;

import net.minecraft.item.Item;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.WrittenBookContentComponent;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtString;
import net.wurstclient.command.CmdError;
import net.wurstclient.command.CmdException;
import net.wurstclient.command.CmdSyntaxError;
Expand All @@ -33,15 +33,20 @@ public void call(String[] args) throws CmdException
if(!MC.player.getAbilities().creativeMode)
throw new CmdError("Creative mode only.");

ItemStack heldItem = MC.player.getInventory().getMainHandStack();
int heldItemID = Item.getRawId(heldItem.getItem());
int writtenBookID = Item.getRawId(Items.WRITTEN_BOOK);

if(heldItemID != writtenBookID)
ItemStack heldStack = MC.player.getInventory().getMainHandStack();
if(!heldStack.isOf(Items.WRITTEN_BOOK))
throw new CmdError(
"You must hold a written book in your main hand.");

WrittenBookContentComponent oldData = heldStack.getComponents()
.get(DataComponentTypes.WRITTEN_BOOK_CONTENT);
if(oldData == null)
throw new CmdError("Can't find book data.");

String author = String.join(" ", args);
heldItem.setSubNbt("author", NbtString.of(author));
WrittenBookContentComponent newData =
new WrittenBookContentComponent(oldData.title(), author,
oldData.generation(), oldData.pages(), oldData.resolved());
heldStack.set(DataComponentTypes.WRITTEN_BOOK_CONTENT, newData);
}
}
3 changes: 1 addition & 2 deletions src/main/java/net/wurstclient/commands/EnchantCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import net.wurstclient.command.CmdSyntaxError;
import net.wurstclient.command.Command;
import net.wurstclient.util.ChatUtils;
import net.wurstclient.util.ItemUtils;

public final class EnchantCmd extends Command
{
Expand Down Expand Up @@ -71,7 +70,7 @@ private void enchant(ItemStack stack, int level)
continue;
}

ItemUtils.addEnchantment(stack, enchantment, level);
stack.addEnchantment(enchantment, level);
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/net/wurstclient/commands/GiveCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import com.mojang.brigadier.exceptions.CommandSyntaxException;

import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.NbtComponent;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
Expand Down Expand Up @@ -83,7 +85,7 @@ public void call(String[] args) throws CmdException
try
{
NbtCompound tag = StringNbtReader.parse(nbt);
stack.setNbt(tag);
NbtComponent.set(DataComponentTypes.CUSTOM_DATA, stack, tag);

}catch(CommandSyntaxException e)
{
Expand Down
24 changes: 16 additions & 8 deletions src/main/java/net/wurstclient/commands/ModifyCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import com.mojang.brigadier.exceptions.CommandSyntaxException;

import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.NbtComponent;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.StringNbtReader;
Expand Down Expand Up @@ -77,16 +79,19 @@ public void call(String[] args) throws CmdException

private void add(ItemStack stack, String[] args) throws CmdError
{
String nbt = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
nbt = nbt.replace("$", "\u00a7").replace("\u00a7\u00a7", "$");
String nbtString =
String.join(" ", Arrays.copyOfRange(args, 1, args.length))
.replace("$", "\u00a7").replace("\u00a7\u00a7", "$");

if(!stack.hasNbt())
stack.setNbt(new NbtCompound());
NbtCompound itemNbt = stack
.getOrDefault(DataComponentTypes.CUSTOM_DATA, NbtComponent.DEFAULT)
.copyNbt();

try
{
NbtCompound tag = StringNbtReader.parse(nbt);
stack.getNbt().copyFrom(tag);
NbtCompound parsedNbt = StringNbtReader.parse(nbtString);
itemNbt.copyFrom(parsedNbt);
stack.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(itemNbt));

}catch(CommandSyntaxException e)
{
Expand All @@ -103,7 +108,7 @@ private void set(ItemStack stack, String[] args) throws CmdError
try
{
NbtCompound tag = StringNbtReader.parse(nbt);
stack.setNbt(tag);
stack.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(tag));

}catch(CommandSyntaxException e)
{
Expand All @@ -117,12 +122,15 @@ private void remove(ItemStack stack, String[] args) throws CmdException
if(args.length > 2)
throw new CmdSyntaxError();

NbtPath path = parseNbtPath(stack.getNbt(), args[1]);
NbtPath path = parseNbtPath(stack
.getOrDefault(DataComponentTypes.CUSTOM_DATA, NbtComponent.DEFAULT)
.copyNbt(), args[1]);

if(path == null)
throw new CmdError("The path does not exist.");

path.base.remove(path.key);
stack.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(path.base));
}

private NbtPath parseNbtPath(NbtCompound tag, String path)
Expand Down
Loading

0 comments on commit fe03ebf

Please sign in to comment.