feat: port to 1.21.7

This commit is contained in:
amyavi 2025-07-06 16:06:49 -03:00
parent 514912ba2a
commit 4ee8c7a6f3
No known key found for this signature in database
12 changed files with 36 additions and 40 deletions

View file

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.10-SNAPSHOT'
id 'fabric-loom' version '1.11-SNAPSHOT'
}
base.archivesName = project.archives_base_name
@ -8,6 +8,12 @@ group = project.maven_group
repositories {
mavenCentral()
// adventure snapshots
maven {
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
mavenContent { snapshotsOnly() }
}
}
dependencies {
@ -23,14 +29,14 @@ dependencies {
include(implementation("org.luaj:luaj-jse:3.0.1"))
// Configurate
include(implementation("org.spongepowered:configurate-core:4.1.2"))
include(implementation("org.spongepowered:configurate-gson:4.1.2"))
include(implementation("org.spongepowered:configurate-core:4.2.0"))
include(implementation("org.spongepowered:configurate-gson:4.2.0"))
include(implementation("io.leangen.geantyref:geantyref:1.3.16"))
// Adventure
include(modImplementation("net.kyori:adventure-platform-fabric:6.2.0"))
include(implementation("net.kyori:adventure-text-serializer-gson:4.18.0"))
include(implementation("net.kyori:adventure-text-serializer-legacy:4.18.0"))
include(modImplementation("net.kyori:adventure-platform-fabric:6.5.0-SNAPSHOT"))
include(implementation("net.kyori:adventure-text-serializer-gson:4.23.0"))
include(implementation("net.kyori:adventure-text-serializer-legacy:4.23.0"))
}
processResources {

View file

@ -4,9 +4,9 @@ org.gradle.parallel=true
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.2
loader_version=0.16.9
minecraft_version=1.21.7
yarn_mappings=1.21.7+build.6
loader_version=0.16.14
# Mod Properties
mod_version = 1.0.0
@ -14,6 +14,6 @@ org.gradle.parallel=true
archives_base_name = chipmunkmod
# Dependencies
fabric_version=0.113.0+1.21.4
fabric_version=0.128.2+1.21.7

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View file

@ -72,7 +72,7 @@ public class CommandManager {
}
final MutableText text = Text.literal("")
.formatted(Formatting.GRAY);
text.setStyle(text.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, prefix + input)));
text.setStyle(text.getStyle().withClickEvent(new ClickEvent.SuggestCommand(prefix + input)));
final int cursor = Math.min(input.length(), _cursor);

View file

