Results 1 to 3 of 3
  1. #1
    Sidonius is offline Member
    Join Date
    Apr 2014
    Rep Power

    Default Using a String[] in a Void or INT???

    I'm new to the forums and I am not too sure this is the correct place to post this thread, but I guess if it's wrong someone will correct me...

    Anyways, I am trying to make a custom texture system for a block in Minecraft, I am not too advanced with Java and am not sure how to make this work the way I want it to.

    Java Code:
        /** The list of the types of step blocks. */
        public static final String[] blockStepTypes = new String[] {"stone", "sand", "wood", "cobble", "brick", "smoothStoneBrick", "netherBrick", "quartz"};
        private Icon missing;
        private Icon icon1;
         * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
        public Icon getIcon(int par1, int par2)
            int var3 = par2 & 7;
            	if (var3 == 0) return par1 == 0 ? icon1 : missing;
            return missing;
         * When this method is called, your block should register all the icons it needs with the given IconRegister. This
         * is the only chance you get to register icons.
        public void registerIcons(IconRegister par1IconRegister)
        	String[] var4 = blockStepTypes;
        	this.missing = par1IconRegister.registerIcon("");
        	if (var4 = "stone")
        		this.icon1 = par1IconRegister.registerIcon("stone_slab_top");
        	if (var4 = "sand")
        		this.icon1 = par1IconRegister.registerIcon("sand_slab_top");
    Alright, so basically I figured I could just tell the code to see if the block is made out of Stone, then to set the texture to Stone, or if it's made out of Sand, then set it to Sand.

    What I usually get is Eclipse telling me to "insert '!= null' check", "insert '!= null' check", and then just error out saying "Opperator != is undefined for the argument type(s) boolean null"

    Is there any way I could make this work for me? Maybe some other way to make it do what I am trying to do?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Using a String[] in a Void or INT???

    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Using a String[] in a Void or INT???

    You should compare Strings for equality like this: var4.equals("stone") etc.b.t.w. your variable names are miserable.

    kind regards,

    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. facing error for public static void main(string[])
    By piyush_jeena in forum New To Java
    Replies: 2
    Last Post: 07-20-2013, 11:22 PM
  2. public static void main(String... args)???
    By SnakeDoc in forum New To Java
    Replies: 5
    Last Post: 01-10-2013, 08:30 AM
  3. Q?> about public static void main(String args[])
    By boblingwide in forum New To Java
    Replies: 4
    Last Post: 03-23-2012, 11:17 AM
  4. Replies: 10
    Last Post: 07-10-2011, 08:37 AM
  5. Public static void main (String args[])
    By arefeh in forum New To Java
    Replies: 12
    Last Post: 01-28-2010, 11:58 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