mirror of
https://github.com/Suiranoil/SkinRestorer.git
synced 2026-01-16 04:42:12 +00:00
Compare commits
47 Commits
1.19-multi
...
c987d48738
| Author | SHA1 | Date | |
|---|---|---|---|
|
c987d48738
|
|||
|
583205febc
|
|||
|
fb7a4d11e9
|
|||
|
1d8472e35c
|
|||
|
f604ac2c8b
|
|||
|
8d4c2e9f83
|
|||
|
84a06898a2
|
|||
|
11ecf88eb2
|
|||
|
2cec50afae
|
|||
|
01a045541c
|
|||
|
5bab96e269
|
|||
|
a0b557be51
|
|||
|
7fad7de710
|
|||
|
a3bd44af89
|
|||
|
8af1dd8f12
|
|||
|
1c7f97551d
|
|||
|
a8cc81e570
|
|||
|
6ce3484824
|
|||
|
b518305028
|
|||
|
4a87bd43ca
|
|||
|
96ea077004
|
|||
|
91eead3d1f
|
|||
|
2ea4d3f3e7
|
|||
|
e65501e620
|
|||
|
556ecdc039
|
|||
|
1b8a6c2f5d
|
|||
|
4cc12e23dc
|
|||
|
28db1ee84c
|
|||
|
21f00231af
|
|||
|
6f5b291008
|
|||
|
df58fe8c89
|
|||
|
2325b3b35c
|
|||
|
ad6d64e8d4
|
|||
|
07b4887f60
|
|||
|
30d21c9424
|
|||
|
1c51796409
|
|||
|
1b6afd5d6e
|
|||
|
7e05f1eec9
|
|||
|
81d05fe991
|
|||
|
757d46b231
|
|||
|
3b15f7b341
|
|||
|
38a2fd7214
|
|||
|
e4c9e1b3cd
|
|||
|
3ef3318ed3
|
|||
|
5b384c32d6
|
|||
|
8119a08c80
|
|||
|
6c159d6aa2
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,3 +30,4 @@ bin/
|
|||||||
|
|
||||||
.architectury-transformer/
|
.architectury-transformer/
|
||||||
run/
|
run/
|
||||||
|
scripts/
|
||||||
|
|||||||
33
CHANGELOG.md
33
CHANGELOG.md
@@ -4,6 +4,39 @@ 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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [2.4.3] - 2025-07-25
|
||||||
|
### Fixed
|
||||||
|
- Fixed crash on client when loading player head skin (fixes [#63](https://github.com/Suiranoil/SkinRestorer/issues/63) and [#64](https://github.com/Suiranoil/SkinRestorer/issues/64))
|
||||||
|
- Fixed server freeze when loading player head skin
|
||||||
|
|
||||||
|
## [2.4.2] - 2025-07-13
|
||||||
|
### Fixed
|
||||||
|
- Fix crash when head profile name is null (fixes [#60](https://github.com/Suiranoil/SkinRestorer/issues/60) and [#61](https://github.com/Suiranoil/SkinRestorer/issues/61))
|
||||||
|
|
||||||
|
## [2.4.1] - 2025-07-09
|
||||||
|
### Changed
|
||||||
|
- Log full exception and argument when unable to fetch/set skin
|
||||||
|
### Fixed
|
||||||
|
- Fixed mojang provider using offline uuids when unable to fetch actual uuid resulting in `no profile with uuid` error
|
||||||
|
|
||||||
|
## [2.4.0] - 2025-07-05
|
||||||
|
### Fixed
|
||||||
|
- Added support for player heads
|
||||||
|
|
||||||
|
## [2.3.5] - 2025-06-21
|
||||||
|
### Fixed
|
||||||
|
- Fix mod not loading on client
|
||||||
|
|
||||||
|
## [2.3.4] - 2025-06-19
|
||||||
|
### Added
|
||||||
|
- Added support for minecraft 1.21.6
|
||||||
|
|
||||||
|
## [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
|
## [2.3.2] - 2025-05-24
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed mixin incompatibility with ModernFix (closes [#42](https://github.com/Suiranoil/SkinRestorer/issues/52))
|
- Fixed mixin incompatibility with ModernFix (closes [#42](https://github.com/Suiranoil/SkinRestorer/issues/52))
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
### Fixed
|
### Fixed
|
||||||
- Fixed mixin incompatibility with ModernFix (closes [#42](https://github.com/Suiranoil/SkinRestorer/issues/52))
|
- Fixed crash on client when loading player head skin (fixes [#63](https://github.com/Suiranoil/SkinRestorer/issues/63) and [#64](https://github.com/Suiranoil/SkinRestorer/issues/64))
|
||||||
|
- Fixed server freeze when loading player head skin
|
||||||
|
|||||||
@@ -3,14 +3,17 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
publishMods {
|
publishMods {
|
||||||
if (project.name == 'fabric')
|
file = project.layout.buildDirectory.file("libs/${project.archivesBaseName}-${project.version}.jar").map { it.asFile }.getOrNull()
|
||||||
file = remapJar.archiveFile
|
|
||||||
else if (project.name == 'neoforge')
|
|
||||||
file = jar.archiveFile
|
|
||||||
else
|
|
||||||
file = tasks.named('jarJar').get().archiveFile
|
|
||||||
|
|
||||||
modLoaders.add(project.name)
|
modLoaders.add(project.name)
|
||||||
|
|
||||||
|
if (project.hasProperty('additional_modloaders') && !additional_modloaders.isEmpty())
|
||||||
|
{
|
||||||
|
def loaders = additional_modloaders.split(',')
|
||||||
|
for (loader in loaders)
|
||||||
|
modLoaders.add(loader)
|
||||||
|
}
|
||||||
|
|
||||||
type = STABLE
|
type = STABLE
|
||||||
version = project.version
|
version = project.version
|
||||||
displayName = "[${project.name.capitalize()}] ${mod_name} ${mod_version}"
|
displayName = "[${project.name.capitalize()}] ${mod_name} ${mod_version}"
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package net.lionarius.skinrestorer;
|
package net.lionarius.skinrestorer;
|
||||||
|
|
||||||
|
import com.google.common.base.Throwables;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import net.lionarius.skinrestorer.command.SkinCommand;
|
import net.lionarius.skinrestorer.command.SkinCommand;
|
||||||
import net.lionarius.skinrestorer.config.Config;
|
import net.lionarius.skinrestorer.config.Config;
|
||||||
import net.lionarius.skinrestorer.config.provider.BuiltInProviderConfig;
|
import net.lionarius.skinrestorer.config.provider.BuiltInProviderConfig;
|
||||||
|
import net.lionarius.skinrestorer.exception.TransparentException;
|
||||||
import net.lionarius.skinrestorer.platform.Services;
|
import net.lionarius.skinrestorer.platform.Services;
|
||||||
import net.lionarius.skinrestorer.skin.SkinIO;
|
import net.lionarius.skinrestorer.skin.SkinIO;
|
||||||
import net.lionarius.skinrestorer.skin.SkinStorage;
|
import net.lionarius.skinrestorer.skin.SkinStorage;
|
||||||
@@ -17,6 +19,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.level.storage.LevelResource;
|
import net.minecraft.world.level.storage.LevelResource;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -35,6 +38,7 @@ public final class SkinRestorer {
|
|||||||
private static Path configDir;
|
private static Path configDir;
|
||||||
private static Config config;
|
private static Config config;
|
||||||
private static TickedScheduler tickedScheduler;
|
private static TickedScheduler tickedScheduler;
|
||||||
|
private static MinecraftServer minecraftServer;
|
||||||
|
|
||||||
private SkinRestorer() {}
|
private SkinRestorer() {}
|
||||||
|
|
||||||
@@ -58,6 +62,10 @@ public final class SkinRestorer {
|
|||||||
return SkinRestorer.tickedScheduler;
|
return SkinRestorer.tickedScheduler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static @Nullable MinecraftServer getMinecraftServer() {
|
||||||
|
return SkinRestorer.minecraftServer;
|
||||||
|
}
|
||||||
|
|
||||||
public static Optional<SkinProvider> getProvider(String name) {
|
public static Optional<SkinProvider> getProvider(String name) {
|
||||||
return Optional.ofNullable(SkinRestorer.providersRegistry.get(name));
|
return Optional.ofNullable(SkinRestorer.providersRegistry.get(name));
|
||||||
}
|
}
|
||||||
@@ -147,7 +155,7 @@ public final class SkinRestorer {
|
|||||||
|
|
||||||
var skinResult = result.get();
|
var skinResult = result.get();
|
||||||
if (skinResult.isError())
|
if (skinResult.isError())
|
||||||
return Result.<Collection<ServerPlayer>, String>error(skinResult.getErrorValue().getMessage());
|
throw new TransparentException(Throwables.getRootCause(skinResult.getErrorValue()));
|
||||||
|
|
||||||
var skinValue = SkinValue.fromProviderContextWithValue(context, skinResult.getSuccessValue().orElse(null));
|
var skinValue = SkinValue.fromProviderContextWithValue(context, skinResult.getSuccessValue().orElse(null));
|
||||||
|
|
||||||
@@ -156,7 +164,7 @@ public final class SkinRestorer {
|
|||||||
return Result.<Collection<ServerPlayer>, String>success(acceptedPlayers);
|
return Result.<Collection<ServerPlayer>, String>success(acceptedPlayers);
|
||||||
}, server)
|
}, server)
|
||||||
.exceptionally(e -> {
|
.exceptionally(e -> {
|
||||||
SkinRestorer.LOGGER.error(e.toString());
|
SkinRestorer.LOGGER.error("Failed to set skin '{}:{}'", context.name(), context.argument(), e);
|
||||||
return Result.error(e.getMessage());
|
return Result.error(e.getMessage());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -171,6 +179,14 @@ public final class SkinRestorer {
|
|||||||
SkinRestorer.skinStorage = new SkinStorage(new SkinIO(worldSkinDirectory));
|
SkinRestorer.skinStorage = new SkinStorage(new SkinIO(worldSkinDirectory));
|
||||||
SkinRestorer.tickedScheduler = new TickedScheduler(server);
|
SkinRestorer.tickedScheduler = new TickedScheduler(server);
|
||||||
server.addTickable(SkinRestorer.tickedScheduler);
|
server.addTickable(SkinRestorer.tickedScheduler);
|
||||||
|
|
||||||
|
SkinRestorer.minecraftServer = server;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onServerStopped(MinecraftServer server) {
|
||||||
|
SkinRestorer.skinStorage = null;
|
||||||
|
SkinRestorer.tickedScheduler = null;
|
||||||
|
SkinRestorer.minecraftServer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onCommandRegister(CommandDispatcher<CommandSourceStack> dispatcher) {
|
public static void onCommandRegister(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public record SkinShuffleSkinRefreshV1Payload(
|
|||||||
buf.writeUtf(textureProperty.value());
|
buf.writeUtf(textureProperty.value());
|
||||||
buf.writeNullable(textureProperty.signature(), FriendlyByteBuf::writeUtf);
|
buf.writeNullable(textureProperty.signature(), FriendlyByteBuf::writeUtf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SkinShuffleSkinRefreshV1Payload decode(FriendlyByteBuf buf) {
|
public static SkinShuffleSkinRefreshV1Payload decode(FriendlyByteBuf buf) {
|
||||||
return new SkinShuffleSkinRefreshV1Payload(new Property(buf.readUtf(), buf.readUtf(), buf.readNullable(FriendlyByteBuf::readUtf)));
|
return new SkinShuffleSkinRefreshV1Payload(new Property(buf.readUtf(), buf.readUtf(), buf.readNullable(FriendlyByteBuf::readUtf)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public record SkinShuffleSkinRefreshV2Payload(
|
|||||||
SkinShuffleSkinRefreshV2Payload::encode,
|
SkinShuffleSkinRefreshV2Payload::encode,
|
||||||
SkinShuffleSkinRefreshV2Payload::decode
|
SkinShuffleSkinRefreshV2Payload::decode
|
||||||
);
|
);
|
||||||
|
|
||||||
public static void encode(FriendlyByteBuf buf, SkinShuffleSkinRefreshV2Payload value) {
|
public static void encode(FriendlyByteBuf buf, SkinShuffleSkinRefreshV2Payload value) {
|
||||||
var textureProperty = value.textureProperty();
|
var textureProperty = value.textureProperty();
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ public record SkinShuffleSkinRefreshV2Payload(
|
|||||||
buf.writeUtf(textureProperty.signature());
|
buf.writeUtf(textureProperty.signature());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SkinShuffleSkinRefreshV2Payload decode(FriendlyByteBuf buf) {
|
public static SkinShuffleSkinRefreshV2Payload decode(FriendlyByteBuf buf) {
|
||||||
if (buf.readBoolean()) {
|
if (buf.readBoolean()) {
|
||||||
return new SkinShuffleSkinRefreshV2Payload(new Property(buf.readUtf(), buf.readUtf(), buf.readUtf()));
|
return new SkinShuffleSkinRefreshV2Payload(new Property(buf.readUtf(), buf.readUtf(), buf.readUtf()));
|
||||||
|
|||||||
@@ -5,20 +5,20 @@ import net.lionarius.skinrestorer.SkinRestorer;
|
|||||||
public final class CacheConfig {
|
public final class CacheConfig {
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
private long duration;
|
private long duration;
|
||||||
|
|
||||||
public CacheConfig(boolean enabled, long duration) {
|
public CacheConfig(boolean enabled, long duration) {
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean enabled() {
|
public boolean enabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long duration() {
|
public long duration() {
|
||||||
return duration;
|
return duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
void validate(CacheConfig defaultValue) {
|
void validate(CacheConfig defaultValue) {
|
||||||
if (this.duration <= 0) {
|
if (this.duration <= 0) {
|
||||||
SkinRestorer.LOGGER.warn("Cache duration is less than or equal to zero, defaulting to {}", defaultValue.duration());
|
SkinRestorer.LOGGER.warn("Cache duration is less than or equal to zero, defaulting to {}", defaultValue.duration());
|
||||||
|
|||||||
@@ -9,41 +9,41 @@ public final class ProvidersConfig implements GsonPostProcessable {
|
|||||||
new ElyByProviderConfig(),
|
new ElyByProviderConfig(),
|
||||||
new MineskinProviderConfig()
|
new MineskinProviderConfig()
|
||||||
);
|
);
|
||||||
|
|
||||||
private MojangProviderConfig mojang;
|
private MojangProviderConfig mojang;
|
||||||
private ElyByProviderConfig ely_by;
|
private ElyByProviderConfig ely_by;
|
||||||
private MineskinProviderConfig mineskin;
|
private MineskinProviderConfig mineskin;
|
||||||
|
|
||||||
public ProvidersConfig(MojangProviderConfig mojang, ElyByProviderConfig ely_by, MineskinProviderConfig mineskin) {
|
public ProvidersConfig(MojangProviderConfig mojang, ElyByProviderConfig ely_by, MineskinProviderConfig mineskin) {
|
||||||
this.mojang = mojang;
|
this.mojang = mojang;
|
||||||
this.ely_by = ely_by;
|
this.ely_by = ely_by;
|
||||||
this.mineskin = mineskin;
|
this.mineskin = mineskin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MojangProviderConfig mojang() {
|
public MojangProviderConfig mojang() {
|
||||||
return this.mojang;
|
return this.mojang;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElyByProviderConfig ely_by() {
|
public ElyByProviderConfig ely_by() {
|
||||||
return this.ely_by;
|
return this.ely_by;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MineskinProviderConfig mineskin() {
|
public MineskinProviderConfig mineskin() {
|
||||||
return this.mineskin;
|
return this.mineskin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void gsonPostProcess() {
|
public void gsonPostProcess() {
|
||||||
if (this.mojang == null) {
|
if (this.mojang == null) {
|
||||||
SkinRestorer.LOGGER.warn("Mojang provider config is null, using default");
|
SkinRestorer.LOGGER.warn("Mojang provider config is null, using default");
|
||||||
this.mojang = ProvidersConfig.DEFAULT.mojang();
|
this.mojang = ProvidersConfig.DEFAULT.mojang();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.ely_by == null) {
|
if (this.ely_by == null) {
|
||||||
SkinRestorer.LOGGER.warn("Ely.By provider config is null, using default");
|
SkinRestorer.LOGGER.warn("Ely.By provider config is null, using default");
|
||||||
this.ely_by = ProvidersConfig.DEFAULT.ely_by();
|
this.ely_by = ProvidersConfig.DEFAULT.ely_by();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mineskin == null) {
|
if (this.mineskin == null) {
|
||||||
SkinRestorer.LOGGER.warn("Mineskin provider config is null, using default");
|
SkinRestorer.LOGGER.warn("Mineskin provider config is null, using default");
|
||||||
this.mineskin = ProvidersConfig.DEFAULT.mineskin();
|
this.mineskin = ProvidersConfig.DEFAULT.mineskin();
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package net.lionarius.skinrestorer.exception;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class TransparentException extends RuntimeException {
|
||||||
|
public TransparentException(@NotNull Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return this.getCause().getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.getLocalizedMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,8 +32,8 @@ public class Java11RequestHandler extends RequestHandler {
|
|||||||
private final Gson gson;
|
private final Gson gson;
|
||||||
private final HttpClient httpClient;
|
private final HttpClient httpClient;
|
||||||
|
|
||||||
public Java11RequestHandler(String userAgent, String apiKey, int timeout, Gson gson, InetSocketAddress proxy) {
|
public Java11RequestHandler(String baseUrl, String userAgent, String apiKey, int timeout, Gson gson, InetSocketAddress proxy) {
|
||||||
super(userAgent, apiKey, timeout, gson);
|
super(baseUrl, userAgent, apiKey, timeout, gson);
|
||||||
this.gson = gson;
|
this.gson = gson;
|
||||||
|
|
||||||
HttpClient.Builder clientBuilder = HttpClient.newBuilder()
|
HttpClient.Builder clientBuilder = HttpClient.newBuilder()
|
||||||
@@ -85,6 +85,7 @@ public class Java11RequestHandler extends RequestHandler {
|
|||||||
|
|
||||||
public <T, R extends MineSkinResponse<T>> R getJson(String url, Class<T> clazz, ResponseConstructor<T, R> constructor)
|
public <T, R extends MineSkinResponse<T>> R getJson(String url, Class<T> clazz, ResponseConstructor<T, R> constructor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
url = this.baseUrl + url;
|
||||||
MineSkinClientImpl.LOGGER.fine("GET " + url);
|
MineSkinClientImpl.LOGGER.fine("GET " + url);
|
||||||
|
|
||||||
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
|
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
|
||||||
@@ -110,6 +111,7 @@ public class Java11RequestHandler extends RequestHandler {
|
|||||||
|
|
||||||
public <T, R extends MineSkinResponse<T>> R postJson(String url, JsonObject data, Class<T> clazz, ResponseConstructor<T, R> constructor)
|
public <T, R extends MineSkinResponse<T>> R postJson(String url, JsonObject data, Class<T> clazz, ResponseConstructor<T, R> constructor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
url = this.baseUrl + url;
|
||||||
MineSkinClientImpl.LOGGER.fine("POST " + url);
|
MineSkinClientImpl.LOGGER.fine("POST " + url);
|
||||||
|
|
||||||
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
|
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
|
||||||
@@ -137,6 +139,7 @@ public class Java11RequestHandler extends RequestHandler {
|
|||||||
|
|
||||||
public <T, R extends MineSkinResponse<T>> R postFormDataFile(String url, String key, String filename, InputStream in, Map<String, String> data, Class<T> clazz, ResponseConstructor<T, R> constructor)
|
public <T, R extends MineSkinResponse<T>> R postFormDataFile(String url, String key, String filename, InputStream in, Map<String, String> data, Class<T> clazz, ResponseConstructor<T, R> constructor)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
url = this.baseUrl + url;
|
||||||
MineSkinClientImpl.LOGGER.fine("POST " + url);
|
MineSkinClientImpl.LOGGER.fine("POST " + url);
|
||||||
|
|
||||||
String boundary = "mineskin-" + System.currentTimeMillis();
|
String boundary = "mineskin-" + System.currentTimeMillis();
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||||||
public interface ChunkMapAccessor {
|
public interface ChunkMapAccessor {
|
||||||
|
|
||||||
@Accessor
|
@Accessor
|
||||||
Int2ObjectMap<Object> getEntityMap();
|
Int2ObjectMap<TrackedEntityAccessorInvoker> getEntityMap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package net.lionarius.skinrestorer.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.server.players.GameProfileCache;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Mixin(GameProfileCache.class)
|
||||||
|
public interface GameProfileCacheAccessor {
|
||||||
|
|
||||||
|
@Accessor
|
||||||
|
Map<String, GameProfileCache.GameProfileInfo> getProfilesByName();
|
||||||
|
}
|
||||||
@@ -82,7 +82,7 @@ public abstract class ServerLoginPacketListenerImplMixin {
|
|||||||
var value = SkinValue.fromProviderContextWithValue(context, result.getSuccessValue().orElse(null));
|
var value = SkinValue.fromProviderContextWithValue(context, result.getSuccessValue().orElse(null));
|
||||||
SkinRestorer.getSkinStorage().setSkin(profile.getId(), value);
|
SkinRestorer.getSkinStorage().setSkin(profile.getId(), value);
|
||||||
} else {
|
} else {
|
||||||
SkinRestorer.LOGGER.warn("Failed to fetch skin: {}", result.getErrorValue().getMessage());
|
SkinRestorer.LOGGER.warn("Failed to fetch skin '{}:{}'", context.name(), context.argument(), result.getErrorValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package net.lionarius.skinrestorer.mixin;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import net.lionarius.skinrestorer.SkinRestorer;
|
||||||
|
import net.lionarius.skinrestorer.util.PlayerUtils;
|
||||||
|
import net.minecraft.Util;
|
||||||
|
import net.minecraft.server.Services;
|
||||||
|
import net.minecraft.world.level.block.entity.SkullBlockEntity;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
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.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.function.BooleanSupplier;
|
||||||
|
|
||||||
|
@Mixin(SkullBlockEntity.class)
|
||||||
|
public abstract class SkullBlockEntityMixin {
|
||||||
|
|
||||||
|
@Inject(method = "fetchProfileByName", at = @At("HEAD"),
|
||||||
|
cancellable = true)
|
||||||
|
private static void fetchProfileByName(String name, Services services, CallbackInfoReturnable<CompletableFuture<Optional<GameProfile>>> cir) {
|
||||||
|
if (name == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var profileOpt = Optional.<GameProfile>empty();
|
||||||
|
var gameProfileInfo = ((GameProfileCacheAccessor) services.profileCache()).getProfilesByName().get(name.toLowerCase(Locale.ROOT));
|
||||||
|
|
||||||
|
if (gameProfileInfo != null)
|
||||||
|
profileOpt = Optional.of(gameProfileInfo.getProfile());
|
||||||
|
|
||||||
|
skinrestorer$replaceSkin(profileOpt, cir);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "fetchProfileById", at = @At("HEAD"),
|
||||||
|
cancellable = true)
|
||||||
|
private static void fetchProfileById(UUID id, Services services, BooleanSupplier cacheUninitialized, CallbackInfoReturnable<CompletableFuture<Optional<GameProfile>>> cir) {
|
||||||
|
if (id == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var profileOpt = services.profileCache().get(id);
|
||||||
|
|
||||||
|
skinrestorer$replaceSkin(profileOpt, cir);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private static void skinrestorer$replaceSkin(Optional<GameProfile> profileOpt, CallbackInfoReturnable<CompletableFuture<Optional<GameProfile>>> cir) {
|
||||||
|
if (SkinRestorer.getMinecraftServer() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (profileOpt.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
var profile = PlayerUtils.cloneGameProfile(profileOpt.get());
|
||||||
|
|
||||||
|
if (SkinRestorer.getSkinStorage().hasSavedSkin(profile.getId())) {
|
||||||
|
cir.setReturnValue(CompletableFuture.supplyAsync(() -> {
|
||||||
|
var skin = SkinRestorer.getSkinStorage().getSkin(profile.getId(), false);
|
||||||
|
PlayerUtils.applyRestoredSkin(profile, skin.value());
|
||||||
|
|
||||||
|
return Optional.of(profile);
|
||||||
|
}, Util.backgroundExecutor().forName("getProfile")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,11 +8,11 @@ import java.util.ServiceLoader;
|
|||||||
|
|
||||||
public final class Services {
|
public final class Services {
|
||||||
|
|
||||||
private Services() {}
|
|
||||||
|
|
||||||
public final static PlatformHelper PLATFORM = load(PlatformHelper.class);
|
public final static PlatformHelper PLATFORM = load(PlatformHelper.class);
|
||||||
public final static CompatibilityHelper COMPATIBILITY = load(CompatibilityHelper.class);
|
public final static CompatibilityHelper COMPATIBILITY = load(CompatibilityHelper.class);
|
||||||
|
|
||||||
|
private Services() {}
|
||||||
|
|
||||||
private static <T> T load(Class<T> clazz) {
|
private static <T> T load(Class<T> clazz) {
|
||||||
final T loadedService = ServiceLoader.load(clazz)
|
final T loadedService = ServiceLoader.load(clazz)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
|||||||
@@ -17,15 +17,22 @@ public class SkinStorage {
|
|||||||
return this.skinMap.containsKey(uuid) || this.skinIO.skinExists(uuid);
|
return this.skinMap.containsKey(uuid) || this.skinIO.skinExists(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkinValue getSkin(UUID uuid) {
|
public SkinValue getSkin(UUID uuid, boolean cache) {
|
||||||
if (!skinMap.containsKey(uuid)) {
|
if (!skinMap.containsKey(uuid)) {
|
||||||
var skin = skinIO.loadSkin(uuid);
|
var skin = skinIO.loadSkin(uuid);
|
||||||
|
if (!cache)
|
||||||
|
return skin;
|
||||||
|
|
||||||
setSkin(uuid, skin);
|
setSkin(uuid, skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
return skinMap.get(uuid);
|
return skinMap.get(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SkinValue getSkin(UUID uuid) {
|
||||||
|
return this.getSkin(uuid, true);
|
||||||
|
}
|
||||||
|
|
||||||
public void removeSkin(UUID uuid, boolean save) {
|
public void removeSkin(UUID uuid, boolean save) {
|
||||||
var skin = skinMap.remove(uuid);
|
var skin = skinMap.remove(uuid);
|
||||||
if (skin != null && save)
|
if (skin != null && save)
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ public final class MineskinSkinProvider implements SkinProvider {
|
|||||||
.userAgent(WebUtils.USER_AGENT)
|
.userAgent(WebUtils.USER_AGENT)
|
||||||
.gson(JsonUtils.GSON)
|
.gson(JsonUtils.GSON)
|
||||||
.timeout((int) Duration.ofSeconds(config.requestTimeout()).toMillis())
|
.timeout((int) Duration.ofSeconds(config.requestTimeout()).toMillis())
|
||||||
.requestHandler((userAgent, apiKey, timeout, gson) -> new Java11RequestHandler(
|
.requestHandler((baseUrl, userAgent, apiKey, timeout, gson) -> new Java11RequestHandler(
|
||||||
|
baseUrl,
|
||||||
userAgent,
|
userAgent,
|
||||||
apiKey,
|
apiKey,
|
||||||
timeout,
|
timeout,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.mojang.authlib.yggdrasil.YggdrasilEnvironment;
|
|||||||
import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
|
import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
|
||||||
import com.mojang.util.UndashedUuid;
|
import com.mojang.util.UndashedUuid;
|
||||||
import net.lionarius.skinrestorer.SkinRestorer;
|
import net.lionarius.skinrestorer.SkinRestorer;
|
||||||
|
import net.lionarius.skinrestorer.exception.TransparentException;
|
||||||
import net.lionarius.skinrestorer.skin.SkinVariant;
|
import net.lionarius.skinrestorer.skin.SkinVariant;
|
||||||
import net.lionarius.skinrestorer.util.JsonUtils;
|
import net.lionarius.skinrestorer.util.JsonUtils;
|
||||||
import net.lionarius.skinrestorer.util.PlayerUtils;
|
import net.lionarius.skinrestorer.util.PlayerUtils;
|
||||||
@@ -58,7 +59,7 @@ public final class MojangSkinProvider implements SkinProvider {
|
|||||||
var profile = MojangSkinProvider.getProfile(name);
|
var profile = MojangSkinProvider.getProfile(name);
|
||||||
callback.onProfileLookupSucceeded(profile);
|
callback.onProfileLookupSucceeded(profile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
callback.onProfileLookupFailed(name, e);
|
throw new TransparentException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +70,7 @@ public final class MojangSkinProvider implements SkinProvider {
|
|||||||
var profile = MojangSkinProvider.getProfile(name);
|
var profile = MojangSkinProvider.getProfile(name);
|
||||||
return Optional.of(profile);
|
return Optional.of(profile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return Optional.empty();
|
throw new TransparentException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, SkinRestorer.getConfigDir().resolve(PROFILE_CACHE_FILENAME).toFile());
|
}, SkinRestorer.getConfigDir().resolve(PROFILE_CACHE_FILENAME).toFile());
|
||||||
|
|||||||
@@ -50,14 +50,14 @@ public final class PlayerUtils {
|
|||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
var trackedEntity = (TrackedEntityAccessorInvoker) ((ChunkMapAccessor) chunkMap).getEntityMap().get(player.getId());
|
var trackedEntity = ((ChunkMapAccessor) chunkMap).getEntityMap().get(player.getId());
|
||||||
if (trackedEntity != null) {
|
if (trackedEntity != null) {
|
||||||
var seenBy = Set.copyOf(trackedEntity.getSeenBy());
|
var seenBy = Set.copyOf(trackedEntity.getSeenBy());
|
||||||
for (var observerConnection : seenBy) {
|
for (var observerConnection : seenBy) {
|
||||||
var observer = observerConnection.getPlayer();
|
var observer = observerConnection.getPlayer();
|
||||||
trackedEntity.invokeRemovePlayer(observer);
|
trackedEntity.invokeRemovePlayer(observer);
|
||||||
|
|
||||||
var trackedObserverEntity = (TrackedEntityAccessorInvoker) ((ChunkMapAccessor) chunkMap).getEntityMap().get(observer.getId());
|
var trackedObserverEntity = ((ChunkMapAccessor) chunkMap).getEntityMap().get(observer.getId());
|
||||||
if (trackedObserverEntity != null) {
|
if (trackedObserverEntity != null) {
|
||||||
trackedObserverEntity.invokeRemovePlayer(player);
|
trackedObserverEntity.invokeRemovePlayer(player);
|
||||||
trackedObserverEntity.invokeUpdatePlayer(player);
|
trackedObserverEntity.invokeUpdatePlayer(player);
|
||||||
@@ -96,6 +96,13 @@ public final class PlayerUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static GameProfile cloneGameProfile(GameProfile profile) {
|
||||||
|
var newProfile = new GameProfile(profile.getId(), profile.getName());
|
||||||
|
newProfile.getProperties().putAll(profile.getProperties());
|
||||||
|
|
||||||
|
return newProfile;
|
||||||
|
}
|
||||||
|
|
||||||
public static Property getPlayerSkin(GameProfile profile) {
|
public static Property getPlayerSkin(GameProfile profile) {
|
||||||
return Iterables.getFirst(profile.getProperties().get(TEXTURES_KEY), null);
|
return Iterables.getFirst(profile.getProperties().get(TEXTURES_KEY), null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,18 @@ public class Result<S, E> {
|
|||||||
this.errorValue = errorValue;
|
this.errorValue = errorValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <S, E> Result<S, E> success(@NotNull S successValue) {
|
||||||
|
return new Result<>(successValue, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <S, E> Result<S, E> error(@NotNull E errorValue) {
|
||||||
|
return new Result<>(null, errorValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <S, E> Result<Optional<S>, E> ofNullable(S successValue) {
|
||||||
|
return Result.success(Optional.ofNullable(successValue));
|
||||||
|
}
|
||||||
|
|
||||||
public S getSuccessValue() {
|
public S getSuccessValue() {
|
||||||
return successValue;
|
return successValue;
|
||||||
}
|
}
|
||||||
@@ -69,16 +81,4 @@ public class Result<S, E> {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(successValue, errorValue);
|
return Objects.hash(successValue, errorValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <S, E> Result<S, E> success(@NotNull S successValue) {
|
|
||||||
return new Result<>(successValue, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <S, E> Result<S, E> error(@NotNull E errorValue) {
|
|
||||||
return new Result<>(null, errorValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <S, E> Result<Optional<S>, E> ofNullable(S successValue) {
|
|
||||||
return Result.success(Optional.ofNullable(successValue));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import java.time.temporal.ChronoUnit;
|
|||||||
|
|
||||||
public final class WebUtils {
|
public final class WebUtils {
|
||||||
|
|
||||||
private WebUtils() {}
|
|
||||||
|
|
||||||
public static final String USER_AGENT;
|
public static final String USER_AGENT;
|
||||||
|
|
||||||
private static HttpClient HTTP_CLIENT = null;
|
private static HttpClient HTTP_CLIENT = null;
|
||||||
@@ -23,6 +21,8 @@ public final class WebUtils {
|
|||||||
USER_AGENT = String.format("SkinRestorer/%d", System.currentTimeMillis() % 65535);
|
USER_AGENT = String.format("SkinRestorer/%d", System.currentTimeMillis() % 65535);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private WebUtils() {}
|
||||||
|
|
||||||
public static void recreateHttpClient() {
|
public static void recreateHttpClient() {
|
||||||
HTTP_CLIENT = WebUtils.buildClient();
|
HTTP_CLIENT = WebUtils.buildClient();
|
||||||
}
|
}
|
||||||
|
|||||||
1
common/src/main/resources/META-INF/accesstransformer.cfg
Normal file
1
common/src/main/resources/META-INF/accesstransformer.cfg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
public net.minecraft.server.players.GameProfileCache$GameProfileInfo
|
||||||
3
common/src/main/resources/skinrestorer.accesswidener
Normal file
3
common/src/main/resources/skinrestorer.accesswidener
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
accessWidener v2 named
|
||||||
|
|
||||||
|
accessible class net/minecraft/server/players/GameProfileCache$GameProfileInfo
|
||||||
@@ -9,7 +9,9 @@
|
|||||||
"ChunkMapAccessor",
|
"ChunkMapAccessor",
|
||||||
"PlayerListMixin",
|
"PlayerListMixin",
|
||||||
"ServerLoginPacketListenerImplMixin",
|
"ServerLoginPacketListenerImplMixin",
|
||||||
"TrackedEntityAccessorInvoker"
|
"TrackedEntityAccessorInvoker",
|
||||||
|
"SkullBlockEntityMixin",
|
||||||
|
"GameProfileCacheAccessor"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
@@ -3,3 +3,4 @@ fabric_loader_version=0.15.0
|
|||||||
fabric_api_version=0.119.5+1.21.5
|
fabric_api_version=0.119.5+1.21.5
|
||||||
|
|
||||||
optional_dependencies=fabric-api
|
optional_dependencies=fabric-api
|
||||||
|
additional_modloaders=quilt
|
||||||
|
|||||||
@@ -15,4 +15,10 @@ public abstract class MinecraftServerMixin {
|
|||||||
private void onServerStarted(CallbackInfo ci) {
|
private void onServerStarted(CallbackInfo ci) {
|
||||||
SkinRestorer.Events.onServerStarted((MinecraftServer) (Object) this);
|
SkinRestorer.Events.onServerStarted((MinecraftServer) (Object) this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "runServer",
|
||||||
|
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;onServerExit()V"))
|
||||||
|
private void onServerStopped(CallbackInfo ci) {
|
||||||
|
SkinRestorer.Events.onServerStopped((MinecraftServer) (Object) this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
"${mod_id}.mixins.json",
|
"${mod_id}.mixins.json",
|
||||||
"${mod_id}.fabric.mixins.json"
|
"${mod_id}.fabric.mixins.json"
|
||||||
],
|
],
|
||||||
|
"accessWidener": "${mod_id}.accesswidener",
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=${fabric_loader_version}",
|
"fabricloader": ">=${fabric_loader_version}",
|
||||||
"minecraft": ">=${minecraft_version}",
|
"minecraft": ">=${minecraft_version}",
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ tasks.named('jarJar') {
|
|||||||
jar.finalizedBy('jarJar')
|
jar.finalizedBy('jarJar')
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
mappings channel: 'parchment', version: "${parchment_version}-${parchment_minecraft}"
|
mappings channel: 'parchment', version: "${parchment_minecraft}-${parchment_version}-${minecraft_version}"
|
||||||
|
|
||||||
copyIdeResources = true //Calls processResources when in dev
|
copyIdeResources = true //Calls processResources when in dev
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ minecraft {
|
|||||||
// Automatically enable forge AccessTransformers if the file exists
|
// Automatically enable forge AccessTransformers if the file exists
|
||||||
// This location is hardcoded in Forge and can not be changed.
|
// This location is hardcoded in Forge and can not be changed.
|
||||||
// https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
|
// https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
|
||||||
def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg')
|
def at = project(":common").file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
if (at.exists()) {
|
if (at.exists()) {
|
||||||
accessTransformer = at
|
accessTransformer = at
|
||||||
}
|
}
|
||||||
@@ -88,3 +88,7 @@ sourceSets.each {
|
|||||||
it.output.resourcesDir = dir
|
it.output.resourcesDir = dir
|
||||||
it.java.destinationDirectory = dir
|
it.java.destinationDirectory = dir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.named('processResources') {
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import net.lionarius.skinrestorer.SkinRestorer;
|
|||||||
import net.lionarius.skinrestorer.compat.skinshuffle.SkinShuffleCompatibility;
|
import net.lionarius.skinrestorer.compat.skinshuffle.SkinShuffleCompatibility;
|
||||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||||
import net.minecraftforge.event.server.ServerStartedEvent;
|
import net.minecraftforge.event.server.ServerStartedEvent;
|
||||||
|
import net.minecraftforge.event.server.ServerStoppedEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
|
||||||
@@ -27,4 +28,9 @@ public final class SkinRestorerForge {
|
|||||||
public static void onServerStarted(ServerStartedEvent event) {
|
public static void onServerStarted(ServerStartedEvent event) {
|
||||||
SkinRestorer.Events.onServerStarted(event.getServer());
|
SkinRestorer.Events.onServerStarted(event.getServer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onServerStopped(ServerStoppedEvent event) {
|
||||||
|
SkinRestorer.Events.onServerStopped(event.getServer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package net.lionarius.skinrestorer.forge.compat.skinshuffle;
|
package net.lionarius.skinrestorer.forge.compat.skinshuffle;
|
||||||
|
|
||||||
import net.lionarius.skinrestorer.SkinRestorer;
|
import net.lionarius.skinrestorer.SkinRestorer;
|
||||||
import net.lionarius.skinrestorer.compat.skinshuffle.SkinShuffleCompatibility;
|
|
||||||
import net.lionarius.skinrestorer.compat.skinshuffle.*;
|
import net.lionarius.skinrestorer.compat.skinshuffle.*;
|
||||||
|
import net.lionarius.skinrestorer.compat.skinshuffle.SkinShuffleCompatibility;
|
||||||
import net.minecraft.network.Connection;
|
import net.minecraft.network.Connection;
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
import net.minecraftforge.event.network.CustomPayloadEvent;
|
import net.minecraftforge.event.network.CustomPayloadEvent;
|
||||||
@@ -10,9 +10,6 @@ import net.minecraftforge.network.Channel;
|
|||||||
import net.minecraftforge.network.ChannelBuilder;
|
import net.minecraftforge.network.ChannelBuilder;
|
||||||
|
|
||||||
public class SkinShufflePacketHandler {
|
public class SkinShufflePacketHandler {
|
||||||
private SkinShufflePacketHandler() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Channel<CustomPacketPayload> INSTANCE = ChannelBuilder
|
private static final Channel<CustomPacketPayload> INSTANCE = ChannelBuilder
|
||||||
.named(SkinRestorer.resourceLocation("skin_shuffle_compat"))
|
.named(SkinRestorer.resourceLocation("skin_shuffle_compat"))
|
||||||
.optional()
|
.optional()
|
||||||
@@ -26,6 +23,9 @@ public class SkinShufflePacketHandler {
|
|||||||
.add(SkinShuffleSkinRefreshV2Payload.PACKET_ID, SkinShuffleSkinRefreshV2Payload.PACKET_CODEC, SkinShufflePacketHandler::handleSkinRefreshPacket)
|
.add(SkinShuffleSkinRefreshV2Payload.PACKET_ID, SkinShuffleSkinRefreshV2Payload.PACKET_CODEC, SkinShufflePacketHandler::handleSkinRefreshPacket)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
private SkinShufflePacketHandler() {
|
||||||
|
}
|
||||||
|
|
||||||
protected static void initialize() {
|
protected static void initialize() {
|
||||||
// NO-OP
|
// NO-OP
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ java_version=21
|
|||||||
# Common
|
# Common
|
||||||
minecraft_version=1.21.5
|
minecraft_version=1.21.5
|
||||||
minecraft_version_list=1.21.5
|
minecraft_version_list=1.21.5
|
||||||
minecraft_version_range=[1.21.5, 1.22)
|
minecraft_version_range=[1.21.5, 1.21.6)
|
||||||
mod_id=skinrestorer
|
mod_id=skinrestorer
|
||||||
mod_name=SkinRestorer
|
mod_name=SkinRestorer
|
||||||
mod_version=2.3.2
|
mod_version=2.4.3
|
||||||
mod_author=Lionarius
|
mod_author=Lionarius
|
||||||
mod_homepage=https://modrinth.com/mod/skinrestorer
|
mod_homepage=https://modrinth.com/mod/skinrestorer
|
||||||
mod_sources=https://github.com/Suiranoil/SkinRestorer
|
mod_sources=https://github.com/Suiranoil/SkinRestorer
|
||||||
@@ -18,11 +18,11 @@ credits=
|
|||||||
description=A server-side mod for managing skins.
|
description=A server-side mod for managing skins.
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
mineskin_client_version=3.0.1-SNAPSHOT
|
mineskin_client_version=3.0.6-SNAPSHOT
|
||||||
|
|
||||||
# ParchmentMC mappings, see https://parchmentmc.org/docs/getting-started#choose-a-version for new versions
|
# ParchmentMC mappings, see https://parchmentmc.org/docs/getting-started#choose-a-version for new versions
|
||||||
parchment_minecraft=1.21.5
|
parchment_minecraft=1.21.5
|
||||||
parchment_version=2025.04.19
|
parchment_version=2025.06.15
|
||||||
|
|
||||||
# Publishing
|
# Publishing
|
||||||
curseforge_id=443823
|
curseforge_id=443823
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ neoForge {
|
|||||||
version = neoforge_version
|
version = neoforge_version
|
||||||
|
|
||||||
// Automatically enable neoforge AccessTransformers if the file exists
|
// Automatically enable neoforge AccessTransformers if the file exists
|
||||||
def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg')
|
def at = project(":common").file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
if (at.exists()) {
|
if (at.exists()) {
|
||||||
minecraft.accessTransformers.file(at)
|
accessTransformers.from(at.absolutePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
parchment {
|
parchment {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import net.neoforged.fml.common.EventBusSubscriber;
|
|||||||
import net.neoforged.fml.common.Mod;
|
import net.neoforged.fml.common.Mod;
|
||||||
import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
||||||
import net.neoforged.neoforge.event.server.ServerStartedEvent;
|
import net.neoforged.neoforge.event.server.ServerStartedEvent;
|
||||||
|
import net.neoforged.neoforge.event.server.ServerStoppedEvent;
|
||||||
|
|
||||||
@Mod(SkinRestorer.MOD_ID)
|
@Mod(SkinRestorer.MOD_ID)
|
||||||
@EventBusSubscriber(modid = SkinRestorer.MOD_ID)
|
@EventBusSubscriber(modid = SkinRestorer.MOD_ID)
|
||||||
@@ -28,4 +29,9 @@ public final class SkinRestorerNeoForge {
|
|||||||
public static void onServerStarted(ServerStartedEvent event) {
|
public static void onServerStarted(ServerStartedEvent event) {
|
||||||
SkinRestorer.Events.onServerStarted(event.getServer());
|
SkinRestorer.Events.onServerStarted(event.getServer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onServerStopped(ServerStoppedEvent event) {
|
||||||
|
SkinRestorer.Events.onServerStopped(event.getServer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package net.lionarius.skinrestorer.neoforge.compat.skinshuffle;
|
package net.lionarius.skinrestorer.neoforge.compat.skinshuffle;
|
||||||
|
|
||||||
import net.lionarius.skinrestorer.compat.skinshuffle.SkinShuffleCompatibility;
|
|
||||||
import net.lionarius.skinrestorer.compat.skinshuffle.*;
|
import net.lionarius.skinrestorer.compat.skinshuffle.*;
|
||||||
|
import net.lionarius.skinrestorer.compat.skinshuffle.SkinShuffleCompatibility;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
|
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
|
||||||
|
|||||||
Reference in New Issue
Block a user