Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
tried mixining jei to get the feature I wanted, but doesn't seem to b…
Browse files Browse the repository at this point in the history
…e working
  • Loading branch information
Trinsdar committed Sep 27, 2024
1 parent 7895712 commit 1b9a8ff
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 1 deletion.
1 change: 1 addition & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies {
modCompileOnly "me.shedaniel:RoughlyEnoughItems-api:${rootProject.rei_version}"
modCompileOnly "me.shedaniel:RoughlyEnoughItems-default-plugin:${rootProject.rei_version}"
modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-common-api:${rootProject.jei_version}")
modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-common:${rootProject.jei_version}")
modImplementation("com.terraformersmc.terraform-api:terraform-wood-api-v1:${project.terraform_version_fabric}"){
transitive = false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.github.gregtechintergalactical.gtcore.mixin.jei;

import io.github.gregtechintergalactical.gtcore.GTCore;
import mezz.jei.api.ingredients.ITypedIngredient;
import mezz.jei.common.input.IClickedIngredient;
import mezz.jei.common.input.handlers.FocusInputHandler;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Debug;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Debug(export = true)
@Mixin(FocusInputHandler.class)
public class FocusInputHandlerMixin {
@Redirect(method = "lambda$handleShow$0", at = @At(value = "INVOKE", target = "Lmezz/jei/common/input/IClickedIngredient;getTypedIngredient()Lmezz/jei/api/ingredients/ITypedIngredient;"), remap = false)
private static ITypedIngredient<?> gtcore$redirectSelectorTag(IClickedIngredient<?> instance){
if (instance.getTypedIngredient().getIngredient() instanceof ItemStack stack){
GTCore.LOGGER.info(instance.getTypedIngredient());
}
return instance.getTypedIngredient();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package io.github.gregtechintergalactical.gtcore.mixin.jei;

import muramasa.antimatter.Ref;
import muramasa.antimatter.util.AntimatterPreLaunchUtil;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

import java.util.List;
import java.util.Set;

public class JEIMixinPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {

}

@Override
public String getRefMapperConfig() {
return null;
}

@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
return false;
//return AntimatterPreLaunchUtil.INSTANCE.isModLoaded(Ref.MOD_JEI);
}

@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {

}

@Override
public List<String> getMixins() {
return null;
}

@Override
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {

}

@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {

}
}
10 changes: 10 additions & 0 deletions common/src/main/resources/gtcore.jei.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"required": true,
"package": "io.github.gregtechintergalactical.gtcore.mixin.jei",
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"plugin": "io.github.gregtechintergalactical.gtcore.mixin.jei.JEIMixinPlugin",
"mixins": [
"FocusInputHandlerMixin"
]
}
1 change: 1 addition & 0 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"accessWidener": "gtcore.accesswidener",
"mixins": [
"gtcore.mixins.json",
"gtcore.jei.mixins.json",
"gtcore-fabric.mixins.json"
],
"environment": "*",
Expand Down
2 changes: 1 addition & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ loom {
accessWidenerPath = project(":common").file("src/main/resources/gtcore.accesswidener")
forge{
mixinConfigs = [
"gtcore.mixins.json"
"gtcore.mixins.json", "gtcore.jei.mixins.json"
]
}
}
Expand Down

0 comments on commit 1b9a8ff

Please sign in to comment.