Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hey! Newtime modder here and I am having some trouble with getting recipes to work. I have looked through countless tutorials to see if I am doing anything wrong but to no avail. Here's my code.

 

package nikolater.RiseOfAvnycyn;

import net.minecraft.block.Block;
import net.minecraft.block.Block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod (modid="ROA", name="RiseOfAvnycyn", version="0.0.0")

public class RiseOfAvnycyn {

@Instance(value="ROA")
public static RiseOfAvnycyn instance;

@SidedProxy(clientSide="nikolater.RiseOfAvnycyn.client.ClientProxy", serverSide="nikolater.RiseOfAvnycyn.CommonProxy")
public static CommonProxy proxy;

public static Item bronzeIngot;
public static Item bronzeMeld;

public static Block copperOre;
public static Block tinOre;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	Item bronzeIngot = new GenericItem(64, "BronzeIngot");
	Item bronzeMeld = new GenericItem(64, "BronzeMeld");

	Block copperOre = new GenericBlock(Material.rock, 2.0F, Block.soundTypeStone, "CopperOre", "pickaxe", 1);
	Block tinOre = new GenericBlock(Material.rock, 2.0F, Block.soundTypeStone, "TinOre", "pickaxe", 1);

	GameRegistry.registerItem(bronzeIngot, bronzeIngot.getUnlocalizedName());
	GameRegistry.registerItem(bronzeMeld, bronzeMeld.getUnlocalizedName());

	GameRegistry.registerBlock(copperOre, "CopperOre");
	GameRegistry.registerBlock(tinOre, "TinOre");
}

@EventHandler
public void init(FMLInitializationEvent event) {
	proxy.registerRenderers();


	ItemStack copperOreStack = new ItemStack(RiseOfAvnycyn.copperOre);
	ItemStack tinOreStack = new ItemStack(RiseOfAvnycyn.tinOre);

	GameRegistry.addShapelessRecipe(new ItemStack(RiseOfAvnycyn.bronzeMeld, 4), copperOreStack, copperOreStack, copperOreStack, tinOreStack);

	GameRegistry.addSmelting(RiseOfAvnycyn.bronzeMeld, new ItemStack(RiseOfAvnycyn.bronzeIngot), 1F);

}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {

}

}

Hey! Newtime modder here and I am having some trouble with getting recipes to work. I have looked through countless tutorials to see if I am doing anything wrong but to no avail. Here's my code.

 

package nikolater.RiseOfAvnycyn;

import net.minecraft.block.Block;
import net.minecraft.block.Block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod (modid="ROA", name="RiseOfAvnycyn", version="0.0.0")

public class RiseOfAvnycyn {

@Instance(value="ROA")
public static RiseOfAvnycyn instance;

@SidedProxy(clientSide="nikolater.RiseOfAvnycyn.client.ClientProxy", serverSide="nikolater.RiseOfAvnycyn.CommonProxy")
public static CommonProxy proxy;

public static Item bronzeIngot;
public static Item bronzeMeld;

public static Block copperOre;
public static Block tinOre;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	Item bronzeIngot = new GenericItem(64, "BronzeIngot");
	Item bronzeMeld = new GenericItem(64, "BronzeMeld");

	Block copperOre = new GenericBlock(Material.rock, 2.0F, Block.soundTypeStone, "CopperOre", "pickaxe", 1);
	Block tinOre = new GenericBlock(Material.rock, 2.0F, Block.soundTypeStone, "TinOre", "pickaxe", 1);

	GameRegistry.registerItem(bronzeIngot, bronzeIngot.getUnlocalizedName());
	GameRegistry.registerItem(bronzeMeld, bronzeMeld.getUnlocalizedName());

	GameRegistry.registerBlock(copperOre, "CopperOre");
	GameRegistry.registerBlock(tinOre, "TinOre");
}

@EventHandler
public void init(FMLInitializationEvent event) {
	proxy.registerRenderers();


	ItemStack copperOreStack = new ItemStack(RiseOfAvnycyn.copperOre);
	ItemStack tinOreStack = new ItemStack(RiseOfAvnycyn.tinOre);

	GameRegistry.addShapelessRecipe(new ItemStack(RiseOfAvnycyn.bronzeMeld, 4), copperOreStack, copperOreStack, copperOreStack, tinOreStack);

	GameRegistry.addSmelting(RiseOfAvnycyn.bronzeMeld, new ItemStack(RiseOfAvnycyn.bronzeIngot), 1F);

}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {

}

}

What happens when you run your code?

Does it crash?

If so, give the crash report.

If it doesnt crash, say what happens.

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

  • Author

Its just as I said nothing crashes its just that when I try to use any of the recipes nothing comes up in the result box.

Its just as I said nothing crashes its just that when I try to use any of the recipes nothing comes up in the result box.

First of all, you have to register stuff in the pre-init. Though that shouldn't totally affect it...

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

  • Author

Yeah I had tried registering it in the preInit before but it still didn't wok :(

Yeah I had tried registering it in the preInit before but it still didn't wok :(

Does your smelting work?

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Hi.

 

Are you sure this line is executed?

 

GameRegistry.addShapelessRecipe(new ItemStack(RiseOfAvnycyn.bronzeMeld, 4), copperOreStack, copperOreStack, copperOreStack, tinOreStack);

 

If so, and if you can use the debugger, try putting a breakpoint in here

ShapelessRecipes.matches()

 

It creates a copy of the shapeless recipe list (look in here, see if you can find yours), then iterates through each slot in the crafting container, and for each recipe which doesn't have the right item in the recipe, it deletes it.

 

By comparing your recipe with the crafting entries, you can see why this line isn't matching your recipe:

                        if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getMetadata() == 32767 || itemstack.getMetadata() == itemstack1.getMetadata()))

 

-TGG

 

  • Author

I just decided to look at the log and apparently the registry is not adding any of the recipes that I have made. Any tips for how I would fix that?

  • Author

Ah Yes found it, was being silly and left Item and Block infront... Thank you!

Guest
This topic is now closed to further replies.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.