diff --git a/gradle.properties b/gradle.properties index 459ebac..6fbd458 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G # Fabric Properties -minecraft_version=1.20.6 -yarn_mappings=1.20.6+build.1 +minecraft_version=1.21 +yarn_mappings=1.21+build.2 loader_version=0.15.11 # Fabric API -fabric_version=0.98.0+1.20.6 +fabric_version=0.99.4+1.21 # Mod Properties mod_version=2.4.2 @@ -13,4 +13,4 @@ maven_group=org.samo_lego archives_base_name=fabrictailor # Dependencies c2b_lib_version=1.2.3 -carpet_core_version=1.4.141 +carpet_core_version=1.4.147 diff --git a/src/main/java/org/samo_lego/fabrictailor/FabricTailor.java b/src/main/java/org/samo_lego/fabrictailor/FabricTailor.java index 74e0a31..a1687d5 100644 --- a/src/main/java/org/samo_lego/fabrictailor/FabricTailor.java +++ b/src/main/java/org/samo_lego/fabrictailor/FabricTailor.java @@ -16,6 +16,7 @@ import org.samo_lego.fabrictailor.config.TailorConfig; import org.samo_lego.fabrictailor.network.NetworkHandler; import org.samo_lego.fabrictailor.network.payload.DefaultSkinPayload; +import org.samo_lego.fabrictailor.network.payload.FabricTailorHelloPayload; import org.samo_lego.fabrictailor.network.payload.HDSkinPayload; import org.samo_lego.fabrictailor.network.payload.VanillaSkinPayload; @@ -56,6 +57,8 @@ public void onInitialize() { ServerConfigurationConnectionEvents.CONFIGURE.register(NetworkHandler::onConfigured); + PayloadTypeRegistry.configurationS2C().register(FabricTailorHelloPayload.TYPE, FabricTailorHelloPayload.CODEC); + PayloadTypeRegistry.playC2S().register(VanillaSkinPayload.TYPE, VanillaSkinPayload.CODEC); ServerPlayNetworking.registerGlobalReceiver(VanillaSkinPayload.TYPE, NetworkHandler::changeVanillaSkinPacket); diff --git a/src/main/java/org/samo_lego/fabrictailor/client/ClientTailor.java b/src/main/java/org/samo_lego/fabrictailor/client/ClientTailor.java index ff981de..9f8692e 100644 --- a/src/main/java/org/samo_lego/fabrictailor/client/ClientTailor.java +++ b/src/main/java/org/samo_lego/fabrictailor/client/ClientTailor.java @@ -8,7 +8,6 @@ import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; import net.fabricmc.fabric.api.client.networking.v1.ClientConfigurationNetworking; import net.fabricmc.fabric.api.client.networking.v1.ClientLoginConnectionEvents; -import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; import net.minecraft.ChatFormatting; import net.minecraft.client.KeyMapping; import org.lwjgl.glfw.GLFW; @@ -62,7 +61,6 @@ public void onInitializeClient() { forceOpen = false; }); - PayloadTypeRegistry.configurationS2C().register(FabricTailorHelloPayload.TYPE, FabricTailorHelloPayload.CODEC); ClientConfigurationNetworking.registerGlobalReceiver(FabricTailorHelloPayload.TYPE, (payload, context) -> { TAILORED_SERVER = true; ALLOW_DEFAULT_SKIN = payload.allowSkinButton(); diff --git a/src/main/java/org/samo_lego/fabrictailor/client/screen/SkinChangeScreen.java b/src/main/java/org/samo_lego/fabrictailor/client/screen/SkinChangeScreen.java index 426ae05..9e2ea1c 100644 --- a/src/main/java/org/samo_lego/fabrictailor/client/screen/SkinChangeScreen.java +++ b/src/main/java/org/samo_lego/fabrictailor/client/screen/SkinChangeScreen.java @@ -3,12 +3,6 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; import com.mojang.blaze3d.systems.RenderSystem; -import java.io.File; -import java.nio.file.Path; -import java.util.Arrays; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.CompletableFuture; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; @@ -29,8 +23,6 @@ import org.joml.Quaternionf; import org.joml.Vector3f; import org.samo_lego.fabrictailor.casts.TailoredPlayer; -import static org.samo_lego.fabrictailor.client.ClientTailor.ALLOW_DEFAULT_SKIN; -import static org.samo_lego.fabrictailor.client.ClientTailor.TAILORED_SERVER; import org.samo_lego.fabrictailor.client.screen.tabs.CapeTab; import org.samo_lego.fabrictailor.client.screen.tabs.LocalSkinTab; import org.samo_lego.fabrictailor.client.screen.tabs.PlayerSkinTab; @@ -40,6 +32,16 @@ import org.samo_lego.fabrictailor.network.payload.DefaultSkinPayload; import org.samo_lego.fabrictailor.util.TextTranslations; +import java.io.File; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; + +import static org.samo_lego.fabrictailor.client.ClientTailor.ALLOW_DEFAULT_SKIN; +import static org.samo_lego.fabrictailor.client.ClientTailor.TAILORED_SERVER; + @Environment(EnvType.CLIENT) public class SkinChangeScreen extends Screen { @@ -146,7 +148,7 @@ protected void init() { onClick -> { var profile = ((AAbstractClientPlayer) this.minecraft.player).ft_getPlayerInfo().getProfile(); - // could return empty collection, Iterator#next in this case produces NoSuchElementException + // could return an empty collection, Iterator#next in this case produces NoSuchElementException Optional optionalProperty = profile.getProperties() .get(TailoredPlayer.PROPERTY_TEXTURES) .stream() diff --git a/src/main/java/org/samo_lego/fabrictailor/client/screen/tabs/UrlSkinTab.java b/src/main/java/org/samo_lego/fabrictailor/client/screen/tabs/UrlSkinTab.java index 135eadf..5db2720 100644 --- a/src/main/java/org/samo_lego/fabrictailor/client/screen/tabs/UrlSkinTab.java +++ b/src/main/java/org/samo_lego/fabrictailor/client/screen/tabs/UrlSkinTab.java @@ -14,7 +14,7 @@ import org.samo_lego.fabrictailor.util.TextTranslations; import javax.imageio.ImageIO; -import java.awt.image.*; +import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URI; import java.net.URL; diff --git a/src/main/java/org/samo_lego/fabrictailor/mixin/MServerPlayerEntity_TailoredPlayer.java b/src/main/java/org/samo_lego/fabrictailor/mixin/MServerPlayerEntity_TailoredPlayer.java index d81c1f6..c04da27 100644 --- a/src/main/java/org/samo_lego/fabrictailor/mixin/MServerPlayerEntity_TailoredPlayer.java +++ b/src/main/java/org/samo_lego/fabrictailor/mixin/MServerPlayerEntity_TailoredPlayer.java @@ -82,7 +82,7 @@ public MServerPlayerEntity_TailoredPlayer(Level level, BlockPos blockPos, float /** * @author Pyrofab - * @see PlayerList#respawn(ServerPlayer, boolean) + * @see PlayerList#respawn(ServerPlayer, boolean, RemovalReason) *

