Fix nei recipe handlers

This commit is contained in:
Ellpeck 2015-10-02 20:06:03 +02:00
parent a92396204a
commit 7e0d524b0f
3 changed files with 3 additions and 9 deletions

View file

@ -14,7 +14,6 @@ import cpw.mods.fml.common.Loader;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.nei.NeiScreenEvents;
import ellpeck.actuallyadditions.update.UpdateCheckerClientNotifier;
import ellpeck.actuallyadditions.util.CompatUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraftforge.common.MinecraftForge;
@ -39,7 +38,7 @@ public class InitEvents{
Util.registerEvent(new TooltipEvent());
Util.registerEvent(new RenderPlayerEventAA());
if(Loader.isModLoaded(CompatUtil.NEI_MOD_ID)){
if(Loader.isModLoaded("NotEnoughItems")){
Util.registerEvent(new NeiScreenEvents());
}

View file

@ -12,12 +12,10 @@ package ellpeck.actuallyadditions.nei;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.IRecipeHandler;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import ellpeck.actuallyadditions.booklet.GuiBooklet;
import ellpeck.actuallyadditions.booklet.InitBooklet;
import ellpeck.actuallyadditions.booklet.page.BookletPage;
import ellpeck.actuallyadditions.util.CompatUtil;
import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.client.Minecraft;
@ -30,7 +28,6 @@ public class NeiScreenEvents{
private static final int NEI_BUTTON_ID = 123782;
private GuiBooklet.TexturedButton neiButton;
@Optional.Method(modid = CompatUtil.NEI_MOD_ID)
@SuppressWarnings("unchecked")
@SubscribeEvent
public void onInitGuiForNEI(GuiScreenEvent.InitGuiEvent event){
@ -53,11 +50,11 @@ public class NeiScreenEvents{
};
event.buttonList.add(this.neiButton);
this.neiButton.visible = theGui.getCurrentRecipeHandlers().get(theGui.recipetype) instanceof INeiRecipeHandler;
IRecipeHandler handler = theGui.getCurrentRecipeHandlers().get(theGui.recipetype);
this.neiButton.visible = handler instanceof INeiRecipeHandler && ((INeiRecipeHandler)handler).getStackForInfo() != null;
}
}
@Optional.Method(modid = CompatUtil.NEI_MOD_ID)
@SubscribeEvent
public void guiPostAction(GuiScreenEvent.ActionPerformedEvent.Post event){
if(this.neiButton != null && event.gui instanceof GuiRecipe){

View file

@ -19,8 +19,6 @@ import net.minecraft.nbt.NBTTagCompound;
public class CompatUtil{
public static final String NEI_MOD_ID = "NotEnoughItems";
public static void registerMFRPlant(Block block){
FMLInterModComms.sendMessage("MineFactoryReloaded", "registerHarvestable_Crop", new ItemStack(block, 1, 7));