-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GS Reload Removing All Removed Entries
Might need to remove this (just literally revert this commit) when GS updates, if they fix it there
- Loading branch information
1 parent
9ab07ea
commit e166563
Showing
5 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
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
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
27 changes: 27 additions & 0 deletions
27
src/main/java/com/nomiceu/nomilabs/mixin/groovyscript/ReloadableRegistryManagerMixin.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,27 @@ | ||
package com.nomiceu.nomilabs.mixin.groovyscript; | ||
|
||
import com.cleanroommc.groovyscript.registry.ReloadableRegistryManager; | ||
import mezz.jei.Internal; | ||
import mezz.jei.ingredients.IngredientFilter; | ||
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 java.lang.reflect.InvocationTargetException; | ||
|
||
// TODO Might Have to Remove this in GS Update, if they fix it there? | ||
@Mixin(value = ReloadableRegistryManager.class, remap = false) | ||
public class ReloadableRegistryManagerMixin { | ||
@Inject(method = "reloadJei", at = @At("TAIL")) | ||
private static void test(boolean msgPlayer, CallbackInfo ci) { | ||
// Fix: HEI Removals Disappearing on Reload | ||
// Reloads the Removed Ingredients (Actually removes them) | ||
// Must use Internal, no other way to get IngredientFilter | ||
// Reflection, method doesn't exist in JEI | ||
var filter = Internal.getIngredientFilter(); | ||
try { | ||
IngredientFilter.class.getDeclaredMethod("block").invoke(filter); | ||
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ignored) {} | ||
} | ||
} |
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,12 @@ | ||
{ | ||
"package": "com.nomiceu.nomilabs.mixin.groovyscript", | ||
"refmap": "mixins.nomilabs.refmap.json", | ||
"target": "@env(DEFAULT)", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"ReloadableRegistryManagerMixin" | ||
], | ||
"client": [], | ||
"server": [] | ||
} |