-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GrS JEI Hiding Issues in Certain JEI Configs
- Loading branch information
1 parent
93247c1
commit d0550f8
Showing
5 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
src/main/java/com/nomiceu/nomilabs/groovy/mixinhelper/LabsJEIApplied.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.nomiceu.nomilabs.groovy.mixinhelper; | ||
|
||
import com.cleanroommc.groovyscript.api.GroovyBlacklist; | ||
|
||
@GroovyBlacklist | ||
public class LabsJEIApplied { | ||
|
||
public static boolean afterRegisterApplied = false; | ||
public static boolean afterRuntimeApplied = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/com/nomiceu/nomilabs/mixin/jei/JeiStarterMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.nomiceu.nomilabs.mixin.jei; | ||
|
||
import java.util.List; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import com.cleanroommc.groovyscript.compat.mods.jei.JeiPlugin; | ||
import com.nomiceu.nomilabs.NomiLabs; | ||
import com.nomiceu.nomilabs.groovy.mixinhelper.LabsJEIApplied; | ||
|
||
import mezz.jei.api.IJeiRuntime; | ||
import mezz.jei.api.IModPlugin; | ||
import mezz.jei.startup.JeiStarter; | ||
import mezz.jei.startup.ModRegistry; | ||
|
||
/** | ||
* Fix GrS JEI Hiding Issues, by re-checking if applied, and if not, applying at end of registers, | ||
* instead of before ProgressManager.pop(). This can happen due to HEI's new 'Progress Bar' config. | ||
*/ | ||
@Mixin(value = JeiStarter.class, remap = false) | ||
public class JeiStarterMixin { | ||
|
||
@Inject(method = "registerPlugins", at = @At("TAIL")) | ||
private static void handleAfterRegister(List<IModPlugin> plugins, ModRegistry modRegistry, CallbackInfo ci) { | ||
if (LabsJEIApplied.afterRegisterApplied) { | ||
NomiLabs.LOGGER.info("[GrS + JEI] After Register Applied Correctly."); | ||
return; | ||
} | ||
|
||
NomiLabs.LOGGER.error("[GrS + JEI] After Register Did Not Apply Correctly! Applying..."); | ||
JeiPlugin.afterRegister(); | ||
} | ||
|
||
@Inject(method = "sendRuntime", at = @At("TAIL")) | ||
private static void handleAfterRuntime(List<IModPlugin> plugins, IJeiRuntime jeiRuntime, CallbackInfo ci) { | ||
if (LabsJEIApplied.afterRuntimeApplied) { | ||
NomiLabs.LOGGER.info("[GrS + JEI] After Runtime Applied Correctly."); | ||
return; | ||
} | ||
|
||
NomiLabs.LOGGER.error("[GrS + JEI] After Runtime Did Not Apply Correctly! Applying..."); | ||
JeiPlugin.afterRuntimeAvailable(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters