ActuallyAdditions/src/main/java/ellpeck/actuallyadditions/util/Util.java
2015-08-29 14:33:26 +02:00

43 lines
No EOL
1.4 KiB
Java

/*
* 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
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.util;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.block.BlockDispenser;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import java.util.List;
@SuppressWarnings("unused")
public class Util{
public static final int WILDCARD = OreDictionary.WILDCARD_VALUE;
public static void registerEvent(Object o){
MinecraftForge.EVENT_BUS.register(o);
FMLCommonHandler.instance().bus().register(o);
}
public static void registerDispenserHandler(Item item, BehaviorDefaultDispenseItem handler){
BlockDispenser.dispenseBehaviorRegistry.putObject(item, handler);
}
public static IRecipe lastIRecipe(){
List list = CraftingManager.getInstance().getRecipeList();
Object recipe = list.get(list.size()-1);
return recipe instanceof IRecipe ? (IRecipe)recipe : null;
}
}