javaminecraft

Minecraft Modding Java compiling error


I am trying to make a mod for minecraft which adds a new block. Here is my code:

mod_Block.java

package net.minecraft.src;
import java.util.random;

public class mod_Block extends BaseMod
{
    public static final Block sunBlock = new     BlockSun(100,0).setBlockName("sun").setLightValue(2.0F);

    public mod_Block()
    {
        ModLoader.RegisterBlock(sunBlock);
        blockSun.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/block.png");
        ModLoader.AddName(sunBlock,"Sun");

        ModLoader.AddRecipe(new ItemStack(sunBlock, 1), new Object [] {
            "**", Character.valueOf('*'), Block.dirt
        });
    }

    public String Version()
    {
        return "3.14159265";
    }
}

BlockSun.java

package net.minecraft.src;
import java.util.random;

public class BlockSun extends Block
{
    protected BlockSun (int i, int j)
    {
        super (i,j,Material.glass);
    }

    public int quantityDropped (int i, Random random)
    {
        return 0;
    }
}

But the compiler says:

src/minecraft/net/minecraft/src/BlockSun.java:2: cannot find symbol symbol : class util location: package java import java.util; ^

src/minecraft/net/minecraft/src/BlockSun.java:11: cannot find symbol symbol : class Random location: class net.minecraft.src.BlockSun public int quantityDropped (int i, Random random) ^

src/minecraft/net/minecraft/src/mod_Block.java:2: cannot find symbol symbol : class util location: package java import java.util; ^

src/minecraft/net/minecraft/src/mod_Block.java:11: cannot find symbol symbol : variable blockSun location: class net.minecraft.src.mod_Block blockSun.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/block.png"); ^

I would be really grateful if you helped me out, thanks.


Solution

  • Java is case-sensitive: java.util.Random

    Also it would be good for you to read Java's naming conventions: http://www.oracle.com/technetwork/java/codeconv-138413.html