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;
|
package io.gitlab.jfronny.dynres.mixin;
|
||||||
|
|
||||||
import io.gitlab.jfronny.dynres.DynRes;
|
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.c2s.common.ResourcePackStatusC2SPacket;
|
||||||
import net.minecraft.network.packet.s2c.common.ResourcePackSendS2CPacket;
|
import net.minecraft.network.packet.s2c.common.ResourcePackSendS2CPacket;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
@ -12,27 +12,26 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
@Mixin(ClientPlayNetworkHandler.class)
|
@Mixin(ClientCommonNetworkHandler.class)
|
||||||
public abstract class ClientPlayNetworkHandlerMixin {
|
public abstract class ClientCommonNetworkHandlerMixin {
|
||||||
@Shadow @Nullable
|
@Inject(at = @At("HEAD"), method = "sendResourcePackStatus(Lnet/minecraft/network/packet/c2s/common/ResourcePackStatusC2SPacket$Status;)V")
|
||||||
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")
|
|
||||||
public void logSentResourcePackStatus(ResourcePackStatusC2SPacket.Status packStatus, CallbackInfo info) {
|
public void logSentResourcePackStatus(ResourcePackStatusC2SPacket.Status packStatus, CallbackInfo info) {
|
||||||
DynRes.LOGGER.info("[SEND] ResourcePackStatus=" + packStatus);
|
DynRes.LOGGER.info("[SEND] ResourcePackStatus=" + packStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "onResourcePackSend(Lnet/minecraft/network/packet/s2c/play/ResourcePackSendS2CPacket;)V")
|
@Shadow @Nullable protected static URL getParsedResourcePackUrl(String url) {
|
||||||
public void logResourcePackStatus(ResourcePackSendS2CPacket status, CallbackInfo info) {
|
throw new RuntimeException("Mixin not applied");
|
||||||
DynRes.LOGGER.info("[RECEIVE] ResourcePackUrl=" + status.getURL());
|
|
||||||
DynRes.LOGGER.info("[RECEIVE] ResourcePackSha1=" + status.getSHA1());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@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) {
|
public URL logResourcePackStatus(String url) {
|
||||||
URL res = resolveUrl(url);
|
URL res = getParsedResourcePackUrl(url);
|
||||||
DynRes.LOGGER.info("[CHECK] ResourcePackUrlValid=" + (res != null));
|
DynRes.LOGGER.info("[CHECK] ResourcePackUrlValid=" + (res != null));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
"package": "io.gitlab.jfronny.dynres.mixin",
|
"package": "io.gitlab.jfronny.dynres.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"client": [
|
"client": [
|
||||||
"ClientPlayNetworkHandlerMixin",
|
"ClientCommonNetworkHandlerMixin",
|
||||||
"ServerInfoMixin"
|
"ServerInfoMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
|
|
Loading…
Reference in New Issue