generated from CleanroomMC/TemplateDevEnv
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
159 additions
and
4 deletions.
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
30 changes: 30 additions & 0 deletions
30
src/main/java/com/cleanroommc/modularui/core/LateMixins.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,30 @@ | ||
package com.cleanroommc.modularui.core; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
|
||
import net.minecraftforge.fml.common.Loader; | ||
|
||
import zone.rong.mixinbooter.ILateMixinLoader; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class LateMixins implements ILateMixinLoader { | ||
|
||
public static final List<String> modMixins = ImmutableList.of("jei"); | ||
|
||
@Override | ||
public List<String> getMixinConfigs() { | ||
return modMixins.stream().map(mod -> "mixin.modularui." + mod + ".json").collect(Collectors.toList()); | ||
} | ||
|
||
@Override | ||
public boolean shouldMixinConfigQueue(String mixinConfig) { | ||
String[] parts = mixinConfig.split("\\."); | ||
return parts.length != 4 || shouldEnableModMixin(parts[2]); | ||
} | ||
|
||
public boolean shouldEnableModMixin(String mod) { | ||
return Loader.isModLoaded(mod); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...ain/java/com/cleanroommc/modularui/core/mixin/jei/GhostIngredientDragManagerAccessor.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,13 @@ | ||
package com.cleanroommc.modularui.core.mixin.jei; | ||
|
||
import mezz.jei.gui.ghost.GhostIngredientDrag; | ||
import mezz.jei.gui.ghost.GhostIngredientDragManager; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(value = GhostIngredientDragManager.class, remap = false) | ||
public interface GhostIngredientDragManagerAccessor { | ||
|
||
@Accessor | ||
GhostIngredientDrag<?> getGhostIngredientDrag(); | ||
} |
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
13 changes: 13 additions & 0 deletions
13
src/main/java/com/cleanroommc/modularui/core/mixin/jei/IngredientListOverlayAccessor.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,13 @@ | ||
package com.cleanroommc.modularui.core.mixin.jei; | ||
|
||
import mezz.jei.gui.ghost.GhostIngredientDragManager; | ||
import mezz.jei.gui.overlay.IngredientListOverlay; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(value = IngredientListOverlay.class, remap = false) | ||
public interface IngredientListOverlayAccessor { | ||
|
||
@Accessor | ||
GhostIngredientDragManager getGhostIngredientDragManager(); | ||
} |
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
28 changes: 28 additions & 0 deletions
28
src/main/java/com/cleanroommc/modularui/integration/jei/ModularUIJeiPlugin.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 |
---|---|---|
@@ -1,18 +1,46 @@ | ||
package com.cleanroommc.modularui.integration.jei; | ||
|
||
import com.cleanroommc.modularui.core.mixin.jei.GhostIngredientDragManagerAccessor; | ||
import com.cleanroommc.modularui.core.mixin.jei.IngredientListOverlayAccessor; | ||
import com.cleanroommc.modularui.screen.GuiContainerWrapper; | ||
|
||
import mezz.jei.api.IJeiRuntime; | ||
import mezz.jei.api.IModPlugin; | ||
import mezz.jei.api.IModRegistry; | ||
import mezz.jei.api.JEIPlugin; | ||
|
||
import mezz.jei.gui.ghost.GhostIngredientDrag; | ||
import mezz.jei.gui.ghost.GhostIngredientDragManager; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
@JEIPlugin | ||
public class ModularUIJeiPlugin implements IModPlugin { | ||
|
||
private static IJeiRuntime runtime; | ||
|
||
@Override | ||
public void register(@NotNull IModRegistry registry) { | ||
new ModularUIHandler<>(GuiContainerWrapper.class).register(registry); | ||
} | ||
|
||
@Override | ||
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) { | ||
ModularUIJeiPlugin.runtime = jeiRuntime; | ||
} | ||
|
||
public static IJeiRuntime getRuntime() { | ||
return runtime; | ||
} | ||
|
||
public static GhostIngredientDragManager getGhostDragManager() { | ||
return ((IngredientListOverlayAccessor) runtime.getIngredientListOverlay()).getGhostIngredientDragManager(); | ||
} | ||
|
||
public static GhostIngredientDrag<?> getGhostDrag() { | ||
return ((GhostIngredientDragManagerAccessor) getGhostDragManager()).getGhostIngredientDrag(); | ||
} | ||
|
||
public static boolean hasDraggingGhostIngredient() { | ||
return getGhostDrag() != null; | ||
} | ||
} |
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
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,14 @@ | ||
{ | ||
"package": "com.cleanroommc.modularui.core.mixin.jei", | ||
"refmap": "mixins.modularui.refmap.json", | ||
"target": "@env(DEFAULT)", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"client": [ | ||
], | ||
"mixins": [ | ||
"GhostIngredientDragManagerAccessor", | ||
"IngredientGridMixin", | ||
"IngredientListOverlayAccessor" | ||
] | ||
} |