mirror of
https://github.com/Suiranoil/SkinRestorer.git
synced 2026-01-16 04:42:12 +00:00
Compare commits
23 Commits
1.19-multi
...
c695e66a94
| Author | SHA1 | Date | |
|---|---|---|---|
|
c695e66a94
|
|||
|
c07497cddb
|
|||
|
418397d3d2
|
|||
|
7af35cda9f
|
|||
|
3d92617e47
|
|||
|
f357e6c985
|
|||
|
e4c9e1b3cd
|
|||
|
3ef3318ed3
|
|||
|
1a6327f91c
|
|||
|
56655bca36
|
|||
|
90ca995907
|
|||
|
0823ed6669
|
|||
|
3fff2eb920
|
|||
|
50a49b33a2
|
|||
|
8de7f3a16f
|
|||
|
5b384c32d6
|
|||
|
7fb647b3ba
|
|||
|
907566e12b
|
|||
|
8a730c7c61
|
|||
|
0feba3f4b2
|
|||
|
fcd76d9a87
|
|||
|
8119a08c80
|
|||
|
6c159d6aa2
|
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2.3.3] - 2025-06-01
|
||||
### Fixed
|
||||
- Fixed forge mixin crash (closes [#54](https://github.com/Suiranoil/SkinRestorer/issues/53))
|
||||
### Removed
|
||||
- Removed minecraft 1.19 support
|
||||
|
||||
## [2.3.2] - 2025-05-24
|
||||
### Fixed
|
||||
- Fixed mixin incompatibility with ModernFix (closes [#42](https://github.com/Suiranoil/SkinRestorer/issues/52))
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
### Fixed
|
||||
- Fixed mixin incompatibility with ModernFix (closes [#42](https://github.com/Suiranoil/SkinRestorer/issues/52))
|
||||
- Fixed forge mixin crash (closes [#54](https://github.com/Suiranoil/SkinRestorer/issues/53))
|
||||
### Removed
|
||||
- Removed minecraft 1.19 support
|
||||
|
||||
@@ -128,7 +128,7 @@ public final class SkinCommand {
|
||||
boolean save,
|
||||
boolean setByOperator
|
||||
) {
|
||||
src.sendSuccess(Translation.translatableWithFallback(Translation.COMMAND_SKIN_LOADING_KEY), false);
|
||||
src.sendSystemMessage(Translation.translatableWithFallback(Translation.COMMAND_SKIN_LOADING_KEY));
|
||||
|
||||
SkinRestorer.setSkinAsync(src.getServer(), targets, context, save).thenAccept(result -> {
|
||||
if (result.isError()) {
|
||||
|
||||
@@ -5,26 +5,17 @@ import net.minecraft.network.Connection;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.players.PlayerList;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(PlayerList.class)
|
||||
public abstract class PlayerListMixin {
|
||||
|
||||
@Shadow
|
||||
public abstract List<ServerPlayer> getPlayers();
|
||||
|
||||
@Shadow @Final
|
||||
private MinecraftServer server;
|
||||
|
||||
@Inject(method = "remove", at = @At("TAIL"))
|
||||
private void remove(ServerPlayer player, CallbackInfo ci) {
|
||||
SkinRestorer.Events.onPlayerDisconnect(player);
|
||||
@@ -32,13 +23,14 @@ public abstract class PlayerListMixin {
|
||||
|
||||
@Inject(method = "removeAll", at = @At("HEAD"))
|
||||
private void removeAll(CallbackInfo ci) {
|
||||
for (var player : getPlayers()) {
|
||||
for (var player : ((PlayerList) (Object) this).getPlayers()) {
|
||||
SkinRestorer.Events.onPlayerDisconnect(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "placeNewPlayer", at = @At("HEAD"))
|
||||
private void placeNewPlayer(Connection connection, ServerPlayer player, CallbackInfo ci) {
|
||||
var server = ((PlayerList) (Object) this).getServer();
|
||||
var delay = SkinRestorer.getConfig().skinApplyDelayOnJoin();
|
||||
|
||||
if (delay <= 0) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.lionarius.skinrestorer.mixin;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.server.network.ServerLoginPacketListenerImpl;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(ServerLoginPacketListenerImpl.class)
|
||||
public interface ServerLoginPacketListenerImplAccessorInvoker {
|
||||
|
||||
@Accessor
|
||||
GameProfile getGameProfile();
|
||||
|
||||
@Invoker
|
||||
GameProfile invokeCreateFakeProfile(GameProfile original);
|
||||
}
|
||||
@@ -20,24 +20,18 @@ import java.util.concurrent.CompletableFuture;
|
||||
@Mixin(ServerLoginPacketListenerImpl.class)
|
||||
public abstract class ServerLoginPacketListenerImplMixin {
|
||||
|
||||
@Shadow @Nullable
|
||||
private GameProfile gameProfile;
|
||||
|
||||
@Unique
|
||||
private CompletableFuture<Void> skinrestorer$pendingSkin;
|
||||
|
||||
@Shadow
|
||||
protected abstract GameProfile createFakeProfile(GameProfile original);
|
||||
|
||||
@Inject(method = "handleAcceptedLogin", at = @At(value = "HEAD"), cancellable = true)
|
||||
public void waitForSkin(CallbackInfo ci) {
|
||||
if (skinrestorer$pendingSkin == null) {
|
||||
skinrestorer$pendingSkin = CompletableFuture.supplyAsync(() -> {
|
||||
var profile = gameProfile;
|
||||
var profile = ((ServerLoginPacketListenerImplAccessorInvoker) this).getGameProfile();
|
||||
assert profile != null;
|
||||
|
||||
if (!profile.isComplete())
|
||||
profile = createFakeProfile(profile);
|
||||
profile = ((ServerLoginPacketListenerImplAccessorInvoker) this).invokeCreateFakeProfile(profile);
|
||||
|
||||
var originalSkin = PlayerUtils.getPlayerSkin(profile);
|
||||
|
||||
|
||||
@@ -9,25 +9,11 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public final class SkinValue implements GsonPostProcessable {
|
||||
public record SkinValue(@NotNull String provider, @Nullable String argument, @Nullable SkinVariant variant,
|
||||
@Nullable Property value, @Nullable Property originalValue) implements GsonPostProcessable {
|
||||
|
||||
public static final SkinValue EMPTY = new SkinValue(EmptySkinProvider.PROVIDER_NAME, null, null, null);
|
||||
|
||||
private @NotNull String provider;
|
||||
private @Nullable String argument;
|
||||
private @Nullable SkinVariant variant;
|
||||
private @Nullable Property value;
|
||||
private @Nullable Property originalValue;
|
||||
|
||||
public SkinValue(@NotNull String provider, @Nullable String argument, @Nullable SkinVariant variant,
|
||||
@Nullable Property value, @Nullable Property originalValue) {
|
||||
this.provider = provider;
|
||||
this.argument = argument;
|
||||
this.variant = variant;
|
||||
this.value = value;
|
||||
this.originalValue = originalValue;
|
||||
}
|
||||
|
||||
public SkinValue(String provider, String argument, SkinVariant variant, Property value) {
|
||||
this(provider, argument, variant, value, null);
|
||||
}
|
||||
@@ -52,23 +38,4 @@ public final class SkinValue implements GsonPostProcessable {
|
||||
public void gsonPostProcess() {
|
||||
Objects.requireNonNull(this.provider);
|
||||
}
|
||||
|
||||
public @NotNull String provider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public @Nullable String argument() {
|
||||
return argument;
|
||||
}
|
||||
|
||||
public @Nullable SkinVariant variant() {
|
||||
return variant;}
|
||||
|
||||
public @Nullable Property value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public @Nullable Property originalValue() {
|
||||
return originalValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@ public final class Translation {
|
||||
}
|
||||
|
||||
public static MutableComponent translatableWithFallback(String key) {
|
||||
return Component.translatable(Translation.get(key));
|
||||
return Component.translatableWithFallback(key, Translation.get(key));
|
||||
}
|
||||
|
||||
public static MutableComponent translatableWithFallback(String key, Object... args) {
|
||||
return Component.translatable(Translation.get(key), args);
|
||||
return Component.translatableWithFallback(key, Translation.get(key), args);
|
||||
}
|
||||
|
||||
public static void reloadTranslations() {
|
||||
|
||||
@@ -44,8 +44,12 @@ public final class PlayerUtils {
|
||||
PlayerList playerList = serverLevel.getServer().getPlayerList();
|
||||
ChunkMap chunkMap = serverLevel.getChunkSource().chunkMap;
|
||||
|
||||
playerList.broadcastAll(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, player));
|
||||
playerList.broadcastAll(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, player));
|
||||
playerList.broadcastAll(new ClientboundBundlePacket(
|
||||
List.of(
|
||||
new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID())),
|
||||
ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(Collections.singleton(player))
|
||||
)
|
||||
));
|
||||
|
||||
var trackedEntity = (TrackedEntityAccessorInvoker) ((ChunkMapAccessor) chunkMap).getEntityMap().get(player.getId());
|
||||
if (trackedEntity != null) {
|
||||
@@ -73,7 +77,7 @@ public final class PlayerUtils {
|
||||
player.gameMode.getPreviousGameModeForPlayer(),
|
||||
player.getLevel().isDebug(),
|
||||
player.getLevel().isFlat(),
|
||||
true,
|
||||
(byte) 3,
|
||||
player.getLastDeathLocation()
|
||||
)
|
||||
);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"mixins": [
|
||||
"ChunkMapAccessor",
|
||||
"PlayerListMixin",
|
||||
"ServerLoginPacketListenerImplAccessorInvoker",
|
||||
"ServerLoginPacketListenerImplMixin",
|
||||
"TrackedEntityAccessorInvoker"
|
||||
],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Forge, see https://files.minecraftforge.net/net/minecraftforge/forge/ for new versions
|
||||
forge_version=41.0.1
|
||||
forge_loader_version_range=[41,)
|
||||
forge_version=45.0.0
|
||||
forge_loader_version_range=[45,)
|
||||
# Forge sometimes skips minor minecraft versions (like 1.20.5)
|
||||
forge_minecraft_version=1.19
|
||||
forge_minecraft_version=1.19.4
|
||||
|
||||
@@ -3,12 +3,12 @@ group=net.lionarius
|
||||
java_version=17
|
||||
|
||||
# Common
|
||||
minecraft_version=1.19
|
||||
minecraft_version_list=1.19
|
||||
minecraft_version_range=[1.19,1.19.1)
|
||||
minecraft_version=1.19.4
|
||||
minecraft_version_list=1.19.4
|
||||
minecraft_version_range=[1.19.4,1.20)
|
||||
mod_id=skinrestorer
|
||||
mod_name=SkinRestorer
|
||||
mod_version=2.3.2
|
||||
mod_version=2.3.3
|
||||
mod_author=Lionarius
|
||||
mod_homepage=https://modrinth.com/mod/skinrestorer
|
||||
mod_sources=https://github.com/Suiranoil/SkinRestorer
|
||||
@@ -21,8 +21,8 @@ description=A server-side mod for managing skins.
|
||||
mineskin_client_version=3.0.1-SNAPSHOT
|
||||
|
||||
# ParchmentMC mappings, see https://parchmentmc.org/docs/getting-started#choose-a-version for new versions
|
||||
parchment_minecraft=1.19.2
|
||||
parchment_version=2022.11.27
|
||||
parchment_minecraft=1.19.4
|
||||
parchment_version=2023.06.26
|
||||
|
||||
# Publishing
|
||||
curseforge_id=443823
|
||||
|
||||
Reference in New Issue
Block a user