2016-06-03 16:56:13 -07:00
|
|
|
package WayofTime.bloodmagic.compat.guideapi;
|
|
|
|
|
2016-06-16 15:40:44 -04:00
|
|
|
import net.minecraft.init.Blocks;
|
2016-06-03 16:56:13 -07:00
|
|
|
import net.minecraft.init.Items;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2016-08-26 19:03:43 -07:00
|
|
|
import net.minecraft.item.crafting.CraftingManager;
|
|
|
|
import net.minecraft.item.crafting.IRecipe;
|
2016-06-04 13:56:02 -07:00
|
|
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
2016-06-03 16:56:13 -07:00
|
|
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
2016-06-04 13:56:02 -07:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
2016-06-16 15:40:44 -04:00
|
|
|
import WayofTime.bloodmagic.compat.ICompatibility;
|
|
|
|
import amerifrance.guideapi.api.GuideAPI;
|
2016-08-26 19:03:43 -07:00
|
|
|
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
2016-06-03 16:56:13 -07:00
|
|
|
|
2016-06-16 15:40:44 -04:00
|
|
|
public class CompatibilityGuideAPI implements ICompatibility
|
|
|
|
{
|
2016-08-26 19:03:43 -07:00
|
|
|
private static IRecipe guideRecipe = null;
|
|
|
|
private static boolean worldFlag;
|
2016-06-03 16:56:13 -07:00
|
|
|
|
|
|
|
@Override
|
2016-06-16 15:40:44 -04:00
|
|
|
public void loadCompatibility(InitializationPhase phase)
|
|
|
|
{
|
|
|
|
switch (phase)
|
|
|
|
{
|
|
|
|
case PRE_INIT:
|
|
|
|
{
|
|
|
|
GuideBloodMagic.initBook();
|
|
|
|
GameRegistry.register(GuideBloodMagic.guideBook);
|
|
|
|
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
|
|
|
GuideAPI.setModel(GuideBloodMagic.guideBook);
|
2016-06-04 13:56:02 -07:00
|
|
|
|
2016-06-16 15:40:44 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case INIT:
|
|
|
|
{
|
2016-08-26 19:03:43 -07:00
|
|
|
guideRecipe = new ShapelessOreRecipe(GuideAPI.getStackFromBook(GuideBloodMagic.guideBook), new ItemStack(Items.BOOK), Blocks.GLASS, Items.FEATHER);
|
2016-06-16 15:40:44 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case POST_INIT:
|
|
|
|
{
|
2016-07-21 10:36:16 -04:00
|
|
|
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
|
|
|
GuideBloodMagic.initCategories();
|
2016-06-16 15:40:44 -04:00
|
|
|
break;
|
|
|
|
}
|
2016-08-26 19:03:43 -07:00
|
|
|
case MAPPING:
|
|
|
|
{
|
|
|
|
if (!worldFlag) {
|
|
|
|
GameRegistry.addRecipe(guideRecipe);
|
|
|
|
worldFlag = true;
|
|
|
|
} else {
|
|
|
|
CraftingManager.getInstance().getRecipeList().remove(guideRecipe);
|
|
|
|
worldFlag = false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2016-06-03 16:56:13 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-06-16 15:40:44 -04:00
|
|
|
public String getModId()
|
|
|
|
{
|
2016-06-03 16:56:13 -07:00
|
|
|
return "guideapi";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-06-16 15:40:44 -04:00
|
|
|
public boolean enableCompat()
|
|
|
|
{
|
2016-06-03 16:56:13 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|