本文整理匯總了Java中net.minecraftforge.oredict.ShapelessOreRecipe類的典型用法代碼示例。如果您正苦於以下問題:Java ShapelessOreRecipe類的具體用法?Java ShapelessOreRecipe怎麽用?Java ShapelessOreRecipe使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ShapelessOreRecipe類屬於net.minecraftforge.oredict包,在下文中一共展示了ShapelessOreRecipe類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getToolHeadSchematicRecipe
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
private static IRecipe getToolHeadSchematicRecipe(ItemStack output, String material, String type, int cost) {
NonNullList<Ingredient> inputs = NonNullList.withSize(cost + 1, Ingredient.EMPTY);
ItemStack schematic = new ItemStack(ModItems.schematic);
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString(ItemSchematic.type_tag, type);
schematic.setTagCompound(nbt);
Ingredient schematicIngredient = new IngredientNBT(schematic) {
};
inputs.set(0, schematicIngredient);
for (int i = 1; i <= cost; i++) {
inputs.set(i, new OreIngredient(material));
}
return new ShapelessOreRecipe(null, inputs, output);
}
示例2: matchesInput
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
private boolean matchesInput(ShapelessOreRecipe recipe)
{
if (recipe.getIngredients().size() != getRecipeSize())
return false;
Object[] input = getRecipeInput();
for (int i = 0; i < recipe.getIngredients().size(); i++)
{
Ingredient target = recipe.getIngredients().get(i);
Object source = input[i];
if (!ItemHelper.isSameRecipeInput(target, source))
return false;
}
return true;
}
示例3: convert
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
public static JsonBrickOvenShapelessRecipe convert(ShapelessOreRecipe recipe)
{
List<Object> inputs = new ArrayList<>();
for (Object obj : recipe.getIngredients())
{
if (obj instanceof ItemStack)
{
inputs.add(obj);
}
else if (obj instanceof List)
{
try
{
@SuppressWarnings("unchecked")
String ore = RegistryUtil.getCommonOreDictName((List<ItemStack>)obj);
inputs.add(ore);
}
catch (ClassCastException ex)
{
LogUtil.log(Level.ERROR, "Failed to cast list in ore dictionary conversion: " + ex.toString());
}
}
}
return new JsonBrickOvenShapelessRecipe(recipe.getRecipeOutput(), inputs);
}
示例4: registerRecipe
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
public static void registerRecipe(final Class<? extends IRecipe> recipe) {
if (ExtraUtils.registeredRecipes.contains(recipe)) {
return;
}
if (!recipe.getName().startsWith("com.rwtema.")) {
return;
}
ExtraUtils.registeredRecipes.add(recipe);
LogHelper.fine("Registering " + recipe.getSimpleName() + " to RecipeSorter", new Object[0]);
if (ShapedOreRecipe.class.isAssignableFrom(recipe)) {
RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPED, "after:forge:shapedore");
}
else if (ShapelessOreRecipe.class.isAssignableFrom(recipe)) {
RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:forge:shapelessore");
}
else if (ShapedRecipes.class.isAssignableFrom(recipe)) {
RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPED, "after:minecraft:shaped before:minecraft:shapeless");
}
else if (ShapelessRecipes.class.isAssignableFrom(recipe)) {
RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless before:minecraft:bookcloning");
}
else {
RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:forge:shapelessore");
}
}
示例5: loadCraftingRecipes
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("crafting") && getClass() == ShapelessRecipeHandler.class) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes)
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
else if (irecipe instanceof ShapelessOreRecipe)
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
if (recipe == null)
continue;
arecipes.add(recipe);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
示例6: loadUsageRecipes
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
@Override
public void loadUsageRecipes(ItemStack ingredient) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes)
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
else if (irecipe instanceof ShapelessOreRecipe)
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
if (recipe == null)
continue;
if (recipe.contains(recipe.ingredients, ingredient)) {
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
arecipes.add(recipe);
}
}
}
示例7: buildHandlerMap
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
private static void buildHandlerMap()
{
// RecipesMapExtending extends ShapedRecipes, and causes a crash when attempting to uncraft a map
HANDLERS.put(RecipesMapExtending.class, null);
// vanilla Minecraft recipe handlers
HANDLERS.put(ShapedRecipes.class, new ShapedRecipeHandler());
HANDLERS.put(ShapelessRecipes.class, new ShapelessRecipeHandler());
HANDLERS.put(RecipeFireworks.class, new FireworksRecipeHandler());
HANDLERS.put(RecipeTippedArrow.class, new TippedArrowRecipeHandler());
// Forge Ore Dictionary recipe handlers
HANDLERS.put(ShapedOreRecipe.class, new ShapedOreRecipeHandler());
HANDLERS.put(ShapelessOreRecipe.class, new ShapelessOreRecipeHandler());
// cofh recipe handlers
if (CoFHRecipeHandlers.CoverRecipeHandler.recipeClass != null) HANDLERS.put(CoFHRecipeHandlers.CoverRecipeHandler.recipeClass, new CoFHRecipeHandlers.CoverRecipeHandler());
// industrialcraft 2 recipe handlers
if (ShapedIC2RecipeHandler.recipeClass != null) HANDLERS.put(ShapedIC2RecipeHandler.recipeClass, new ShapedIC2RecipeHandler());
if (ShapelessIC2RecipeHandler.recipeClass != null) HANDLERS.put(ShapelessIC2RecipeHandler.recipeClass, new ShapelessIC2RecipeHandler());
// tinker's construct recipe handlers
if (TinkersRecipeHandlers.TableRecipeHandler.recipeClass != null) HANDLERS.put(TinkersRecipeHandlers.TableRecipeHandler.recipeClass, new TinkersRecipeHandlers.TableRecipeHandler());
}
示例8: getCraftingGrid
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
@Override
public NonNullList<ItemStack> getCraftingGrid(IRecipe r)
{
// cast the IRecipe instance
ShapelessOreRecipe shapelessRecipe = (ShapelessOreRecipe)r;
// get a copy of the recipe items with normalised metadata
NonNullList<ItemStack> recipeStacks = copyRecipeStacks(shapelessRecipe.getIngredients()); // copyRecipeStacks(getOreRecipeItems(shapelessRecipe.getIngredients()));
if (!recipeStacks.isEmpty())
{
// return the itemstacks
return recipeStacks;
}
else return NonNullList.<ItemStack>create();
}
示例9: init
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
public static void init() {
GameRegistry.addRecipe(new RecipeScrewDriver());
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.LENS, 3), "AAA", 'A', "blockGlass"));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.REFLECTIVE_ALLOY, 2), Items.IRON_INGOT, Items.GOLD_INGOT));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.ASSEMBLY_TABLE), "ABA", "A A", "AAA", 'A', "ingotIron", 'B', ModBlocks.LENS));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.MAGNIFIER), "ABA", "A A", "A A", 'A', "ingotIron", 'B', ModBlocks.LENS));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.SCREW_DRIVER), " AA", " BA", "B ", 'A', "ingotIron", 'B', Items.STICK));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.LASER_PEN), " A", " BC", "D ", 'A', Blocks.STONE_BUTTON, 'B', "dustRedstone", 'C', "ingotIron", 'D', "blockGlass"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.REFLECTIVE_ALLOY_BLOCK), "AAA", "AAA", "AAA", 'A', ModItems.REFLECTIVE_ALLOY));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.GRENADE, 3), " A ", "ABA", " A ", 'A', ModItems.REFLECTIVE_ALLOY, 'B', Blocks.TNT));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.HELMET), "AAA", "A A", " ", 'A', ModItems.REFLECTIVE_ALLOY));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.CHESTPLATE), "A A", "AAA", "AAA", 'A', ModItems.REFLECTIVE_ALLOY));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.LEGGINGS), "AAA", "A A", "A A", 'A', ModItems.REFLECTIVE_ALLOY));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.BOOTS), " ", "A A", "A A", 'A', ModItems.REFLECTIVE_ALLOY));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.LIGHT_CARTRIDGE), " A ", "ABA", " A ", 'A', ModItems.REFLECTIVE_ALLOY, 'B', Blocks.GLASS_PANE));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.SPECTROMETER), "ABC", "DEF", "DDD", 'A', "dyeRed", 'B', "dyeGreen", 'C', "dyeBlue", 'D', "ingotIron", 'F', "paneGlass", 'E', LibOreDict.REFLECTIVE_ALLOY));
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.BOOK), ModItems.LASER_PEN, Items.BOOK);
if (!ConfigValues.DISABLE_PHOTON_CANNON)
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.PHOTON_CANNON), " BA", "CDB", "EC ", 'A', ModBlocks.LENS, 'B', ModBlocks.MIRROR, 'C', ModItems.REFLECTIVE_ALLOY, 'D', ModBlocks.ELECTRON_EXCITER, 'E', ModBlocks.SENSOR));
}
示例10: setup
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
static void setup() {
if (is_setup) return;
is_setup = true;
reg(ItemStack.class, new WriteItemStack());
reg(Item.class, new WriteItem());
reg(Block.class, new WriteBlock());
reg(String.class, new WriteStringOreDictionary());
reg(Number.class, new WriteObjectToString());
reg(NBTBase.class, new WriteObjectToString());
reg(FluidStack.class, new WriteFluidStack());
reg(Fluid.class, new WriteFluid());
reg(Collection.class, new WriteCollection());
// IRecipe: "embedded IRecipe"; haven't seen it crop up tho
reg(ShapedOreRecipe.class, new WriteShapedOreRecipe());
reg(ShapedRecipes.class, new WriteShapedRecipe());
reg(ShapelessOreRecipe.class, new WriteShapelessOreRecipe());
reg(ShapelessRecipes.class, new WriteShapelessRecipe());
reg(Map.Entry.class, new WriteEntry());
IObjectWriter.adapter.register(new ArrayAdapter());
IObjectWriter.adapter.setFallbackAdapter(new GenericAdapter<Object, IObjectWriter>(Object.class, new ReflectionWriter()));
}
示例11: loadCraftingRecipes
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("crafting") && getClass() == ShapelessRecipeHandler.class) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes) {
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
} else if (irecipe instanceof ShapelessOreRecipe) {
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
}
if (recipe == null) {
continue;
}
arecipes.add(recipe);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
示例12: loadUsageRecipes
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
@Override
public void loadUsageRecipes(ItemStack ingredient) {
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes) {
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
} else if (irecipe instanceof ShapelessOreRecipe) {
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
}
if (recipe == null) {
continue;
}
if (recipe.contains(recipe.ingredients, ingredient)) {
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
arecipes.add(recipe);
}
}
}
示例13: register
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
@Override
public void register() {
super.register();
final List<ItemStack> input = new ArrayList<ItemStack>();
input.add(new ItemStack(ItemManager.material, 1, Material.RTG_HOUSING));
final ItemStack cell = new ItemStack(ItemManager.material, 1, Material.FUEL_CELL);
for (int i = 1; i < 9; i++) {
input.add(cell);
final ItemStack rtg = new ItemStack(ItemManager.energyCell, 1, RTGEnergyCell.RTG);
RTGEnergyCell.initialize(rtg, i);
final ShapelessOreRecipe shapeless = new ShapelessOreRecipe(rtg, input.toArray());
GameRegistry.addRecipe(shapeless);
}
}
示例14: getRecipes
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
@Override
public List<RecipeLink> getRecipes() {
List<RecipeLink> a = new ArrayList<RecipeLink>();
for (Object obj : RecipeRegistry.vanillaCrafting.get(ShapelessOreRecipe.class)) {
ShapelessOreRecipe recipe = (ShapelessOreRecipe) obj;
RecipeLink link = new RecipeLink();
for (Object stack : recipe.getInput()) {
if (stack!=null) {
link.inputs.add(new ItemDataStack(RecipeRegistry.flatten(stack)));
}
}
link.outputs.add(new ItemDataStack(recipe.getRecipeOutput()));
a.add(link);
}
return a;
}
示例15: addShapeless
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入依賴的package包/類
@ZenMethod
public static void addShapeless(IItemStack output, IIngredient[] inputs) {
if (inputs == null) {
MineTweakerAPI.getLogger().logError("Large Furnace: Input set must not be null!");
return;
}
if (inputs.length == 0) {
MineTweakerAPI.getLogger().logError("Large Furnace: Input set must not empty!");
return;
}
if (output == null) {
MineTweakerAPI.getLogger().logError("Large Furnace: Output must not be null!");
return;
}
ShapelessOreRecipe recipe = constructSafely(toStack(output), toObjects(inputs));
if (recipe == null) {
MineTweakerAPI.getLogger().logError("Large Furnace: Illegal recipe.");
return;
}
MineTweakerAPI.apply(new FurnaceAdd(output, recipe));
}