This commit is contained in:
parent
715504d4d5
commit
25e99adc33
@ -5,12 +5,12 @@ plugins {
|
||||
allprojects { group = "io.gitlab.jfronny" }
|
||||
base.archivesName = "dynres"
|
||||
|
||||
val fabricVersion = "0.89.1+1.20.2"
|
||||
val fabricVersion = "0.91.1+1.20.4"
|
||||
jfMod {
|
||||
minecraftVersion = "1.20.2"
|
||||
minecraftVersion = "1.20.4"
|
||||
yarn("build.1")
|
||||
loaderVersion = "0.14.22"
|
||||
libJfVersion = "3.13.1"
|
||||
loaderVersion = "0.15.0"
|
||||
libJfVersion = "3.14.1"
|
||||
|
||||
modrinth {
|
||||
projectId = "dynres"
|
||||
@ -30,5 +30,5 @@ dependencies {
|
||||
modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v2:${jfMod.libJfVersion.get()}")
|
||||
|
||||
// Dev env
|
||||
modLocalRuntime("com.terraformersmc:modmenu:8.0.0-beta.2")
|
||||
modLocalRuntime("com.terraformersmc:modmenu:9.0.0-pre.1")
|
||||
}
|
||||
|
@ -14,19 +14,14 @@ import java.net.URL;
|
||||
|
||||
@Mixin(ClientCommonNetworkHandler.class)
|
||||
public abstract class ClientCommonNetworkHandlerMixin {
|
||||
@Inject(at = @At("HEAD"), method = "sendResourcePackStatus(Lnet/minecraft/network/packet/c2s/common/ResourcePackStatusC2SPacket$Status;)V")
|
||||
public void logSentResourcePackStatus(ResourcePackStatusC2SPacket.Status packStatus, CallbackInfo info) {
|
||||
DynRes.LOGGER.info("[SEND] ResourcePackStatus=" + packStatus);
|
||||
}
|
||||
|
||||
@Shadow @Nullable protected static URL getParsedResourcePackUrl(String url) {
|
||||
throw new RuntimeException("Mixin not applied");
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "onResourcePackSend(Lnet/minecraft/network/packet/s2c/common/ResourcePackSendS2CPacket;)V")
|
||||
public void logResourcePackStatus(ResourcePackSendS2CPacket status, CallbackInfo info) {
|
||||
DynRes.LOGGER.info("[RECEIVE] ResourcePackUrl=" + status.getUrl());
|
||||
DynRes.LOGGER.info("[RECEIVE] ResourcePackHash=" + status.getHash());
|
||||
DynRes.LOGGER.info("[RECEIVE] ResourcePackUrl=" + status.url());
|
||||
DynRes.LOGGER.info("[RECEIVE] ResourcePackHash=" + status.hash());
|
||||
}
|
||||
|
||||
@Redirect(method = "onResourcePackSend(Lnet/minecraft/network/packet/s2c/common/ResourcePackSendS2CPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientCommonNetworkHandler;getParsedResourcePackUrl(Ljava/lang/String;)Ljava/net/URL;"))
|
||||
|
@ -15,10 +15,12 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
@Mixin(ServerPropertiesHandler.class)
|
||||
public abstract class ServerPropertiesHandlerMixin {
|
||||
@ -27,8 +29,8 @@ public abstract class ServerPropertiesHandlerMixin {
|
||||
throw new IllegalStateException("Mixin not applied");
|
||||
}
|
||||
|
||||
@Inject(method = "getServerResourcePackProperties(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;)Ljava/util/Optional;", at = @At("HEAD"), cancellable = true)
|
||||
private static void getServerResourcePackProperties(String url, String sha1, @Nullable String hash, boolean required, String prompt, CallbackInfoReturnable<Optional<MinecraftServer.ServerResourcePackProperties>> cir) {
|
||||
@Inject(method = "getServerResourcePackProperties(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;)Ljava/util/Optional;", at = @At("HEAD"), cancellable = true)
|
||||
private static void getServerResourcePackProperties(String id, String url, String sha1, String hash, boolean required, String prompt, CallbackInfoReturnable<Optional<MinecraftServer.ServerResourcePackProperties>> cir) {
|
||||
if (DynRes.packFile != null) {
|
||||
sha1 = "";
|
||||
if (Cfg.hashResources) {
|
||||
@ -43,8 +45,10 @@ public abstract class ServerPropertiesHandlerMixin {
|
||||
DynRes.LOGGER.error("Failed to get hash, continuing with empty", e);
|
||||
}
|
||||
}
|
||||
url = WebPaths.concat(WebServer.getInstance().getServerRoot(), "resources.zip");
|
||||
cir.setReturnValue(Optional.of(new MinecraftServer.ServerResourcePackProperties(
|
||||
WebPaths.concat(WebServer.getInstance().getServerRoot(), "resources.zip"),
|
||||
UUID.nameUUIDFromBytes(url.getBytes(StandardCharsets.UTF_8)),
|
||||
url,
|
||||
sha1,
|
||||
required,
|
||||
parseResourcePackPrompt(prompt)
|
||||
|
Loading…
Reference in New Issue
Block a user