2011-08-02 124 views
1

我想爲我的世界做一個添加新塊的mod。這裏是我的代碼:Minecraft Modding Java編譯錯誤

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; 
    } 
} 

但是編譯器說:

的src /我的世界/網/我的世界/ src目錄/ BlockSun.java:2:找不到符號 symbol:class util location:package java import java.util; ^

的src /我的世界/網/我的世界/ src目錄/ BlockSun.java:11:找不到符號 符號:類Random 位置:類net.minecraft.src.BlockSun 公衆詮釋quantityDropped(INT I,隨機隨機) ^

的src /的Minecraft /淨/的Minecraft/SRC/mod_Block.java:2:無法找到符號 符號:UTIL 位置類:包的java 進口java.util中; ^

的src /的Minecraft /淨/的Minecraft/SRC/mod_Block.java:11:找不到符號 符號:可變blockSun 位置:類net.minecraft.src.mod_Block blockSun.blockIndexInTexture = ModLoader.addOverride( 「/terrain.png","/block.png」); ^

如果你能幫助我,我會很感激,謝謝。

回答

2

試圖改變這一行你mod_Block.java

blockSun.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/block.png"); 

into into:

sunBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/block.png");