@ -4,10 +4,10 @@ import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.context.CommandContext;
import land.chipmunk.chipmunkmod.modules.CommandCore;
import land.chipmunk.chipmunkmod.util.TextUtilities;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.Text;
import net.minecraft.text.TextCodecs;
import java.util.concurrent.CompletableFuture;
@ -65,8 +65,7 @@ public class CoreCommand {
final CompletableFuture<NbtCompound> future = CommandCore.INSTANCE.runTracked(command);
future.thenApply(tag -> {
try {
final String output = tag.getString("LastOutput");
if (output != null) source.sendFeedback(TextUtilities.fromJson(output));
tag.get("LastOutput", TextCodecs.CODEC).ifPresent(source::sendFeedback);
} catch (final Exception e) {
e.printStackTrace();
}

View file

@ -43,7 +43,7 @@ public class ItemCommand {
final ItemStack stack = getItemStackArgument(context, "item").createStack(count, false);
final int slot = 36 + client.player.getInventory().selectedSlot;
final int slot = 36 + client.player.getInventory().getSelectedSlot();
client.getNetworkHandler().getConnection().send(new CreativeInventoryActionC2SPacket(slot, stack));

View file

@ -2,6 +2,7 @@ package land.chipmunk.chipmunkmod.mixin;
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import io.netty.channel.ChannelFutureListener;
import land.chipmunk.chipmunkmod.ChipmunkMod;
import land.chipmunk.chipmunkmod.listeners.Listener;
import land.chipmunk.chipmunkmod.listeners.ListenerManager;
@ -9,7 +10,6 @@ import land.chipmunk.chipmunkmod.modules.SelfCare;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.network.DisconnectionInfo;
import net.minecraft.network.PacketCallbacks;
import net.minecraft.network.listener.PacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.c2s.play.RequestCommandCompletionsC2SPacket;
@ -17,6 +17,7 @@ import net.minecraft.network.packet.s2c.play.ParticleS2CPacket;
import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@ -104,10 +105,10 @@ public class ClientConnectionMixin {
}
}
@WrapMethod(method = "send(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/PacketCallbacks;Z)V")
@WrapMethod(method = "send(Lnet/minecraft/network/packet/Packet;Lio/netty/channel/ChannelFutureListener;Z)V")
private void sendPacket (
final Packet<?> packet,
final PacketCallbacks callbacks,
final @Nullable ChannelFutureListener channelFutureListener,
final boolean flush,
final Operation<Void> original
) {
@ -120,7 +121,7 @@ public class ClientConnectionMixin {
listener.packetSent(packet);
}
original.call(packet, callbacks, flush);
original.call(packet, channelFutureListener, flush);
}
@Inject(method = "disconnect(Lnet/minecraft/network/DisconnectionInfo;)V", at = @At("TAIL"))

View file

@ -387,7 +387,7 @@ public class CommandCore implements Listener {
final int freeHotBarSlot = player.getInventory().getEmptySlot();
final int slot = 36 + freeHotBarSlot;
final int oldSelectedSlot = player.getInventory().selectedSlot;
final int oldSelectedSlot = player.getInventory().getSelectedSlot();
final ItemStack oldStack = player.getInventory().getStack(slot).copy();
final ItemStack commandBlock = new ItemStack(Items.COMMAND_BLOCK);

View file

@ -230,7 +230,7 @@ public class SongPlayer {
final String sound = note.instrument.sound;
client.submit(() -> client.world.playSound(
client.submit(() -> client.world.playSoundClient(
client.player.getX() + note.position.getX(),
client.player.getY() + note.position.getY(),
client.player.getZ() + note.position.getZ(),

View file

@ -74,10 +74,13 @@ public final class CustomChatComponentRenderer extends TranslatableComponentRend
private ClickEvent mergeClickEvent (final ClickEvent clickEvent, final CustomChatContext context) {
if (clickEvent == null) return null;
final String value = clickEvent.value();
final String arg = context.args().get(value);
final ClickEvent.Payload payload = clickEvent.payload();
if (!(payload instanceof final ClickEvent.Payload.Text text)) return clickEvent;
final String arg = context.args().get(text.value());
if (arg == null) return clickEvent;
// TODO: figure out solution for deprecation warning in the future
return ClickEvent.clickEvent(clickEvent.action(), arg);
}
}

View file

@ -1,21 +1,8 @@
package land.chipmunk.chipmunkmod.util;
import com.google.common.base.Suppliers;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.registry.Registries;
import net.minecraft.text.MutableText;
import net.minecraft.text.PlainTextContent;
import net.minecraft.text.Text;
import net.minecraft.text.TextContent;
import net.minecraft.text.*;
public class TextUtilities {
public static MutableText fromJson (final String json) {
return Text.Serialization.fromJson(
json,
Suppliers.ofInstance(DynamicRegistryManager.of(Registries.REGISTRIES)).get()
);
}
public static String plainOrNull (final Text text) {
final TextContent content = text.getContent();
if (!(content instanceof final PlainTextContent plainContent)) return null;

View file

@ -30,9 +30,9 @@
],
"depends": {
"fabricloader": ">=0.16.9",
"fabricloader": ">=0.16.13",
"fabric-api": "*",
"minecraft": "1.21.4",
"minecraft": "1.21.7",
"java": ">=21"
}
}