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

This is my first time modding and I'm most probably doing something stupid, But I'm trying to make it so my custom ore is able to be smelted into my custom ingot, I'm following the tutorial on the wiki so it is 'genericOre' and 'genericIngot'. Usually you put

 

GameRegistry.addSmelting(Block.dirt.blockID, diamondstack, 0.1f);

 

But I have no idea how to put in my genericOre and genericIngot? This is the class file to my Generic Ingot and Generic Ore:

 

package kamber56.tutorial;

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.monster.EntityCreeper;

import net.minecraft.entity.monster.EntityZombie;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

 

public class GenericItem extends Item {

 

public GenericItem(int id) {

super(id);

 

setMaxStackSize(64);

setCreativeTab(CreativeTabs.tabMisc);

setUnlocalizedName("genericItem");

setTextureName(BasicInfo.NAME.toLowerCase() + ":genericItem");

 

}

 

}

 

 

 

 

 

package kamber56.tutorial;

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.monster.EntityCreeper;

import net.minecraft.entity.monster.EntityZombie;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

 

public class GenericIngot extends Item {

 

public GenericIngot(int id) {

super(id);

 

setMaxStackSize(64);

setCreativeTab(CreativeTabs.tabMaterials);

setUnlocalizedName("genericIngot");

setTextureName("Basic:genericIngot");

 

}

 

 

}

 

I also have in the Load eventhandler this:

 

GameRegistry.registerItem(genericItem, "genericItem");

LanguageRegistry.addName(genericItem, "Generic Item");

 

 

GameRegistry.registerBlock(genericOre, "genericOre");

LanguageRegistry.addName(genericOre, "Generic Ore");

MinecraftForge.setBlockHarvestLevel(genericOre, "pickaxe", 3);

 

 

Any help would be appreciated!

 

[Edit] A Pastebin link to the 3 classes http://pastebin.com/ZWc2LUkv

First of all, there is no such thing as 1.6.5, lol.

 

It's the same exact thing... look at addSmelting's Declaration its:

 

void addSmelting(int INPUT, ItemStack OUTPUT, float xp)

 

You can place it like this:

GameRegistry.addSmelting(genericOre.itemID, new ItemStack(genericIngot, 1), 0.1F);

 

This should be pretty simple and self explanatory, imo.

 

  • Author

Ah, thanks! I just assumed that it always had to have Block. In front of it. And I have no idea where I got 1.6.5 from :L

LOL, anytime bud, anytime.

 

Block is just getting the class file from Minecraft, to retrieve the dirt block and set it as an ID, it just has to be the ID number of the block.

Try learning more Java before starting to mod, you'll need it.

  • Author

I've got a similar problem now, I'm trying to make it so that my genericItem is made when I put 3 genericIngots in a line in the crafting bench. It comes up with no errors in eclipse but when I launch Minecraft it says :

 

java.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Character

2014-02-13 17:28:22 [iNFO] [sTDOUT] at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:187)

2014-02-13 17:28:22 [iNFO] [sTDOUT] at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:245)

2014-02-13 17:28:22 [iNFO] [sTDOUT] at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:240)

2014-02-13 17:28:22 [iNFO] [sTDOUT] at kamber56.tutorial.Basic.load(Basic.java:80)

 

Here is the code I'm using. And it's this line which is causing it as when I remove it it launches fine.

GameRegistry.addRecipe(new ItemStack(genericItem, 1), " x ", " x ", " x ",

'x', new ItemStack(genericIngot, 1), 0.1F);

 

(And yeah I sort of went straight into playing around with making a mod because it seemed a lot more fun than following 100 or so YouTube tutorials on learning Java fully :P)

 

[EDIT] Managed to fix it! I Just made the ItemStacks above it; separate from the GameRegistry.addrecipe

 

ItemStack genericItemStack = new ItemStack(genericItem);

ItemStack genericIngotStack = new ItemStack(genericIngot);

 

GameRegistry.addRecipe(genericItemStack, " x ", " x ", " x ",

'x', genericIngotStack);

 

 

It would be cool if someone could explain what I've done wrong and how that's fixed itself?

[EDIT2] Managed to find out, It was the 0.1F making it crash

I'm also kinda noob at modding but here's my code.

 

 

 

GameRegistry.addRecipe(new ItemStack(sword),

" x ",

" x ",

" / ",

 

'x', Items.ingot,

'/', net.minecraft.init.Items.stick);

 

 

 

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.