Jump to content

minecraftdotjarrr

Members
  • Posts

    52
  • Joined

  • Last visited

Everything posted by minecraftdotjarrr

  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));?
  13. Idk know if im not implementing this right or what, but... sword class! public boolean hitEntity (ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { par3EntityLiving.worldObj.playSoundAtEntity(par3EntityLiving, "brenden:attacking", 1.0F, 1.0F); { par1ItemStack.damageItem(1, par3EntityLiving); return true; } } public ItemStack onItemLeftClick(ItemStack ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { --ItemStack.stackSize; } par2World.playSoundAtEntity(par3EntityPlayer, "brenden:attacking", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new VikingSword_Entity(par2World, par3EntityPlayer)); } return ItemStack; } sound class package brenden.viking; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; public class vikingsound { @ForgeSubscribe public void onSound(SoundLoadEvent event) { try { event.manager.addSound("brenden:attacking.wav"); } catch (Exception e) { System.err.println("Fire sounds error"); } } } Thanks for your time!
  14. addSound("attacking.wav"); playSoundAtEntity(par3EntityPlayer, "attacking.wav" doesn't work.
  15. Ok so last time I posted, Mazetar helped me out with adding sword sound but.... that was in 1.5 now its 1.6. I've been trying really hard to add these sounds but this is the only thing I have seen on the inter webs. sound file package brenden.viking; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; public class vikingsound { @ForgeSubscribe public void onSound(SoundLoadEvent event) { try { event.manager.addSound("attacking.wav"); event.manager.addSound("medieval:fireshot2.wav"); event.manager.addSound("medieval:fireshot3.wav"); } catch (Exception e) { System.err.println("Fire sounds error"); } } } In sword class public ItemStack onItemLeftClick(ItemStack ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { --ItemStack.stackSize; } par2World.playSoundAtEntity(par3EntityPlayer, "brenden:attacking", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!par2World.isRemote) { par2World.spawnEntityInWorld(new VikingSword_Entity(par2World, par3EntityPlayer)); } return ItemStack; } I dont know what to do now with this. If anyone could help a noob that would be lovely! thanks a million
  16. Yes you already know i was about to waste my time lol! And I would love to learn more!
  17. Yeahhh im super new to modding I have much to learn . So just to clarify the "entityLiving.WorldObj.PlaySoundAtEntity(entityLiving, "mob.zombie.say",1.0F, 1.0F);" goes into public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { par1ItemStack.damageItem(1, par3EntityLiving); return true; } Thank you so much for helping me out
  18. God sorry im stupid! So do I have to declare the world then the (command) for sound and then the path for the sound? btw thanks for helping me
  19. Like for the zombie? protected String getLivingSound() { return "mob.zombie.say"; }
  20. thank you but does that go into the previous code up above or all on its own? And what is "world obj"? sorry.
  21. Im assuming this is the hitEntity thing in the ItemSword that you mean. public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { par1ItemStack.damageItem(1, par3EntityLiving); return true; } but how would I add sound to it?
×
×
  • Create New...

Important Information

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