mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-27 07:26:48 +01:00
Move MinecraftMixin to platforms
This commit is contained in:
parent
70a72209d2
commit
6e0702aa0b
2 changed files with 35 additions and 0 deletions
|
@ -0,0 +1,35 @@
|
||||||
|
package com.jozufozu.flywheel.impl.mixin;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import com.jozufozu.flywheel.api.event.EndClientResourceReloadEvent;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.ModLoader;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
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.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
||||||
|
|
||||||
|
@Mixin(Minecraft.class)
|
||||||
|
abstract class MinecraftMixin {
|
||||||
|
@Shadow
|
||||||
|
@Final
|
||||||
|
private ReloadableResourceManager resourceManager;
|
||||||
|
|
||||||
|
@Inject(method = "method_24040", at = @At("HEAD"))
|
||||||
|
private void flywheel$onEndInitialResourceReload(Optional<Throwable> error, CallbackInfo ci) {
|
||||||
|
ModLoader.get().postEvent(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, true, error));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "method_24228", at = @At("HEAD"))
|
||||||
|
private void flywheel$onEndManualResourceReload(boolean recovery, CompletableFuture<Void> future, Optional<Throwable> error, CallbackInfo ci) {
|
||||||
|
ModLoader.get().postEvent(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, false, error));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue