1
0
mirror of https://github.com/Suiranoil/SkinRestorer.git synced 2026-01-16 04:42:12 +00:00

Compare commits

..

14 Commits

7 changed files with 27 additions and 18 deletions

View File

@@ -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))

View File

@@ -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

View File

@@ -6,26 +6,17 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.CommonListenerCookie;
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);
@@ -33,13 +24,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, CommonListenerCookie cookie, CallbackInfo ci) {
var server = ((PlayerList) (Object) this).getServer();
var delay = SkinRestorer.getConfig().skinApplyDelayOnJoin();
if (delay <= 0) {

View File

@@ -0,0 +1,13 @@
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;
@Mixin(ServerLoginPacketListenerImpl.class)
public interface ServerLoginPacketListenerImplAccessorInvoker {
@Accessor
GameProfile getAuthenticatedProfile();
}

View File

@@ -7,9 +7,7 @@ import net.lionarius.skinrestorer.skin.provider.SkinProviderContext;
import net.lionarius.skinrestorer.util.PlayerUtils;
import net.lionarius.skinrestorer.util.Result;
import net.minecraft.server.network.ServerLoginPacketListenerImpl;
import org.jetbrains.annotations.Nullable;
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;
@@ -20,9 +18,6 @@ import java.util.concurrent.CompletableFuture;
@Mixin(ServerLoginPacketListenerImpl.class)
public abstract class ServerLoginPacketListenerImplMixin {
@Shadow @Nullable
private GameProfile authenticatedProfile;
@Unique
private CompletableFuture<Void> skinrestorer$pendingSkin;
@@ -32,7 +27,7 @@ public abstract class ServerLoginPacketListenerImplMixin {
public void waitForSkin(CallbackInfo ci) {
if (skinrestorer$pendingSkin == null) {
skinrestorer$pendingSkin = CompletableFuture.supplyAsync(() -> {
final var profile = authenticatedProfile;
final var profile = ((ServerLoginPacketListenerImplAccessorInvoker) this).getAuthenticatedProfile();
assert profile != null;
var originalSkin = PlayerUtils.getPlayerSkin(profile);

View File

@@ -8,6 +8,7 @@
"mixins": [
"ChunkMapAccessor",
"PlayerListMixin",
"ServerLoginPacketListenerImplAccessorInvoker",
"ServerLoginPacketListenerImplMixin",
"TrackedEntityAccessorInvoker"
],

View File

@@ -8,7 +8,7 @@ minecraft_version_list=1.20.3,1.20.4
minecraft_version_range=[1.20.3,1.20.4]
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