Fix resource pack recorder mixin
The old targets weren't inside the method but inside an inner class.
This commit is contained in:
@@ -5,16 +5,18 @@ import com.replaymod.recording.packet.ResourcePackRecorder;
|
|||||||
import de.johni0702.minecraft.gui.utils.Consumer;
|
import de.johni0702.minecraft.gui.utils.Consumer;
|
||||||
import net.minecraft.client.resources.DownloadingPackFinder;
|
import net.minecraft.client.resources.DownloadingPackFinder;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
//#if MC>=11400
|
//#if MC>=10800
|
||||||
//$$ import java.util.concurrent.CompletableFuture;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
//#else
|
//#else
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
//$$ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
//$$ import net.minecraft.util.HttpUtil;
|
||||||
|
//$$ import java.lang.reflect.Proxy;
|
||||||
|
//$$ import java.util.Map;
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
@Mixin(DownloadingPackFinder.class)
|
@Mixin(DownloadingPackFinder.class)
|
||||||
@@ -26,32 +28,27 @@ public abstract class MixinDownloadingPackFinder implements ResourcePackRecorder
|
|||||||
requestCallback = callback;
|
requestCallback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Shadow
|
|
||||||
public abstract
|
|
||||||
//#if MC>=11400
|
|
||||||
//$$ CompletableFuture<Object>
|
|
||||||
//#else
|
|
||||||
ListenableFuture<Object>
|
|
||||||
//#endif
|
|
||||||
func_195741_a(File file);
|
|
||||||
|
|
||||||
//#if MC>=11400
|
|
||||||
//$$ @Redirect(method = "download", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/resource/ClientResourcePackCreator;loadServerPack(Ljava/io/File;)Ljava/util/concurrent/CompletableFuture;"))
|
|
||||||
//$$ private CompletableFuture<Object>
|
|
||||||
//#else
|
|
||||||
//#if MC>=10800
|
//#if MC>=10800
|
||||||
@Redirect(method = "downloadResourcePack", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/resources/DownloadingPackFinder;func_195741_a(Ljava/io/File;)Lcom/google/common/util/concurrent/ListenableFuture;"))
|
@Inject(method = "func_195741_a", at = @At("HEAD"))
|
||||||
//#else
|
private void recordDownloadedPack(File file, CallbackInfoReturnable ci) {
|
||||||
//$$ @Redirect(method = "func_180601_a", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/resources/ResourcePackRepository;func_177319_a(Ljava/io/File;)Lcom/google/common/util/concurrent/ListenableFuture;"))
|
|
||||||
//#endif
|
|
||||||
private ListenableFuture<Object>
|
|
||||||
//#endif
|
|
||||||
recordDownloadedPack(DownloadingPackFinder downloadingPackFinder, File file) {
|
|
||||||
if (requestCallback != null) {
|
if (requestCallback != null) {
|
||||||
requestCallback.consume(file);
|
requestCallback.consume(file);
|
||||||
requestCallback = null;
|
requestCallback = null;
|
||||||
}
|
}
|
||||||
return func_195741_a(file);
|
|
||||||
}
|
}
|
||||||
|
//#else
|
||||||
|
//$$ @Redirect(method = "func_148528_a", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/HttpUtil;downloadResourcePack(Ljava/io/File;Ljava/lang/String;Lnet/minecraft/util/HttpUtil$DownloadListener;Ljava/util/Map;ILnet/minecraft/util/HttpUtil$IProgressUpdate;Ljava/net/Proxy;)V"))
|
||||||
|
//$$ private void downloadResourcePack(File dst, String url, HttpUtil.DownloadListener callback, final Map headers, final int maxSize, final HttpUtil.IProgressUpdate progress, Proxy proxy) {
|
||||||
|
//$$ HttpUtil.downloadResourcePack(dst, url, new HttpUtil.DownloadListener() {
|
||||||
|
//$$ public void onDownloadComplete(File file) {
|
||||||
|
//$$ if (requestCallback != null) {
|
||||||
|
//$$ requestCallback.consume(file);
|
||||||
|
//$$ requestCallback = null;
|
||||||
|
//$$ }
|
||||||
|
//$$ callback.onDownloadComplete(file);
|
||||||
|
//$$ }
|
||||||
|
//$$ }, headers, maxSize, progress, proxy);
|
||||||
|
//$$ }
|
||||||
|
//#endif
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user