ActuallyAdditions/src/main/java/ellpeck/actuallyadditions/util/Util.java

43 lines
1.4 KiB
Java
Raw Normal View History

2015-08-29 14:33:25 +02:00
/*
* This file ("Util.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* <EFBFBD> 2015 Ellpeck
*/
2015-03-07 12:51:28 +01:00
package ellpeck.actuallyadditions.util;
import cpw.mods.fml.common.FMLCommonHandler;
2015-07-01 21:32:48 +02:00
import net.minecraft.block.BlockDispenser;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
import net.minecraft.item.Item;
2015-08-28 21:17:09 +02:00
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
2015-08-28 21:17:09 +02:00
import java.util.List;
@SuppressWarnings("unused")
2014-12-20 21:34:07 +01:00
public class Util{
public static final int WILDCARD = OreDictionary.WILDCARD_VALUE;
public static void registerEvent(Object o){
MinecraftForge.EVENT_BUS.register(o);
2015-03-31 20:37:55 +02:00
FMLCommonHandler.instance().bus().register(o);
}
2015-07-01 21:32:48 +02:00
public static void registerDispenserHandler(Item item, BehaviorDefaultDispenseItem handler){
BlockDispenser.dispenseBehaviorRegistry.putObject(item, handler);
2015-07-01 21:32:48 +02:00
}
2015-08-28 21:17:09 +02:00
public static IRecipe lastIRecipe(){
2015-08-28 21:17:09 +02:00
List list = CraftingManager.getInstance().getRecipeList();
Object recipe = list.get(list.size()-1);
return recipe instanceof IRecipe ? (IRecipe)recipe : null;
}
}