Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

minecraftdotjarrr

Members
  • Posts

    52
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

minecraftdotjarrr's Achievements

Stone Miner

Stone Miner (3/8)

1

Reputation

  1. I did not manage to find the method that returns: "tile. + classvariable" Here is the code with every thing I have I will post my Item code that I have too, just incase there is something wrong there too, and I am sorry if my code is not perfect and or messy. Main Class package com.somemorefood.friendlyunicorns; import net.minecraft.block.Block; import net.minecraft.item.Item; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = Reference.MODID, version = Reference.VERSION) public class SomeMoreFood { public static Block exampleBlock; public static Item grannySmith; @EventHandler public void preInit(FMLPreInitializationEvent event) { grannySmith = new ItemGrannySmith(); RegisterHelper.registerItem(grannySmith); exampleBlock = new BlockExampleBlock(); RegisterHelper.registerBlock(exampleBlock); } } Register Helper package com.somemorefood.friendlyunicorns; import net.minecraft.block.Block; import net.minecraft.item.Item; import cpw.mods.fml.common.registry.GameRegistry; public class RegisterHelper { public static void registerBlock(Block block) { GameRegistry.registerBlock(block, Reference.MODID + block.getUnlocalizedName().substring(5)); } public static void registerItem(Item item) { GameRegistry.registerItem(item, Reference.MODID + item.getUnlocalizedName().substring(5)); } } My Item Class (Granny Smith Apple, Not done yet, but I did by the way add it in successfully) package com.somemorefood.friendlyunicorns; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; public class ItemGrannySmith extends ItemFood { public ItemGrannySmith () { super(4, 0.5F, false); setUnlocalizedName ("grannySmith"); setTextureName (Reference.MODID + ":" + getUnlocalizedName().substring(5)); setCreativeTab(CreativeTabs.tabFood); } } Example Bock, there is another problem with this class too, I cannot add the material type (error). I think due to the register block, correct me if I am wrong. package com.somemorefood.friendlyunicorns; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class BlockExampleBlock extends Block { public BlockExampleBlock() { super(Material.rock); } }
  2. No I don't. Block is: net.minecraft.block.Block block is: com.somemorefood.friendlyunicorns.RegisterHelper.registerBlock(Block) Main: package com.somemorefood.friendlyunicorns; import net.minecraft.block.Block; import net.minecraft.item.Item; import cpw.mods.fml.common.registry.GameRegistry;
  3. Main@Mod(modid = Reference.MODID, version = Reference.VERSION) public class SomeMoreFood { public static Block exampleBlock; public static Item grannySmith; @EventHandler public void preInit(FMLPreInitializationEvent event) { grannySmith = new ItemGrannySmith(); RegisterHelper.registerItem(grannySmith); exampleBlock = new BlockExampleBlock(); RegisterHelper.registerBlock(exampleBlock); } } Register Helper Class package com.somemorefood.friendlyunicorns; import net.minecraft.block.Block; import net.minecraft.item.Item; import cpw.mods.fml.common.registry.GameRegistry; public class RegisterHelper { public static void registerBlock(Block block) { GameRegistry.registerBlock(block, Reference.MODID + block.getUnlocalizedName().substring(5)); } public static void registerItem(Item item) { GameRegistry.registerItem(item, Reference.MODID + item.getUnlocalizedName().substring(5)); } }
  4. In this piece of code? GameRegistry.registerBlock(block, Reference.MODID + "_" + block.getUnlocalizedName().substring(5)); Because I thought it had to be like that lol, but thanks for pointing that out.
  5. I mean, there were ones that were similar but I could not find the same one. But there are 1.7.2. tutorials that do the same thing. I don't know, thank you for taking your time and trying to help me out.
  6. But do you have any idea what this means or in other words why is it saying this: The method getUnlocalizedName() is undefined for the type Block.
  7. I did change it back, as I was just trying to do what ever I could think of.
  8. No you are not! I just can't see what is wrong with it either. The method getUnlocalizedName() is undefined for the type Block I noticed "Block" has an uppercase letter at the start (in the error message). So I was like okay ill just change: block.getUnlocalizedName() to Block.getUnlocalizedName() but that made no difference.
  9. package com.somemorefood.friendlyunicorns; import net.minecraft.block.Block; import net.minecraft.item.Item; import cpw.mods.fml.common.registry.GameRegistry; public class RegisterHelper { public static void registerBlock(Block block) { GameRegistry.registerBlock(block, Reference.MODID + "_" + block.getUnlocalizedName().substring(5)); } public static void registerItem(Item item) { GameRegistry.registerItem(item, Reference.MODID + "_" + item.getUnlocalizedName().substring(5)); } }
  10. As I feel very dumb spelling my title and Unlocalized wrong, I spelled it wrong when I was giving the example. So first off I am sorry for that. But for when I do spell it right: GameRegistry.registerBlock(Block, Reference.MODID + "_" + block.getUnlocalizedName().substring(5)); I still do get the same error, it says that: The method getUnlocalizedName() is undefined for the type Block. And the solution that it suggests is that I should add a cast to block. This post made me look very dumb and I could tell you that over and over again lol, but I do know that eclipse has a auto correct sort of thing that you were talking about and I do know how to use it. getUnlocalizedName() was not an option when I wrote: block. Thank you and sorry again for this horrible mistake.
  11. Hello! I am trying to add a block to the game, as you can tell and I had a question about this piece of code: GameRegistry.registerBlock(block, Reference.MODID + "_" + block.getUnlocalizedName() .substring(5)); in particular; the block.getUnlocalizedName() .getUnlocalizedName is underlined red and says: The method getUnlocalizedName() is undefined for the type Block. Now that confuses me because didn't we just register Block in: public void registerBlock (Block block) Anyways I have added a item using: public static void registerItem(Item item) { GameRegistry.registerItem(item, Reference.MODID + "_" + item.getUnlocalizedName().substring(5)); } and it worked fine. Another thing is that when I go into my block class and try to change the "material" it does not display the actual types it displays the functions. Sorry in advance for this very stupid question, but I don't know what to do about it. If anyone could tell me what I am doing wrong that would be wonderful, thank you!
  12. do you think this may be the problem? par2World.spawnEntityInWorld(new VikingSword_Entity(par2World, par3EntityPlayer));?
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.