* This method has been adapted from the Impersonate mod's source code * under GNU Lesser General Public License. diff --git a/src/main/java/org/samo_lego/fabrictailor/mixin/client/MSkinCustomizationScreen_SkinButton.java b/src/main/java/org/samo_lego/fabrictailor/mixin/client/MSkinCustomizationScreen_SkinButton.java index 29f8eab..18ed3ee 100644 --- a/src/main/java/org/samo_lego/fabrictailor/mixin/client/MSkinCustomizationScreen_SkinButton.java +++ b/src/main/java/org/samo_lego/fabrictailor/mixin/client/MSkinCustomizationScreen_SkinButton.java @@ -3,16 +3,12 @@ import net.minecraft.client.Options; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.Button; -import net.minecraft.client.gui.components.OptionsList; -import net.minecraft.client.gui.screens.OptionsSubScreen; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.gui.screens.SkinCustomizationScreen; -import net.minecraft.network.chat.CommonComponents; +import net.minecraft.client.gui.screens.options.OptionsSubScreen; +import net.minecraft.client.gui.screens.options.SkinCustomizationScreen; import net.minecraft.network.chat.Component; -import org.jetbrains.annotations.Nullable; import org.samo_lego.fabrictailor.client.ClientTailor; 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; @@ -22,13 +18,13 @@ @Mixin(SkinCustomizationScreen.class) -public class MSkinCustomizationScreen_SkinButton extends OptionsSubScreen { +public abstract class MSkinCustomizationScreen_SkinButton extends OptionsSubScreen { public MSkinCustomizationScreen_SkinButton(Screen screen, Options options, Component component) { super(screen, options, component); } - @Inject(method = "init", + @Inject(method = "addOptions", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/gui/components/OptionsList;addSmall(Ljava/util/List;)V" diff --git a/src/main/java/org/samo_lego/fabrictailor/network/SkinPackets.java b/src/main/java/org/samo_lego/fabrictailor/network/SkinPackets.java index 137ebc2..b1057ed 100644 --- a/src/main/java/org/samo_lego/fabrictailor/network/SkinPackets.java +++ b/src/main/java/org/samo_lego/fabrictailor/network/SkinPackets.java @@ -5,8 +5,8 @@ import static org.samo_lego.fabrictailor.FabricTailor.MOD_ID; public class SkinPackets { - public static final ResourceLocation FABRICTAILOR_VANILLA_CHANGE = new ResourceLocation(MOD_ID, "skin_change_vanilla"); - public static final ResourceLocation FABRICTAILOR_HD_CHANGE = new ResourceLocation(MOD_ID, "skin_change_hd"); - public static final ResourceLocation FABRICTAILOR_DEFAULT_SKIN = new ResourceLocation(MOD_ID, "default_skin_request"); - public static final ResourceLocation FT_HELLO = new ResourceLocation(MOD_ID, "hello"); + public static final ResourceLocation FABRICTAILOR_VANILLA_CHANGE = ResourceLocation.fromNamespaceAndPath(MOD_ID, "skin_change_vanilla"); + public static final ResourceLocation FABRICTAILOR_HD_CHANGE = ResourceLocation.fromNamespaceAndPath(MOD_ID, "skin_change_hd"); + public static final ResourceLocation FABRICTAILOR_DEFAULT_SKIN = ResourceLocation.fromNamespaceAndPath(MOD_ID, "default_skin_request"); + public static final ResourceLocation FT_HELLO = ResourceLocation.fromNamespaceAndPath(MOD_ID, "hello"); } diff --git a/src/main/java/org/samo_lego/fabrictailor/network/payload/DefaultSkinPayload.java b/src/main/java/org/samo_lego/fabrictailor/network/payload/DefaultSkinPayload.java index 4a3674b..1032974 100644 --- a/src/main/java/org/samo_lego/fabrictailor/network/payload/DefaultSkinPayload.java +++ b/src/main/java/org/samo_lego/fabrictailor/network/payload/DefaultSkinPayload.java @@ -11,7 +11,7 @@ public record DefaultSkinPayload(Property skinProperty) implements CustomPacketPayload { - public static final Type TYPE = CustomPacketPayload.createType(FABRICTAILOR_DEFAULT_SKIN.toString()); + public static final Type TYPE = new CustomPacketPayload.Type<>(FABRICTAILOR_DEFAULT_SKIN); public static final StreamCodec CODEC = StreamCodec.composite(PropertyExtension.STREAM_CODEC, DefaultSkinPayload::skinProperty, DefaultSkinPayload::new); @Override diff --git a/src/main/java/org/samo_lego/fabrictailor/network/payload/FabricTailorHelloPayload.java b/src/main/java/org/samo_lego/fabrictailor/network/payload/FabricTailorHelloPayload.java index 2345029..10a35a3 100644 --- a/src/main/java/org/samo_lego/fabrictailor/network/payload/FabricTailorHelloPayload.java +++ b/src/main/java/org/samo_lego/fabrictailor/network/payload/FabricTailorHelloPayload.java @@ -9,7 +9,7 @@ public record FabricTailorHelloPayload(boolean allowSkinButton) implements CustomPacketPayload { - public static final Type TYPE = CustomPacketPayload.createType(FT_HELLO.toString()); + public static final Type TYPE = new CustomPacketPayload.Type<>(FT_HELLO); public static final StreamCodec CODEC = StreamCodec.of( (buf, value) -> buf.writeBoolean(value.allowSkinButton()), buf -> new FabricTailorHelloPayload(buf.readBoolean()) diff --git a/src/main/java/org/samo_lego/fabrictailor/network/payload/HDSkinPayload.java b/src/main/java/org/samo_lego/fabrictailor/network/payload/HDSkinPayload.java index 09c45f5..335a24d 100644 --- a/src/main/java/org/samo_lego/fabrictailor/network/payload/HDSkinPayload.java +++ b/src/main/java/org/samo_lego/fabrictailor/network/payload/HDSkinPayload.java @@ -11,7 +11,7 @@ public record HDSkinPayload(Property skinProperty) implements CustomPacketPayload { - public static final Type TYPE = CustomPacketPayload.createType(FABRICTAILOR_HD_CHANGE.toString()); + public static final Type TYPE = new CustomPacketPayload.Type<>(FABRICTAILOR_HD_CHANGE); public static final StreamCodec CODEC = StreamCodec.composite(PropertyExtension.STREAM_CODEC, HDSkinPayload::skinProperty, HDSkinPayload::new); @Override diff --git a/src/main/java/org/samo_lego/fabrictailor/network/payload/VanillaSkinPayload.java b/src/main/java/org/samo_lego/fabrictailor/network/payload/VanillaSkinPayload.java index fe81060..5db5535 100644 --- a/src/main/java/org/samo_lego/fabrictailor/network/payload/VanillaSkinPayload.java +++ b/src/main/java/org/samo_lego/fabrictailor/network/payload/VanillaSkinPayload.java @@ -11,7 +11,7 @@ public record VanillaSkinPayload(Property skinProperty) implements CustomPacketPayload { - public static final Type TYPE = CustomPacketPayload.createType(FABRICTAILOR_VANILLA_CHANGE.toString()); + public static final Type TYPE = new CustomPacketPayload.Type<>(FABRICTAILOR_VANILLA_CHANGE); public static final StreamCodec CODEC = StreamCodec.composite(PropertyExtension.STREAM_CODEC, VanillaSkinPayload::skinProperty, VanillaSkinPayload::new); @Override