Results 1 to 2 of 2
  1. #1
    paccerz is offline Member
    Join Date
    Aug 2011
    Posts
    2
    Rep Power
    0

    Default Java need help! Help will be very much appreciated

    I have recently started working with java and i have finished doing a bit of coding for a modification for a game and i have run into two errors: cannot find symbol : variable porkscratching and possible loss of precision please can you tell me what i have dun wrong in the code below

    Java Code:
    package net.minecraft.src;
    import java.util.Random;
    
    public class mod_porkscratching extends BaseMod
    {
    	public static final Item itemporkscratching = new  ItemPorkScratching(2000).setItemName(porkscratching);
    
    	public mod_porkscratching()
    	{
    		itemporkscratching.iconIndex = ModLoader.addOverride("/gui/items.png", "/BritishFoods/porkscratching.png");
    		ModLoader.AddName(itemporkscratching, "Pork Scratching");
    		ModLoader.AddRecipe(new ItemStack(itemporkscratching, 1), new Object []{
    			" * ", " % ", Character.valueOf('*'), mod_salt.saltitem, Character.valueOf('%'), Item.porkCooked
    		
    		});
    
    	}
    
    	public String Version()
    	{
    		return "3.14159265";
    	}
    }
    New Java document
    Java Code:
    package net.minecraft.src;
    
    public class ItemPorkScratching extends Item 
    {
       private int healAmount;
       
       public ItemPorkScratching(int i) {
          super (i);
          maxStackSize = 1;
          healAmount = 1.5;
       }
       
       public int getHealAmount()
       {
    	   return healAmount;
       }
       
       public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
       {
    	   itemstack.stackSize--;
    	   entityplayer.heal(healAmount);
    	   return itemstack;
    	   
       }
    }
    Last edited by Norm; 08-23-2011 at 08:48 PM. Reason: Changed tags to code

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    cannot find symbol : variable porkscratching
    You should post the full text of the error message. What line was the error on?

    possible loss of precision please
    This happens when you assign a floating point number to an int. integers hold ONLY whole numbers.

Similar Threads

  1. Help: lots of error codes and stuff.
    By mittens in forum New To Java
    Replies: 2
    Last Post: 06-30-2011, 06:30 PM
  2. Replies: 5
    Last Post: 04-16-2010, 01:10 PM
  3. nohup.out using lots of space
    By ersachinjain in forum Advanced Java
    Replies: 2
    Last Post: 10-30-2009, 03:50 PM
  4. Lots of my folders have become read-only
    By Manoeuvre in forum Eclipse
    Replies: 5
    Last Post: 12-02-2008, 12:48 PM
  5. Replies: 1
    Last Post: 08-09-2008, 11:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •