Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: PROBLEM: ILLEGAL START OF EXPRESSION

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PROBLEM: ILLEGAL START OF EXPRESSION

    I have written this code:

    package net.minecraft.src;
    import java.util.Random;
    public class WorldGenTowerOne extends WorldGenerator
    {
        public WorldGenTowerOne()
        {
        }
        public boolean generate(World world, Random rand, int i, int j, int k)
        {
    int bID = 2;  /*2 is the block id for grass, so the structure going to spawn on grass*/
            if(world.getBlockId(i, j, k) != bID || world.getBlockId(i, j + 1, k) != 0 || world.getBlockId(i + 7, j, k) != bID || world.getBlockId(i + 7, j, k + 7) != bID || world.getBlockId(i, j, k + 7) != bID || world.getBlockId(i + 7, j + 1, k) != 0 || world.getBlockId(i + 7, j + 1, k + 7) != 0 || world.getBlockId(i, j + 1, k + 7) != 0)
            {
                return false;
            }
                world.setBlock(i + 0, j + 0, k + 4, 98);
                world.setBlock(i + 0, j + 0, k + 2, 109);
                world.setBlock(i + 0, j + 0, k + 0, 98);
                world.setBlock(i + 1, j + 0, k + 3, 48);
                world.setBlock(i + 1, j + 0, k + 1, 48);
                world.setBlock(i + 2, j + 0, k + 4, 109);
                world.setBlock(i + 2, j + 0, k + 2, 54);
                world.setBlock(i + 2, j + 0, k + 0, 109);
                world.setBlock(i + 3, j + 0, k + 3, 48);
                world.setBlock(i + 3, j + 0, k + 1, 48);
                world.setBlock(i + 4, j + 0, k + 4, 98);
                world.setBlock(i + 4, j + 0, k + 2, 109);
                world.setBlock(i + 4, j + 0, k + 0, 98);
                world.setBlock(i + 1, j + 1, k + 3, 48);
                world.setBlock(i + 1, j + 1, k + 1, 48);
                world.setBlock(i + 3, j + 1, k + 3, 48);
                world.setBlock(i + 3, j + 1, k + 1, 48);
                world.setBlock(i + 1, j + 2, k + 3, 4);
                world.setBlock(i + 1, j + 2, k + 2, 4);
                world.setBlock(i + 1, j + 2, k + 1, 98);
                world.setBlock(i + 2, j + 2, k + 3, 4);
                world.setBlock(i + 2, j + 2, k + 2, 98);
                world.setBlock(i + 2, j + 2, k + 1, 4);
                world.setBlock(i + 3, j + 2, k + 3, 4);
                world.setBlock(i + 3, j + 2, k + 2, 98);
                world.setBlock(i + 3, j + 2, k + 1, 4);
                world.setBlock(i + 0, j + 3, k + 4, 98);
                world.setBlock(i + 0, j + 3, k + 0, 98);
                world.setBlock(i + 1, j + 3, k + 3, 98);
                world.setBlock(i + 1, j + 3, k + 1, 98);
                world.setBlock(i + 3, j + 3, k + 3, 4);
                world.setBlock(i + 3, j + 3, k + 1, 98);
                world.setBlock(i + 4, j + 3, k + 4, 98);
                world.setBlock(i + 4, j + 3, k + 0, 98);
    		int chest = Block.chect.blockID;
     
    world.setBlockWithNotify (i, j + 1, k, chest);
     
    TileEntityChest tileentitychest = (TileEntityChest)world.getBlockTileEntity(i + 2, j + 0, k + 2,);
    if (tileentitychect != null && tileentitychest.getSizeInventory() > 0) {
    ItemStack itemstack = new ItemStack(Block.torchWood, 2);
    ItemStack itemstack = new ItemStack(Item.Bucket, 1);
    ItemStack itemstack = new ItemStack(Item.AppleGold, 1);
    ItemStack itemstack = new ItemStack(Item.EnderPearl, 2);
    ItemStack itemstack = new ItemStack(Item.Soup, 1);
    ItemStack itemstack = new ItemStack(Block.Pumpkin, 2);
    tileentitychect.setInventorySlotContents(0, itemstack);
    }
      return true;
      }
    }



    When I try to recompile, I get this error:

    --------------------------------------------------------
    == ERRORS FOUND ==

    src\minecraft\net\minecraft\src\WorldGenTowerOne.j ava:59: error: illegal start o
    f expression
    TileEntityChest tileentitychest = (TileEntityChest)world.getBlockTileEntity(i +
    2, j + 0, k + 2,);

    ^

    1 error
    --------------------------------------------------------


    What is the problem? All help is appreciated!


  2. #2
    Member
    Join Date
    Mar 2012
    Location
    United States
    Posts
    118
    My Mood
    Inspired
    Thanks
    1
    Thanked 33 Times in 31 Posts

    Default Re: PROBLEM: ILLEGAL START OF EXPRESSION

    There seems to be an extra comma after k+2. See what happens after you remove that.

Similar Threads

  1. " Illegal start of expression" Error.
    By SanoSuke in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 21st, 2011, 08:08 PM
  2. illegal start of expression error!!!!
    By aks.1393 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: January 14th, 2011, 08:47 AM
  3. Illegal start of type?
    By mjpam in forum What's Wrong With My Code?
    Replies: 5
    Last Post: September 9th, 2010, 03:47 PM
  4. Illegal start
    By hing09 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: March 25th, 2010, 05:23 PM
  5. Illegal Start of Expression Error. Any help is appreciated.
    By SKhoujinian91 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 8th, 2009, 12:57 AM

Tags for this Thread