use of net.minecraftforge.oredict.ShapedOreRecipe in project TechReborn by TechReborn.
the class RollingMachineRecipe method addShapedOreRecipe.
public void addShapedOreRecipe(ResourceLocation resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
Validate.notNull(outputItemStack);
Validate.notNull(outputItemStack.getItem());
if (objectInputs.length == 0) {
// Quick way to crash
Validate.notNull(null);
}
recipes.put(resourceLocation, new ShapedOreRecipe(resourceLocation, outputItemStack, objectInputs));
}
use of net.minecraftforge.oredict.ShapedOreRecipe in project TechReborn by TechReborn.
the class GuiAutoCrafting method renderRecipe.
// Based of vanilla code
public void renderRecipe(IRecipe recipe, int x, int y) {
RenderHelper.enableGUIStandardItemLighting();
GlStateManager.enableAlpha();
mc.getTextureManager().bindTexture(RECIPE_BOOK_TEXTURE);
this.drawTexturedModalRect(x, y, 152, 78, 24, 24);
int recipeWidth = 3;
int recipeHeight = 3;
if (recipe instanceof ShapedRecipes) {
ShapedRecipes shapedrecipes = (ShapedRecipes) recipe;
recipeWidth = shapedrecipes.getWidth();
recipeHeight = shapedrecipes.getHeight();
}
if (recipe instanceof ShapedOreRecipe) {
ShapedOreRecipe shapedrecipes = (ShapedOreRecipe) recipe;
recipeWidth = shapedrecipes.getRecipeWidth();
recipeHeight = shapedrecipes.getRecipeHeight();
}
Iterator<Ingredient> ingredients = recipe.getIngredients().iterator();
for (int rHeight = 0; rHeight < recipeHeight; ++rHeight) {
int j1 = 3 + rHeight * 7;
for (int rWidth = 0; rWidth < recipeWidth; ++rWidth) {
if (ingredients.hasNext()) {
ItemStack[] aitemstack = ingredients.next().getMatchingStacks();
if (aitemstack.length != 0) {
int l1 = 3 + rWidth * 7;
GlStateManager.pushMatrix();
int i2 = (int) ((float) (x + l1) / 0.42F - 3.0F);
int j2 = (int) ((float) (y + j1) / 0.42F - 3.0F);
GlStateManager.scale(0.42F, 0.42F, 1.0F);
GlStateManager.enableLighting();
mc.getRenderItem().renderItemAndEffectIntoGUI(aitemstack[0], i2, j2);
GlStateManager.disableLighting();
GlStateManager.popMatrix();
}
}
}
}
GlStateManager.disableAlpha();
RenderHelper.disableStandardItemLighting();
}
use of net.minecraftforge.oredict.ShapedOreRecipe in project Metalworks by canitzp.
the class ItemToolCollection method registerRecipes.
public void registerRecipes(final Map<ResourceLocation, IRecipe> recipes, Object ingotStackOrString) {
recipes.put(new ResourceLocation(Metalworks.MODID, "pickaxe_" + this.material.name()), new ShapedOreRecipe(null, pickaxe, "mmm", " s ", " s ", 'm', ingotStackOrString, 's', "stickWood"));
recipes.put(new ResourceLocation(Metalworks.MODID, "axe_" + this.material.name()), new ShapedOreRecipe(null, axe, "mm", "ms", " s", 'm', ingotStackOrString, 's', "stickWood"));
recipes.put(new ResourceLocation(Metalworks.MODID, "sword_" + this.material.name()), new ShapedOreRecipe(null, sword, "m", "m", "s", 'm', ingotStackOrString, 's', "stickWood"));
recipes.put(new ResourceLocation(Metalworks.MODID, "shovel_" + this.material.name()), new ShapedOreRecipe(null, shovel, "m", "s", "s", 'm', ingotStackOrString, 's', "stickWood"));
}
use of net.minecraftforge.oredict.ShapedOreRecipe in project EnderIO by SleepyTrousers.
the class MaterialRecipes method register.
@SubscribeEvent
public static void register(@Nonnull RegistryEvent.Register<IRecipe> event) {
final IForgeRegistry<IRecipe> registry = event.getRegistry();
for (Alloy alloy : Alloy.values()) {
registry.register(new ShapedOreRecipe(null, alloy.getStackBlock(), "iii", "iii", "iii", 'i', alloy.getOreIngot()).setRegistryName(Crafting.mkRL("Auto: " + alloy.getBaseName() + " 1 block to 9 ingots")));
registry.register(new ShapelessOreRecipe(null, alloy.getStackIngot(9), alloy.getOreBlock()).setRegistryName(Crafting.mkRL("Auto: " + alloy.getBaseName() + " 9 ingots to 1 block")));
registry.register(new ShapedOreRecipe(null, alloy.getStackIngot(), "nnn", "nnn", "nnn", 'n', alloy.getOreNugget()).setRegistryName(Crafting.mkRL("Auto: " + alloy.getBaseName() + " 9 nuggets to 1 ingot")));
registry.register(new ShapelessOreRecipe(null, alloy.getStackNugget(9), alloy.getStackIngot()).setRegistryName(Crafting.mkRL("Auto: " + alloy.getBaseName() + " 1 ingot to 9 nuggets")));
}
for (EnumDyeColor color : EnumDyeColor.values()) {
for (FusedQuartzType type : FusedQuartzType.values()) {
registry.register(new ShapedOreRecipe(null, new ItemStack(type.getBlock(), 8, color.getMetadata()), "GGG", "CGG", "GGG", 'G', type.getOreDictName(), 'C', "dye" + MaterialOredicts.dyes[color.getDyeDamage()]).setRegistryName(Crafting.mkRL("Auto: Coloring " + type.getName() + " with " + color.getUnlocalizedName())));
}
}
registry.register(new NutritiousStickRecipe().setRegistryName(Crafting.mkRL("Auto: NutritiousStickRecipe")));
}
use of net.minecraftforge.oredict.ShapedOreRecipe in project GregTech by GregTechCE.
the class ModHandler method addMirroredShapedRecipe.
// /////////////////////////////////////////////////
// Crafting Recipe Helpers //
// /////////////////////////////////////////////////
/**
* Adds Shaped Crafting Recipes.
* <p/>
* MetaValueItem's are converted to ItemStack via {@link MetaItem.MetaValueItem#getStackForm()} method.
* <p/>
* For Enums - {@link Enum#name()} is called.
* <p/>
* For UnificationEntry - {@link UnificationEntry#toString()} is called.
* <p/>
* Lowercase Letters are reserved for Tools. They are as follows:
* <p/>
* <ul>
* <li>'b' - ToolDictNames.craftingToolBlade</li>
* <li>'c' - ToolDictNames.craftingToolCrowbar</li>
* <li>'d' - ToolDictNames.craftingToolScrewdriver</li>
* <li>'f' - ToolDictNames.craftingToolFile</li>
* <li>'h' - ToolDictNames.craftingToolHardHammer</li>
* <li>'i' - ToolDictNames.craftingToolSolderingIron</li>
* <li>'j' - ToolDictNames.craftingToolSolderingMetal</li>
* <li>'k' - ToolDictNames.craftingToolKnife</li>
* <li>'m' - ToolDictNames.craftingToolMortar</li>
* <li>'p' - ToolDictNames.craftingToolDrawplate</li>
* <li>'r' - ToolDictNames.craftingToolSoftHammer</li>
* <li>'s' - ToolDictNames.craftingToolSaw</li>
* <li>'w' - ToolDictNames.craftingToolWrench</li>
* <li>'x' - ToolDictNames.craftingToolWireCutter</li>
* </ul>
*/
public static void addMirroredShapedRecipe(String regName, ItemStack result, Object... recipe) {
result = OreDictUnifier.getUnificated(result);
boolean skip = false;
if (result.isEmpty()) {
GTLog.logger.error("Result cannot be an empty ItemStack. Recipe: {}", regName);
GTLog.logger.error("Stacktrace:", new IllegalArgumentException());
skip = true;
}
skip |= validateRecipe(regName, recipe);
if (skip) {
RecipeMap.setFoundInvalidRecipe(true);
return;
}
IRecipe shapedOreRecipe = new ShapedOreRecipe(new ResourceLocation(GTValues.MODID, "general"), result.copy(), finalizeShapedRecipeInput(recipe)).setMirrored(true).setRegistryName(regName);
ForgeRegistries.RECIPES.register(shapedOreRecipe);
}
Aggregations