|
| 1 | +package llc.redstone.hysentials.mixin; |
| 2 | + |
| 3 | +import llc.redstone.hysentials.util.SplashProgress; |
| 4 | +import net.minecraft.client.Minecraft; |
| 5 | +import net.minecraft.client.resources.IReloadableResourceManager; |
| 6 | +import net.minecraftforge.fml.client.FMLClientHandler; |
| 7 | +import org.spongepowered.asm.mixin.Mixin; |
| 8 | +import org.spongepowered.asm.mixin.injection.At; |
| 9 | +import org.spongepowered.asm.mixin.injection.Inject; |
| 10 | +import org.spongepowered.asm.mixin.injection.Redirect; |
| 11 | +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
| 12 | + |
| 13 | +import java.util.List; |
| 14 | +import java.util.concurrent.Semaphore; |
| 15 | + |
| 16 | +@Mixin(value=FMLClientHandler.class, remap = false) |
| 17 | +public class FMLClientHandlerMixin { |
| 18 | + @Redirect(method = "beginMinecraftLoading", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/SplashProgress;start()V")) |
| 19 | + private void rdStart() { |
| 20 | + SplashProgress.start(); |
| 21 | + } |
| 22 | + |
| 23 | + @Redirect(method = "onInitializationComplete", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/SplashProgress;finish()V")) |
| 24 | + private void rdFinish3() { |
| 25 | + SplashProgress.finish(); |
| 26 | + } |
| 27 | + |
| 28 | + @Redirect(method = "haltGame", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/SplashProgress;finish()V")) |
| 29 | + private void rdFinish() { |
| 30 | + SplashProgress.finish(); |
| 31 | + } |
| 32 | + |
| 33 | + @Redirect(method = "finishMinecraftLoading", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/SplashProgress;finish()V")) |
| 34 | + private void rdFinish2() { |
| 35 | + SplashProgress.finish(); |
| 36 | + } |
| 37 | + |
| 38 | + @Redirect(method = "processWindowMessages", at = @At(value = "INVOKE", target = "Ljava/util/concurrent/Semaphore;tryAcquire()Z")) |
| 39 | + private boolean rdTryAcquire(Semaphore instance) { |
| 40 | + return SplashProgress.mutex.tryAcquire(); |
| 41 | + } |
| 42 | + |
| 43 | + @Redirect(method = "processWindowMessages", at = @At(value = "INVOKE", target = "Ljava/util/concurrent/Semaphore;release()V")) |
| 44 | + private void rdRelease(Semaphore instance) { |
| 45 | + SplashProgress.mutex.release(); |
| 46 | + } |
| 47 | +} |
0 commit comments