fix: mix into proper class for client
ci/woodpecker/push/jfmod Pipeline was successful
Details
ci/woodpecker/push/jfmod Pipeline was successful
Details
This commit is contained in:
parent
7af7faa24d
commit
715504d4d5
|
@ -1,7 +1,7 @@
|
|||
package io.gitlab.jfronny.dynres.mixin;
|
||||
|
||||
import io.gitlab.jfronny.dynres.DynRes;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.ClientCommonNetworkHandler;
|
||||
import net.minecraft.network.packet.c2s.common.ResourcePackStatusC2SPacket;
|
||||
import net.minecraft.network.packet.s2c.common.ResourcePackSendS2CPacket;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -12,27 +12,26 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
|
||||
import java.net.URL;
|
||||
|
||||
@Mixin(ClientPlayNetworkHandler.class)
|
||||
public abstract class ClientPlayNetworkHandlerMixin {
|
||||
@Shadow @Nullable
|
||||
private static URL resolveUrl(String url) {
|
||||
throw new RuntimeException("Mixin not applied");
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "sendResourcePackStatus(Lnet/minecraft/network/packet/c2s/play/ResourcePackStatusC2SPacket$Status;)V")
|
||||
@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);
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "onResourcePackSend(Lnet/minecraft/network/packet/s2c/play/ResourcePackSendS2CPacket;)V")
|
||||
public void logResourcePackStatus(ResourcePackSendS2CPacket status, CallbackInfo info) {
|
||||
DynRes.LOGGER.info("[RECEIVE] ResourcePackUrl=" + status.getURL());
|
||||
DynRes.LOGGER.info("[RECEIVE] ResourcePackSha1=" + status.getSHA1());
|
||||
@Shadow @Nullable protected static URL getParsedResourcePackUrl(String url) {
|
||||
throw new RuntimeException("Mixin not applied");
|
||||
}
|
||||
|
||||
@Redirect(method = "onResourcePackSend(Lnet/minecraft/network/packet/s2c/play/ResourcePackSendS2CPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;resolveUrl(Ljava/lang/String;)Ljava/net/URL;"))
|
||||
@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());
|
||||
}
|
||||
|
||||
@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;"))
|
||||
public URL logResourcePackStatus(String url) {
|
||||
URL res = resolveUrl(url);
|
||||
URL res = getParsedResourcePackUrl(url);
|
||||
DynRes.LOGGER.info("[CHECK] ResourcePackUrlValid=" + (res != null));
|
||||
return res;
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
"package": "io.gitlab.jfronny.dynres.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"client": [
|
||||
"ClientPlayNetworkHandlerMixin",
|
||||
"ClientCommonNetworkHandlerMixin",
|
||||
"ServerInfoMixin"
|
||||
],
|
||||
"injectors": {
|
||||
|
|
Loading…
Reference in New Issue