mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-21 12:32:29 +00:00
JEI is better now
This commit is contained in:
1 parent
5ce51286bb
commit
1325f8b6c1
2 files changed
+31
-27
No files matched your search
@@ -38,7 +38,7 @@ dependencies {
|
||||
compile project(':ZenScript')
|
||||
compile project(':MineTweaker3-API')
|
||||
compile project(':MineTweaker3-MC18-Main')
|
||||
deobfCompile "mezz.jei:jei_1.8.9:2.14.0.67"
|
||||
deobfCompile "mezz.jei:jei_1.8.9:2.28.18.186"
|
||||
}
|
||||
|
||||
task makeRegistry(type: RegisterZenClassesTask) {
|
||||
|
||||
@@ -1,50 +1,54 @@
|
||||
package minetweaker.mods.jei;
|
||||
|
||||
import mezz.jei.api.IItemRegistry;
|
||||
import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.IRecipeRegistry;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.CommandEvent;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import mezz.jei.api.*;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.util.IEventHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@mezz.jei.api.JEIPlugin
|
||||
public class JEIAddonPlugin implements IModPlugin {
|
||||
|
||||
private static boolean eventAdded = false;
|
||||
public static IJeiHelpers jeiHelpers;
|
||||
public static IItemRegistry itemRegistry;
|
||||
public static IRecipeRegistry recipeRegistry;
|
||||
|
||||
|
||||
@Override
|
||||
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers) {
|
||||
this.jeiHelpers = jeiHelpers;
|
||||
public void onJeiHelpersAvailable(IJeiHelpers iJeiHelpers) {
|
||||
this.jeiHelpers = iJeiHelpers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRegistryAvailable(IItemRegistry itemRegistry) {
|
||||
this.itemRegistry = itemRegistry;
|
||||
public void onItemRegistryAvailable(IItemRegistry iItemRegistry) {
|
||||
this.itemRegistry = iItemRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(IModRegistry registry) {
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void command(CommandEvent e) {
|
||||
if (e.command.getCommandAliases().contains("mt") && e.parameters[0].equals("reload")) {
|
||||
jeiHelpers.reload();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry) {
|
||||
this.recipeRegistry = recipeRegistry;
|
||||
public void onRecipeRegistryAvailable(@Nonnull IRecipeRegistry iRecipeRegistry) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRuntimeAvailable(@Nonnull IJeiRuntime iJeiRuntime) {
|
||||
this.recipeRegistry = iJeiRuntime.getRecipeRegistry();
|
||||
if(!eventAdded){
|
||||
MineTweakerImplementationAPI.onPostReload(new IEventHandler<MineTweakerImplementationAPI.ReloadEvent>() {
|
||||
@Override
|
||||
public void handle(MineTweakerImplementationAPI.ReloadEvent event) {
|
||||
jeiHelpers.reload();
|
||||
}
|
||||
});
|
||||
eventAdded = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user