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

# Thread: PROBLEM: ILLEGAL START OF EXPRESSION

1. ## 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. ## Re: PROBLEM: ILLEGAL START OF EXPRESSION

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