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;
|
2014-11-10 16:47:04 +01:00
|
|
|
|
|
2015-03-07 02:23:31 +01:00
|
|
|
|
import cpw.mods.fml.common.FMLCommonHandler;
|
2015-10-03 23:28:32 +02:00
|
|
|
|
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
|
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;
|
2015-03-07 02:23:31 +01:00
|
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2015-02-09 17:25:05 +01:00
|
|
|
|
import net.minecraftforge.oredict.OreDictionary;
|
2014-11-10 16:47:04 +01:00
|
|
|
|
|
2015-10-03 23:28:32 +02:00
|
|
|
|
import java.util.ArrayList;
|
2015-08-28 21:17:09 +02:00
|
|
|
|
import java.util.List;
|
|
|
|
|
|
2015-02-17 16:15:16 +01:00
|
|
|
|
@SuppressWarnings("unused")
|
2014-12-20 21:34:07 +01:00
|
|
|
|
public class Util{
|
2014-11-10 16:47:04 +01:00
|
|
|
|
|
2015-02-09 17:25:05 +01:00
|
|
|
|
public static final int WILDCARD = OreDictionary.WILDCARD_VALUE;
|
|
|
|
|
|
2015-03-07 02:23:31 +01:00
|
|
|
|
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-02-20 22:45:33 +01:00
|
|
|
|
}
|
2015-07-01 21:32:48 +02:00
|
|
|
|
|
|
|
|
|
public static void registerDispenserHandler(Item item, BehaviorDefaultDispenseItem handler){
|
2015-07-02 00:35:38 +02:00
|
|
|
|
BlockDispenser.dispenseBehaviorRegistry.putObject(item, handler);
|
2015-07-01 21:32:48 +02:00
|
|
|
|
}
|
2015-08-28 21:17:09 +02:00
|
|
|
|
|
2015-09-30 19:18:13 +02:00
|
|
|
|
public static int arrayContains(Object[] array, Object obj){
|
|
|
|
|
if(obj != null){
|
|
|
|
|
for(int i = 0; i < array.length; i++){
|
|
|
|
|
if(array[i] != null && (obj == array[i] || array[i].equals(obj))){
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2015-10-03 23:28:32 +02:00
|
|
|
|
|
|
|
|
|
public static class GetRecipes{
|
|
|
|
|
|
|
|
|
|
public static CrusherRecipeRegistry.CrusherRecipe lastCrusherRecipe(){
|
|
|
|
|
ArrayList<CrusherRecipeRegistry.CrusherRecipe> list = CrusherRecipeRegistry.recipes;
|
|
|
|
|
return list.get(list.size()-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IRecipe lastIRecipe(){
|
|
|
|
|
List list = CraftingManager.getInstance().getRecipeList();
|
|
|
|
|
Object recipe = list.get(list.size()-1);
|
|
|
|
|
return recipe instanceof IRecipe ? (IRecipe)recipe : null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-02-17 16:15:16 +01:00
|
|
|
|
}
|