Novice coder here, had made a small sized mod, then decided it was to messy and started redoing it trying to simplify and organize it. I got help earlier on fixing one issue, but now that I've tried adding tree generation to the world, I've received a crash report, as well as corn won't drop from corn crops, onion does. Please help if possible, all help is appreciated and will is thanked kindly.
Crash Report:
---- Minecraft Crash Report ----
// Why is it breaking
Time: 2/16/13 12:29 PM
Description: Failed to start game
java.lang.NullPointerException
at net.minecraft.item.ItemStack.<init>(ItemStack.java:64)
at decormod.Itemcornseed.<init>(Itemcornseed.java:11)
at decormod.decormods.BlockCreation(decormods.java:229)
at decormod.decormods.load(decormods.java:154)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:485)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:657)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:456)
at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
at net.minecraft.client.Minecraft.run(Minecraft.java:744)
at java.lang.Thread.run(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.4.7
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_13, Oracle Corporation
Java VM Version: Java HotSpotâ„¢ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 972696720 bytes (927 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.26 FML v4.7.4.520 Minecraft Forge 6.6.0.497 4 mods loaded, 4 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
Decormod [Decoration Mod] (bin) Unloaded->Constructed->Pre-initialized->Errored
LWJGL: 2.4.2
OpenGL: GeForce GTX 650/PCIe/SSE2 GL version 4.2.0, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'forge,fml'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
@Mod(modid = "Decormod", name = "Decoration Mod", version = "0.0.7")
@NetworkMod(clientSideRequired = true, serverSideRequired = true)
public class decormods {
//Creative Tabs
public static CreativeTabs tabdecor = new CreativeTabdecor(CreativeTabs.getNextID(), "Decor Tab");
public static CreativeTabs tabfood = new CreativeTabfood(CreativeTabs.getNextID(), "Food Tab");
public static CreativeTabs tabtools = new CreativeTabtools(CreativeTabs.getNextID(), "Tools Tab");
//Block declaration
public static Block deadlight;
int deadlightID;
public static Block eternallight;
int eternallightID;
public static Block lightore;
int lightoreID;
public static Block decorglass;
int decorglassID;
public static Block redwoodlog;
int redwoodlogID;
public static Block redwoodLeaf;
int redwoodleafID;
public static Block redwoodPlank;
int redwoodplankID;
public static Block redwoodSapling;
int redwoodsaplingID;
//Item declaration
public static Item lightshards;
int lightshardsID;
//Food/Crop Declaration
public static Item mutton;
int muttonID;
public static Item chickenstick;
int cstickID;
public static Item salad;
int saladID;
//Corn=============
public static Block corncrop;
int corncropID;
public static Item cornseed;
int cornseedID;
public static Item corn;
int cornID;
//Onion============
public static Block onioncrop;
int onioncropID;
public static Item onionseed;
int onionseedID;
public static Item onion;
int onionID;
//Garlic===========
public static Block garliccrop;
int garliccropID;
public static Item garlicseed;
int garlicseedID;
public static Item garlic;
int garlicID;
//Tools============
public static Item Lightpickaxe;
int LightpickaxeID;
public static Item Lightaxe;
int LightaxeID;
public static Item Lighthoe;
int LighthoeID;
public static Item Lightshovel;
int LightshovelID;
public static Item Lightsword;
int LightswordID;
public static Item Lighthelmet;
int LighthelmetID;
public static Item Lightplate;
int LightplateID;
public static Item Lightlegs;
int LightlegsID;
public static Item Lightboots;
int LightbootsID;
//EnumToolMaterials
public static EnumToolMaterial lighttools = EnumHelper.addToolMaterial("Light Tools", 3, 50000, 15.0F, 10, 10);
public static EnumArmorMaterial lightarmor = EnumHelper.addArmorMaterial("Light Armor", 40, new int[]{4,9,7,5}, 10);
@PreInit
public void preInit(FMLPreInitializationEvent event){
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
BiomeGenBase plains = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ);
WorldGenRedwoodTree tree = new WorldGenRedwoodTree(); //Change this to the World Gens or your tree and make sure that the parameters match if you get errors!
if(plains instanceof BiomeGenBase)
{
for(int c = 0; c < 3; c++)
{
int Xcoord = chunkX + rand.nextInt(16);
int Zcoord = chunkZ + rand.nextInt(16);
int i = world.getHeightValue(Xcoord, Zcoord);
tree.generate(world, rand, Xcoord, i, Zcoord);
}
}
}
/*decorfood1 = new myfood1(decorfood1ID, 12, 2.0F, false).setItemName("Mutton").setIconIndex(1); //1=half heart true/false if you can feed your dog
GameRegistry.registerItem(decorfood1, "Mutton");
LanguageRegistry.addName(decorfood1, "Mutton"); //id, hp, sat, wolffood*/
public class WorldGenRedwoodTree extends WorldGenerator
{
public WorldGenRedwoodTree()
{
}
public boolean generate2(World world, Random random, int i, int j, int k)
{
int l = random.nextInt(1) + 4;
boolean flag = true;
if(j < 1 || j + l + 1 > 256)
{
return false;
}
for(int i1 = j; i1 <= j + 1 + l; i1++)
{
byte byte0 = 1;
if(i1 == j)
{
byte0 = 0;
}
if(i1 >= (j + 1 + l) - 2)
{
byte0 = 2;
}
for(int i2 = i - byte0; i2 <= i + byte0 && flag; i2++)
{
for(int l2 = k - byte0; l2 <= k + byte0 && flag; l2++)
{
if(i1 >= 0 && i1 < 256)
{
int j3 = world.getBlockId(i2, i1, l2);
if(j3 != 0 && j3 != decormods.redwoodLeaf.blockID) //Change this to your leaf block.
{
flag = false;
}
} else
{
flag = false;
}
}
}
}
if(!flag)
{
return false;
}
int j1 = world.getBlockId(i, j - 1, k);
if(j1 != Block.grass.blockID && j1 != Block.dirt.blockID || j >= 256 - l - 1) //This determines on what blocks your tree can generate.
{
return false;
}
world.setBlock(i, j - 1, k, Block.dirt.blockID); //Also determines what block your tree can generate on.
for(int k1 = (j - 3) + l; k1 <= j + l; k1++)
{
int j2 = k1 - (j + l);
int i3 = 1 - j2 / 2;
for(int k3 = i - i3; k3 <= i + i3; k3++)
{
int l3 = k3 - i;
for(int i4 = k - i3; i4 <= k + i3; i4++)
{
int j4 = i4 - k;
if((Math.abs(l3) != i3 || Math.abs(j4) != i3 || random.nextInt(2) != 0 && j2 != 0) && !Block.opaqueCubeLookup[world.getBlockId(k3, k1, i4)])
{
setBlockAndMetadata(world, k3, k1, i4, decormods.redwoodLeaf.blockID, 0); //Change to your leaf block.
}
}
}
}
for(int l1 = 0; l1 < l; l1++)
{
int k2 = world.getBlockId(i, j + l1, k);
if(k2 == 0 || k2 == decormods.redwoodLeaf.blockID)
{
setBlockAndMetadata(world, i, j + l1, k, decormods.redwoodlog.blockID, 0); //Change to your wood block.
}
}
return true;
}
@Override
public boolean generate(World var1, Random var2, int var3, int var4, int var5) {
// TODO Auto-generated method stub
return false;
}
}
If any other class info is needed please notify me in a reply, also I would ask that someone show me how to allow fertillizing the sapling. Again thank you anyone who helps.
import net.minecraft.src.ModLoader; is your first problem.
public void generateSurface(World world, Random rand, int chunkX, int chunkZ) is your second problem. It is a ModLoader method and should not be used.
@NetworkMod(clientSideRequired = true, serverSideRequired = true) if serverSideRequired is set to true, anyone using your mod would not be able to connect to any servers without having your mod installed on the server too.
at decormod.Itemcornseed.<init>(Itemcornseed.java:11)
at decormod.decormods.BlockCreation(decormods.java:229)
at decormod.decormods.load(decormods.java:154)
This is the cause of the crash: something is returning null. Please do clean up your code as in putting all the GameRegistry.registerBlock/registerItem code, LanguageRegistry code together to it's easier to spot any mistakes
import net.minecraft.src.ModLoader; is your first problem.
public void generateSurface(World world, Random rand, int chunkX, int chunkZ) is your second problem. It is a ModLoader method and should not be used.
@NetworkMod(clientSideRequired = true, serverSideRequired = true) if serverSideRequired is set to true, anyone using your mod would not be able to connect to any servers without having your mod installed on the server too.
at decormod.Itemcornseed.<init>(Itemcornseed.java:11)
at decormod.decormods.BlockCreation(decormods.java:229)
at decormod.decormods.load(decormods.java:154)
This is the cause of the crash: something is returning null. Please do clean up your code as in putting all the GameRegistry.registerBlock/registerItem code, LanguageRegistry code together to it's easier to spot any mistakes
removed the src.modloader, but how do i add armor then in this case:
changed serversiderequired to false, thanks for that, though not seeing blocks might annoy some people., I'll repost my code when i organize it like you said. thanks +
edit: found these nulls in corncrops: just incase this is any problem.
this.setCreativeTab((CreativeTabs)null);
if (blocksList[var19] != null && blocksList[var19].canSustainPlant(par1World, var17, par3 - 1, var18, ForgeDirection.UP, this))
organized the gameregistries and languageaddnames apart:
@Mod(modid = "Decormod", name = "Decoration Mod", version = "0.0.7")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class decormods {
//Creative Tabs
public static CreativeTabs tabdecor = new CreativeTabdecor(CreativeTabs.getNextID(), "Decor Tab");
public static CreativeTabs tabfood = new CreativeTabfood(CreativeTabs.getNextID(), "Food Tab");
public static CreativeTabs tabtools = new CreativeTabtools(CreativeTabs.getNextID(), "Tools Tab");
//Block declaration
public static Block deadlight;
int deadlightID;
public static Block eternallight;
int eternallightID;
public static Block lightore;
int lightoreID;
public static Block decorglass;
int decorglassID;
public static Block redwoodlog;
int redwoodlogID;
public static Block redwoodLeaf;
int redwoodleafID;
public static Block redwoodPlank;
int redwoodplankID;
public static Block redwoodSapling;
int redwoodsaplingID;
//Item declaration
public static Item lightshards;
int lightshardsID;
//Food/Crop Declaration
public static Item mutton;
int muttonID;
public static Item chickenstick;
int cstickID;
public static Item salad;
int saladID;
//Corn=============
public static Block corncrop;
int corncropID;
public static Item cornseed;
int cornseedID;
public static Item corn;
int cornID;
//Onion============
public static Block onioncrop;
int onioncropID;
public static Item onionseed;
int onionseedID;
public static Item onion;
int onionID;
//Garlic===========
public static Block garliccrop;
int garliccropID;
public static Item garlicseed;
int garlicseedID;
public static Item garlic;
int garlicID;
//Tools============
public static Item Lightpickaxe;
int LightpickaxeID;
public static Item Lightaxe;
int LightaxeID;
public static Item Lighthoe;
int LighthoeID;
public static Item Lightshovel;
int LightshovelID;
public static Item Lightsword;
int LightswordID;
public static Item Lighthelmet;
int LighthelmetID;
public static Item Lightplate;
int LightplateID;
public static Item Lightlegs;
int LightlegsID;
public static Item Lightboots;
int LightbootsID;
//EnumToolMaterials
public static EnumToolMaterial lighttools = EnumHelper.addToolMaterial("Light Tools", 3, 50000, 15.0F, 10, 10);
public static EnumArmorMaterial lightarmor = EnumHelper.addArmorMaterial("Light Armor", 40, new int[]{4,9,7,5}, 10);
@PreInit
public void preInit(FMLPreInitializationEvent event){
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
BiomeGenBase plains = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ);
WorldGenRedwoodTree tree = new WorldGenRedwoodTree(); //Change this to the World Gens or your tree and make sure that the parameters match if you get errors!
if(plains instanceof BiomeGenBase)
{
for(int c = 0; c < 3; c++)
{
int Xcoord = chunkX + rand.nextInt(16);
int Zcoord = chunkZ + rand.nextInt(16);
int i = world.getHeightValue(Xcoord, Zcoord);
tree.generate(world, rand, Xcoord, i, Zcoord);
}
}
}
public void BlockCreation(){ //Total IDs - Item IDs: 0,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 Block IDs: 0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32
//Block creation - Block IDs Used: 0,1,2,4,5,14,15,32
deadlight = new Blockdeadlight(deadlightID, 0).setStepSound(Block.soundStoneFootstep).setHardness(2F).setBlockName("Dead Light Block");
eternallight = new Blocketernallight(eternallightID, 1).setStepSound(Block.soundStoneFootstep).setHardness(2F).setBlockName("Eternal Light Block");
lightore = new Orelight(lightoreID, 2).setStepSound(Block.soundStoneFootstep).setHardness(3F).setBlockName("Light Shard Ore").setLightValue(0.5F);
decorglass = new Blockdecorglass(decorglassID, 14).setHardness(2.0F).setStepSound(Block.soundGlassFootstep).setBlockName("Decor Glass");
redwoodlog = new BlockRedwoodLog(redwoodlogID).setHardness(2.0F).setStepSound(Block.soundWoodFootstep).setBlockName("Redwood Log").setRequiresSelfNotify();
redwoodLeaf = new BlockRedwoodleaf(redwoodleafID, 15).setHardness(1.0F).setStepSound(Block.soundGrassFootstep).setBlockName("Redwood Leaf").setRequiresSelfNotify();
redwoodSapling = new BlockRedwoodSapling(redwoodsaplingID, 32).setHardness(0F).setBlockName("Redwood Leaf").setRequiresSelfNotify();
//Item creation - IDs Used: 0
lightshards = new Itemlightshards(lightshardsID).setIconIndex(0).setItemName("Light Shards");
//Food Creation - IDs Used: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 || Block IDs Used: 6,7,8,9,10,11,12,13,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
mutton = new ItemFoodmutton(muttonID, 12, 2.0F, false).setItemName("Mutton").setIconIndex(1);
chickenstick = new ItemFoodcstick(cstickID, 12, 2.0F, false).setItemName("Chicken Stick").setIconIndex(2);
salad = new ItemFoodsalad(saladID, 6, 2.0F, false).setItemName("Salad").setIconIndex(8);
//Corn===============
corncrop = new Blockcorncrop(corncropID, 6).setHardness(0F).setBlockName("Corn Crop");
MinecraftForge.EVENT_BUS.register(new FertilizerEventcornClass());
cornseed = new Itemcornseed(cornseedID, corncrop.blockID, Block.tilledField.blockID).setItemName("Corn Seeds").setIconIndex(13);
corn = new Itemcorn(cornID, 4, false).setItemName("Corn").setIconIndex(14);
//Onion===============
onioncrop = new Blockonioncrop(onioncropID, 16).setHardness(0F).setBlockName("Onion Crop");
MinecraftForge.EVENT_BUS.register(new FertilizerEventonionClass());
onionseed = new Itemonionseed(onionseedID, onioncrop.blockID, Block.tilledField.blockID).setItemName("Onion Seeds").setIconIndex(16);
onion = new Itemonion(cornID, 4, false).setItemName("Onion").setIconIndex(15);
//Garlic==============Construction
garliccrop = new Blockgarliccrop(garliccropID, 24).setHardness(0F).setBlockName("Garlic Crop");
MinecraftForge.EVENT_BUS.register(new FertilizerEventgarlicClass());
garlicseed = new Itemgarlicseed(garlicseedID, garliccrop.blockID, Block.tilledField.blockID).setItemName("Garlic Seeds").setIconIndex(17);
garlic = new Itemgarlic(garlicID, 4, false).setItemName("Garlic").setIconIndex(18);
//Tools Creation - IDs Used: 3,4,5,6,7,9,10,11,12
Lightpickaxe = new ItemLightPickaxe(LightpickaxeID, lighttools).setIconIndex(3).setItemName("Light Pickaxe");
Lightshovel = new ItemLightShovel(LightshovelID, lighttools).setIconIndex(4).setItemName("Light Shovel");
Lightaxe = new ItemLightAxe(LightaxeID, lighttools).setIconIndex(5).setItemName("Light Axe");
Lightsword = new ItemLightSword(LightswordID, lighttools).setIconIndex(6).setItemName("Light Sword");
Lighthoe = new ItemLightHoe(LighthoeID, lighttools).setIconIndex(7).setItemName("Light Hoe");
Lighthelmet = new ItemLightArmor(809, lightarmor, ModLoader.addArmor("Light Armor1"), 0).setIconCoord(9, 0).setItemName("Light Helmet");
Lightplate = new ItemLightArmor(810, lightarmor, ModLoader.addArmor("Light Armor2"), 1).setIconCoord(10, 0).setItemName("Light Plate");
Lightlegs = new ItemLightArmor(811, lightarmor, ModLoader.addArmor("Light Armor3"), 2).setIconCoord(11, 0).setItemName("Light Legs");
Lightboots = new ItemLightArmor(812, lightarmor, ModLoader.addArmor("Light Armor4"), 3).setIconCoord(12, 0).setItemName("Light Boots");
/*decorfood1 = new myfood1(decorfood1ID, 12, 2.0F, false).setItemName("Mutton").setIconIndex(1); //1=half heart true/false if you can feed your dog
GameRegistry.registerItem(decorfood1, "Mutton");
LanguageRegistry.addName(decorfood1, "Mutton"); //id, hp, sat, wolffood*/
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ) is not used at all in MinecraftForge.
Clientside only things such as 'preload textures' have to be in the ClientProxy.
http://www.minecraftforge.net/wiki/Category:Tutorials The tutorials here should help you figure out the basics, they might even solve your NPE. As for adding the armor textures, I know it's done in the ClientProxy but I don't know exactly how it is done: Google is your friend and it's worth a try to google your issues before posting on MCF.
Crash Report:
---- Minecraft Crash Report ----
// Why is it breaking
Time: 2/16/13 12:29 PM
Description: Failed to start game
java.lang.NullPointerException
at net.minecraft.item.ItemStack.<init>(ItemStack.java:64)
at decormod.Itemcornseed.<init>(Itemcornseed.java:11)
at decormod.decormods.BlockCreation(decormods.java:229)
at decormod.decormods.load(decormods.java:154)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:485)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:657)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:456)
at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
at net.minecraft.client.Minecraft.run(Minecraft.java:744)
at java.lang.Thread.run(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.4.7
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_13, Oracle Corporation
Java VM Version: Java HotSpotâ„¢ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 972696720 bytes (927 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.26 FML v4.7.4.520 Minecraft Forge 6.6.0.497 4 mods loaded, 4 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
Decormod [Decoration Mod] (bin) Unloaded->Constructed->Pre-initialized->Errored
LWJGL: 2.4.2
OpenGL: GeForce GTX 650/PCIe/SSE2 GL version 4.2.0, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'forge,fml'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
decormods main class file:
package decormod;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.src.ModLoader;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "Decormod", name = "Decoration Mod", version = "0.0.7")
@NetworkMod(clientSideRequired = true, serverSideRequired = true)
public class decormods {
//Creative Tabs
public static CreativeTabs tabdecor = new CreativeTabdecor(CreativeTabs.getNextID(), "Decor Tab");
public static CreativeTabs tabfood = new CreativeTabfood(CreativeTabs.getNextID(), "Food Tab");
public static CreativeTabs tabtools = new CreativeTabtools(CreativeTabs.getNextID(), "Tools Tab");
//Block declaration
public static Block deadlight;
int deadlightID;
public static Block eternallight;
int eternallightID;
public static Block lightore;
int lightoreID;
public static Block decorglass;
int decorglassID;
public static Block redwoodlog;
int redwoodlogID;
public static Block redwoodLeaf;
int redwoodleafID;
public static Block redwoodPlank;
int redwoodplankID;
public static Block redwoodSapling;
int redwoodsaplingID;
//Item declaration
public static Item lightshards;
int lightshardsID;
//Food/Crop Declaration
public static Item mutton;
int muttonID;
public static Item chickenstick;
int cstickID;
public static Item salad;
int saladID;
//Corn=============
public static Block corncrop;
int corncropID;
public static Item cornseed;
int cornseedID;
public static Item corn;
int cornID;
//Onion============
public static Block onioncrop;
int onioncropID;
public static Item onionseed;
int onionseedID;
public static Item onion;
int onionID;
//Garlic===========
public static Block garliccrop;
int garliccropID;
public static Item garlicseed;
int garlicseedID;
public static Item garlic;
int garlicID;
//Tools============
public static Item Lightpickaxe;
int LightpickaxeID;
public static Item Lightaxe;
int LightaxeID;
public static Item Lighthoe;
int LighthoeID;
public static Item Lightshovel;
int LightshovelID;
public static Item Lightsword;
int LightswordID;
public static Item Lighthelmet;
int LighthelmetID;
public static Item Lightplate;
int LightplateID;
public static Item Lightlegs;
int LightlegsID;
public static Item Lightboots;
int LightbootsID;
//EnumToolMaterials
public static EnumToolMaterial lighttools = EnumHelper.addToolMaterial("Light Tools", 3, 50000, 15.0F, 10, 10);
public static EnumArmorMaterial lightarmor = EnumHelper.addArmorMaterial("Light Armor", 40, new int[]{4,9,7,5}, 10);
@PreInit
public void preInit(FMLPreInitializationEvent event){
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
deadlightID = config.get("Block IDs", "Dead Light ID", 800).getInt();
eternallightID = config.get("Block IDs", "Eternal Light ID", 801).getInt();
lightoreID = config.get("Block IDs", "Light Ore ID", 802).getInt();
decorglassID = config.get("Block IDs", "Decor Glass ID", 803).getInt();
corncropID = config.get("Block IDs", "Corn Crops ID", 804).getInt();
onioncropID = config.get("Block IDs", "Onion Crops ID", 805).getInt();
garliccropID = config.get("Block IDs", "Garlic Crops ID", 806).getInt();
redwoodlogID = config.get("Block IDs", "Redwood Block ID", 807).getInt();
redwoodleafID = config.get("Block IDs", "Redwood Leaf ID", 808).getInt();
redwoodplankID = config.get("Block IDs", "Redwood Plank ID", 809).getInt();
redwoodsaplingID = config.get("Block IDs", "Redwood Sapling ID", 810).getInt();
lightshardsID = config.get("Item IDs", "Light Shards ID", 2001).getInt();
cornseedID = config.get("Item IDs", "Corn seed ID", 2002).getInt();
cornID = config.get("Item IDs", "Corn ID", 2003).getInt();
muttonID = config.get("Item IDs", "Mutton ID", 2004).getInt();
LightpickaxeID = config.get("Tool IDs", "Light Pickaxe ID", 2005).getInt();
LightaxeID = config.get("Tool IDs", "Light Axe ID", 2006).getInt();
LighthoeID = config.get("Tool IDs", "Light Hoe ID", 2007).getInt();
LightshovelID = config.get("Tool IDs", "Light Shovel ID", 2008).getInt();
LightswordID = config.get("Tool IDs", "Light Sword ID", 2009).getInt();
cstickID = config.get("Item IDs", "Chicken Stick ID", 2010).getInt();
saladID = config.get("Item IDs", "Salad ID", 2011).getInt();
onionseedID = config.get("Item IDs", "Onion Seeds ID", 2012).getInt();
onionID = config.get("Item IDs", "Onion ID", 2013).getInt();
garlicseedID = config.get("Item IDs", "Garlic Seeds ID", 2014).getInt();
garlicID = config.get("Item IDs", "Garlic ID", 2015).getInt();
LighthelmetID = config.get("Item IDs", "Light Helmet ID", 2016).getInt();
LightplateID = config.get("Item IDs", "Light Plate ID", 2017).getInt();
LightlegsID = config.get("Item IDs", "Light Legs ID", 2018).getInt();
LightbootsID = config.get("Item IDs", "Light Boots ID", 2019).getInt();
config.save();
}
@Init
public void load(FMLInitializationEvent fml){
BlockCreation();
CraftRecipes();
GameRegistry.registerWorldGenerator(new WorldlightoreGeneration());
MinecraftForgeClient.preloadTexture("/jtextures/Items.png");
MinecraftForgeClient.preloadTexture("/jtextures/Blocks.png");
MinecraftForge.setToolClass(Lightpickaxe, "pickaxe", 2);
MinecraftForge.setToolClass(Lightshovel, "shovel", 2);
MinecraftForge.setToolClass(Lightaxe, "axe", 2);
MinecraftForge.setToolClass(Lightsword, "sword", 2);
MinecraftForge.setToolClass(Lighthoe, "hoe", 2);
Lighthelmet.setCreativeTab(decormods.tabtools);
Lightplate.setCreativeTab(decormods.tabtools);
Lightlegs.setCreativeTab(decormods.tabtools);
Lightboots.setCreativeTab(decormods.tabtools);
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
BiomeGenBase plains = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ);
WorldGenRedwoodTree tree = new WorldGenRedwoodTree(); //Change this to the World Gens or your tree and make sure that the parameters match if you get errors!
if(plains instanceof BiomeGenBase)
{
for(int c = 0; c < 3; c++)
{
int Xcoord = chunkX + rand.nextInt(16);
int Zcoord = chunkZ + rand.nextInt(16);
int i = world.getHeightValue(Xcoord, Zcoord);
tree.generate(world, rand, Xcoord, i, Zcoord);
}
}
}
public void BlockCreation(){ //Total IDs - Item IDs: 0,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 Block IDs: 0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32
//Block creation - Block IDs Used: 0,1,2,4,5,14,15,32
deadlight = new Blockdeadlight(deadlightID, 0).setStepSound(Block.soundStoneFootstep).setHardness(2F).setBlockName("Dead Light Block");
GameRegistry.registerBlock(deadlight, "Dead Light Block");
LanguageRegistry.addName(deadlight, "Dead Light Block");
eternallight = new Blocketernallight(eternallightID, 1).setStepSound(Block.soundStoneFootstep).setHardness(2F).setBlockName("Eternal Light Block");
GameRegistry.registerBlock(eternallight, "Eternal Light Block");
LanguageRegistry.addName(eternallight, "Eternal Light Block");
lightore = new Orelight(lightoreID, 2).setStepSound(Block.soundStoneFootstep).setHardness(3F).setBlockName("Light Shard Ore").setLightValue(0.5F);
GameRegistry.registerBlock(lightore, "Light Shard Ore");
LanguageRegistry.addName(lightore, "Light Shard Ore");
decorglass = new Blockdecorglass(decorglassID, 14).setHardness(2.0F).setStepSound(Block.soundGlassFootstep).setBlockName("Decor Glass");
GameRegistry.registerBlock(decorglass, "Decor Glass");
LanguageRegistry.addName(decorglass, "Decor Glass");
redwoodlog = new BlockRedwoodLog(redwoodlogID).setHardness(2.0F).setStepSound(Block.soundWoodFootstep).setBlockName("Redwood Log").setRequiresSelfNotify();
GameRegistry.registerBlock(redwoodlog, "Redwood Log"); //uses 5 to
LanguageRegistry.addName(redwoodlog, "Redwood Log");
redwoodLeaf = new BlockRedwoodleaf(redwoodleafID, 15).setHardness(1.0F).setStepSound(Block.soundGrassFootstep).setBlockName("Redwood Leaf").setRequiresSelfNotify();
GameRegistry.registerBlock(redwoodLeaf, "Redwood Leaf");
LanguageRegistry.addName(redwoodLeaf, "Redwood Leaf");
redwoodSapling = new BlockRedwoodSapling(redwoodsaplingID, 32).setHardness(0F).setBlockName("Redwood Leaf").setRequiresSelfNotify();
GameRegistry.registerBlock(redwoodSapling, "Redwood Sapling");
LanguageRegistry.addName(redwoodSapling, "Redwood Sapling");
//Item creation - IDs Used: 0
lightshards = new Itemlightshards(lightshardsID).setIconIndex(0).setItemName("Light Shards");
GameRegistry.registerItem(lightshards, "Light Shards");
LanguageRegistry.addName(lightshards, "Light Shards");
//Food Creation - IDs Used: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 || Block IDs Used: 6,7,8,9,10,11,12,13,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
mutton = new ItemFoodmutton(muttonID, 12, 2.0F, false).setItemName("Mutton").setIconIndex(1);
GameRegistry.registerItem(mutton, "Mutton");
LanguageRegistry.addName(mutton, "Mutton");
chickenstick = new ItemFoodcstick(cstickID, 12, 2.0F, false).setItemName("Chicken Stick").setIconIndex(2);
GameRegistry.registerItem(chickenstick, "Chicken Stick");
LanguageRegistry.addName(chickenstick, "Chicken Stick");
salad = new ItemFoodsalad(saladID, 6, 2.0F, false).setItemName("Salad").setIconIndex(8);
GameRegistry.registerItem(salad, "Salad");
LanguageRegistry.addName(salad, "Salad");
//Corn===============
corncrop = new Blockcorncrop(corncropID, 6).setHardness(0F).setBlockName("Corn Crop");
GameRegistry.registerBlock(corncrop, "Corn Crop");
LanguageRegistry.addName(corncrop, "Corn Crop");
MinecraftForge.EVENT_BUS.register(new FertilizerEventcornClass());
cornseed = new Itemcornseed(cornseedID, corncrop.blockID, Block.tilledField.blockID).setItemName("Corn Seeds").setIconIndex(13);
GameRegistry.registerItem(cornseed, "Corn Seeds");
LanguageRegistry.addName(cornseed, "Corn Seeds");
corn = new Itemcorn(cornID, 4, false).setItemName("Corn").setIconIndex(14);
GameRegistry.registerItem(corn, "Corn");
LanguageRegistry.addName(corn, "Corn");
//Onion===============
onioncrop = new Blockonioncrop(onioncropID, 16).setHardness(0F).setBlockName("Onion Crop");
GameRegistry.registerBlock(onioncrop, "Onion Crop");
LanguageRegistry.addName(onioncrop, "Onion Crop");
MinecraftForge.EVENT_BUS.register(new FertilizerEventonionClass());
onionseed = new Itemonionseed(onionseedID, onioncrop.blockID, Block.tilledField.blockID).setItemName("Onion Seeds").setIconIndex(16);
GameRegistry.registerItem(onionseed, "Onion Seeds");
LanguageRegistry.addName(onionseed, "Onion Seeds");
onion = new Itemonion(cornID, 4, false).setItemName("Onion").setIconIndex(15);
GameRegistry.registerItem(onion, "Onion");
LanguageRegistry.addName(onion, "Onion");
//Garlic==============Construction
garliccrop = new Blockgarliccrop(garliccropID, 24).setHardness(0F).setBlockName("Garlic Crop");
GameRegistry.registerBlock(garliccrop, "Garlic Crop");
LanguageRegistry.addName(garliccrop, "Garlic Crop");
MinecraftForge.EVENT_BUS.register(new FertilizerEventgarlicClass());
garlicseed = new Itemgarlicseed(garlicseedID, garliccrop.blockID, Block.tilledField.blockID).setItemName("Garlic Seeds").setIconIndex(17);
GameRegistry.registerItem(garlicseed, "Garlic Seeds");
LanguageRegistry.addName(garlicseed, "Garlic Seeds");
garlic = new Itemgarlic(garlicID, 4, false).setItemName("Garlic").setIconIndex(18);
GameRegistry.registerItem(garlic, "Garlic");
LanguageRegistry.addName(garlic, "Garlic");
//Tools Creation - IDs Used: 3,4,5,6,7,9,10,11,12
Lightpickaxe = new ItemLightPickaxe(LightpickaxeID, lighttools).setIconIndex(3).setItemName("Light Pickaxe");
GameRegistry.registerItem(Lightpickaxe, "Light Pickaxe");
LanguageRegistry.addName(Lightpickaxe, "Light Pickaxe");
Lightshovel = new ItemLightShovel(LightshovelID, lighttools).setIconIndex(4).setItemName("Light Shovel");
GameRegistry.registerItem(Lightshovel, "Light Shovel");
LanguageRegistry.addName(Lightshovel, "Light Shovel");
Lightaxe = new ItemLightAxe(LightaxeID, lighttools).setIconIndex(5).setItemName("Light Axe");
GameRegistry.registerItem(Lightaxe, "Light Axe");
LanguageRegistry.addName(Lightaxe, "Light Axe");
Lightsword = new ItemLightSword(LightswordID, lighttools).setIconIndex(6).setItemName("Light Sword");
GameRegistry.registerItem(Lightsword, "Light Sword");
LanguageRegistry.addName(Lightsword, "Light Sword");
Lighthoe = new ItemLightHoe(LighthoeID, lighttools).setIconIndex(7).setItemName("Light Hoe");
GameRegistry.registerItem(Lighthoe, "Light Hoe");
LanguageRegistry.addName(Lighthoe, "Light Hoe");
Lighthelmet = new ItemLightArmor(809, lightarmor, ModLoader.addArmor("Light Armor1"), 0).setIconCoord(9, 0).setItemName("Light Helmet");
GameRegistry.registerItem(Lighthelmet, "Light Helmet");
LanguageRegistry.addName(Lighthelmet, "Light Helmet");
Lightplate = new ItemLightArmor(810, lightarmor, ModLoader.addArmor("Light Armor2"), 1).setIconCoord(10, 0).setItemName("Light Plate");
GameRegistry.registerItem(Lightplate, "Light Plate");
LanguageRegistry.addName(Lightplate, "Light Plate");
Lightlegs = new ItemLightArmor(811, lightarmor, ModLoader.addArmor("Light Armor3"), 2).setIconCoord(11, 0).setItemName("Light Legs");
GameRegistry.registerItem(Lightlegs, "Light Legs");
LanguageRegistry.addName(Lightlegs, "Light Legs");
Lightboots = new ItemLightArmor(812, lightarmor, ModLoader.addArmor("Light Armor4"), 3).setIconCoord(12, 0).setItemName("Light Boots");
GameRegistry.registerItem(Lightboots, "Light Boots");
LanguageRegistry.addName(Lightboots, "Light Boots");
/*decorfood1 = new myfood1(decorfood1ID, 12, 2.0F, false).setItemName("Mutton").setIconIndex(1); //1=half heart true/false if you can feed your dog
GameRegistry.registerItem(decorfood1, "Mutton");
LanguageRegistry.addName(decorfood1, "Mutton"); //id, hp, sat, wolffood*/
}
public void CraftRecipes(){
//Crafting Recipes
GameRegistry.addRecipe(new ItemStack(decormods.deadlight, 1), new Object[]{
"aaa", "axa", "aaa", Character.valueOf('a'), decormods.lightshards
});
GameRegistry.addShapelessRecipe(new ItemStack(decormods.salad, 1), new Object[]{
Item.seeds,
Item.seeds,
Item.seeds
});
GameRegistry.addRecipe(new ItemStack(decormods.mutton, 1), new Object[]{
"xxx", "xbx", "xax", Character.valueOf('a'), Item.bone, Character.valueOf('b'), Item.porkCooked
});
GameRegistry.addRecipe(new ItemStack(decormods.chickenstick, 1), new Object[]{
"xxa", "xbx", "axx", Character.valueOf('a'), Item.stick, Character.valueOf('b'), Item.chickenCooked
});
GameRegistry.addShapelessRecipe(new ItemStack(decormods.cornseed, 2), new Object[]{
decormods.corn
});
GameRegistry.addShapelessRecipe(new ItemStack(decormods.onionseed, 2), new Object[]{
decormods.onion
});
GameRegistry.addShapelessRecipe(new ItemStack(decormods.garlicseed, 2), new Object[]{
decormods.garlic
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightpickaxe, 1), new Object[]{
"bbb", "xax", "xax", Character.valueOf('a'), Item.ingotIron, Character.valueOf('b'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightshovel, 1), new Object[]{
"xbx", "xax", "xax", Character.valueOf('a'), Item.ingotIron, Character.valueOf('b'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightaxe, 1), new Object[]{
"bbx", "bax", "xax", Character.valueOf('a'), Item.ingotIron, Character.valueOf('b'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightsword, 1), new Object[]{
"xbx", "xbx", "xax", Character.valueOf('a'), Item.ingotIron, Character.valueOf('b'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lighthoe, 1), new Object[]{
"bbx", "xax", "xax", Character.valueOf('a'), Item.ingotIron, Character.valueOf('b'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lighthelmet, 1), new Object[]{
"aaa", "axa", "xxx", Character.valueOf('a'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightplate, 1), new Object[]{
"axa", "aaa", "aaa", Character.valueOf('a'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightlegs, 1), new Object[]{
"aaa", "axa", "axa", Character.valueOf('a'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightboots, 1), new Object[]{
"xxx", "axa", "axa", Character.valueOf('a'), decormods.lightshards
});
//Smelting Recipes
GameRegistry.addSmelting(decormods.deadlight.blockID, new ItemStack(decormods.eternallight, 1), 20);
}
}
/*
GameRegistry.addShapelessRecipe(new ItemStack(mod_testing.decorblock3, 4), new Object[]{
Item.appleRed,
Block.planks
});
GameRegistry.addShapelessRecipe(new ItemStack(mod_testing.RedwoodLog, 1), new Object[]{
Block.wood,
Item.appleRed
});
GameRegistry.addShapelessRecipe(new ItemStack(mod_testing.decorblock3, 4), new Object[]{
mod_testing.RedwoodLog
});
//public static final Block sand = (new BlockSand(12, 18)).setHardness(0.5F).setStepSound(soundSandFootstep).setBlockName("sand");
//public static final Block thinGlass = (new BlockPane(102, 49, 148, Material.glass, false)).setHardness(0.3F).setStepSound(soundGlassFootstep).setBlockName("thinGlass");
*/
WorldGenRedwoodTree
package decormod;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
public class WorldGenRedwoodTree extends WorldGenerator
{
public WorldGenRedwoodTree()
{
}
public boolean generate2(World world, Random random, int i, int j, int k)
{
int l = random.nextInt(1) + 4;
boolean flag = true;
if(j < 1 || j + l + 1 > 256)
{
return false;
}
for(int i1 = j; i1 <= j + 1 + l; i1++)
{
byte byte0 = 1;
if(i1 == j)
{
byte0 = 0;
}
if(i1 >= (j + 1 + l) - 2)
{
byte0 = 2;
}
for(int i2 = i - byte0; i2 <= i + byte0 && flag; i2++)
{
for(int l2 = k - byte0; l2 <= k + byte0 && flag; l2++)
{
if(i1 >= 0 && i1 < 256)
{
int j3 = world.getBlockId(i2, i1, l2);
if(j3 != 0 && j3 != decormods.redwoodLeaf.blockID) //Change this to your leaf block.
{
flag = false;
}
} else
{
flag = false;
}
}
}
}
if(!flag)
{
return false;
}
int j1 = world.getBlockId(i, j - 1, k);
if(j1 != Block.grass.blockID && j1 != Block.dirt.blockID || j >= 256 - l - 1) //This determines on what blocks your tree can generate.
{
return false;
}
world.setBlock(i, j - 1, k, Block.dirt.blockID); //Also determines what block your tree can generate on.
for(int k1 = (j - 3) + l; k1 <= j + l; k1++)
{
int j2 = k1 - (j + l);
int i3 = 1 - j2 / 2;
for(int k3 = i - i3; k3 <= i + i3; k3++)
{
int l3 = k3 - i;
for(int i4 = k - i3; i4 <= k + i3; i4++)
{
int j4 = i4 - k;
if((Math.abs(l3) != i3 || Math.abs(j4) != i3 || random.nextInt(2) != 0 && j2 != 0) && !Block.opaqueCubeLookup[world.getBlockId(k3, k1, i4)])
{
setBlockAndMetadata(world, k3, k1, i4, decormods.redwoodLeaf.blockID, 0); //Change to your leaf block.
}
}
}
}
for(int l1 = 0; l1 < l; l1++)
{
int k2 = world.getBlockId(i, j + l1, k);
if(k2 == 0 || k2 == decormods.redwoodLeaf.blockID)
{
setBlockAndMetadata(world, i, j + l1, k, decormods.redwoodlog.blockID, 0); //Change to your wood block.
}
}
return true;
}
@Override
public boolean generate(World var1, Random var2, int var3, int var4, int var5) {
// TODO Auto-generated method stub
return false;
}
}
If any other class info is needed please notify me in a reply, also I would ask that someone show me how to allow fertillizing the sapling. Again thank you anyone who helps.
public void generateSurface(World world, Random rand, int chunkX, int chunkZ) is your second problem. It is a ModLoader method and should not be used.
@NetworkMod(clientSideRequired = true, serverSideRequired = true) if serverSideRequired is set to true, anyone using your mod would not be able to connect to any servers without having your mod installed on the server too.
This is the cause of the crash: something is returning null. Please do clean up your code as in putting all the GameRegistry.registerBlock/registerItem code, LanguageRegistry code together to it's easier to spot any mistakes
removed the src.modloader, but how do i add armor then in this case:
Lighthelmet = new ItemLightArmor(809, lightarmor, ModLoader.addArmor("Light Armor1"), 0).setIconCoord(9, 0).setItemName("Light Helmet");
GameRegistry.registerItem(Lighthelmet, "Light Helmet");
LanguageRegistry.addName(Lighthelmet, "Light Helmet");
changed serversiderequired to false, thanks for that, though not seeing blocks might annoy some people., I'll repost my code when i organize it like you said. thanks +
edit: found these nulls in corncrops: just incase this is any problem.
this.setCreativeTab((CreativeTabs)null);
if (blocksList[var19] != null && blocksList[var19].canSustainPlant(par1World, var17, par3 - 1, var18, ForgeDirection.UP, this))
organized the gameregistries and languageaddnames apart:
package decormod;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "Decormod", name = "Decoration Mod", version = "0.0.7")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class decormods {
//Creative Tabs
public static CreativeTabs tabdecor = new CreativeTabdecor(CreativeTabs.getNextID(), "Decor Tab");
public static CreativeTabs tabfood = new CreativeTabfood(CreativeTabs.getNextID(), "Food Tab");
public static CreativeTabs tabtools = new CreativeTabtools(CreativeTabs.getNextID(), "Tools Tab");
//Block declaration
public static Block deadlight;
int deadlightID;
public static Block eternallight;
int eternallightID;
public static Block lightore;
int lightoreID;
public static Block decorglass;
int decorglassID;
public static Block redwoodlog;
int redwoodlogID;
public static Block redwoodLeaf;
int redwoodleafID;
public static Block redwoodPlank;
int redwoodplankID;
public static Block redwoodSapling;
int redwoodsaplingID;
//Item declaration
public static Item lightshards;
int lightshardsID;
//Food/Crop Declaration
public static Item mutton;
int muttonID;
public static Item chickenstick;
int cstickID;
public static Item salad;
int saladID;
//Corn=============
public static Block corncrop;
int corncropID;
public static Item cornseed;
int cornseedID;
public static Item corn;
int cornID;
//Onion============
public static Block onioncrop;
int onioncropID;
public static Item onionseed;
int onionseedID;
public static Item onion;
int onionID;
//Garlic===========
public static Block garliccrop;
int garliccropID;
public static Item garlicseed;
int garlicseedID;
public static Item garlic;
int garlicID;
//Tools============
public static Item Lightpickaxe;
int LightpickaxeID;
public static Item Lightaxe;
int LightaxeID;
public static Item Lighthoe;
int LighthoeID;
public static Item Lightshovel;
int LightshovelID;
public static Item Lightsword;
int LightswordID;
public static Item Lighthelmet;
int LighthelmetID;
public static Item Lightplate;
int LightplateID;
public static Item Lightlegs;
int LightlegsID;
public static Item Lightboots;
int LightbootsID;
//EnumToolMaterials
public static EnumToolMaterial lighttools = EnumHelper.addToolMaterial("Light Tools", 3, 50000, 15.0F, 10, 10);
public static EnumArmorMaterial lightarmor = EnumHelper.addArmorMaterial("Light Armor", 40, new int[]{4,9,7,5}, 10);
@PreInit
public void preInit(FMLPreInitializationEvent event){
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
deadlightID = config.get("Block IDs", "Dead Light ID", 800).getInt();
eternallightID = config.get("Block IDs", "Eternal Light ID", 801).getInt();
lightoreID = config.get("Block IDs", "Light Ore ID", 802).getInt();
decorglassID = config.get("Block IDs", "Decor Glass ID", 803).getInt();
corncropID = config.get("Block IDs", "Corn Crops ID", 804).getInt();
onioncropID = config.get("Block IDs", "Onion Crops ID", 805).getInt();
garliccropID = config.get("Block IDs", "Garlic Crops ID", 806).getInt();
redwoodlogID = config.get("Block IDs", "Redwood Block ID", 807).getInt();
redwoodleafID = config.get("Block IDs", "Redwood Leaf ID", 808).getInt();
redwoodplankID = config.get("Block IDs", "Redwood Plank ID", 809).getInt();
redwoodsaplingID = config.get("Block IDs", "Redwood Sapling ID", 810).getInt();
lightshardsID = config.get("Item IDs", "Light Shards ID", 2001).getInt();
cornseedID = config.get("Item IDs", "Corn seed ID", 2002).getInt();
cornID = config.get("Item IDs", "Corn ID", 2003).getInt();
muttonID = config.get("Item IDs", "Mutton ID", 2004).getInt();
LightpickaxeID = config.get("Tool IDs", "Light Pickaxe ID", 2005).getInt();
LightaxeID = config.get("Tool IDs", "Light Axe ID", 2006).getInt();
LighthoeID = config.get("Tool IDs", "Light Hoe ID", 2007).getInt();
LightshovelID = config.get("Tool IDs", "Light Shovel ID", 2008).getInt();
LightswordID = config.get("Tool IDs", "Light Sword ID", 2009).getInt();
cstickID = config.get("Item IDs", "Chicken Stick ID", 2010).getInt();
saladID = config.get("Item IDs", "Salad ID", 2011).getInt();
onionseedID = config.get("Item IDs", "Onion Seeds ID", 2012).getInt();
onionID = config.get("Item IDs", "Onion ID", 2013).getInt();
garlicseedID = config.get("Item IDs", "Garlic Seeds ID", 2014).getInt();
garlicID = config.get("Item IDs", "Garlic ID", 2015).getInt();
LighthelmetID = config.get("Item IDs", "Light Helmet ID", 2016).getInt();
LightplateID = config.get("Item IDs", "Light Plate ID", 2017).getInt();
LightlegsID = config.get("Item IDs", "Light Legs ID", 2018).getInt();
LightbootsID = config.get("Item IDs", "Light Boots ID", 2019).getInt();
config.save();
}
@Init
public void load(FMLInitializationEvent fml){
BlockCreation();
CraftRecipes();
GameRegisters();
LanguageRegisters();
GameRegistry.registerWorldGenerator(new WorldlightoreGeneration());
MinecraftForgeClient.preloadTexture("/jtextures/Items.png");
MinecraftForgeClient.preloadTexture("/jtextures/Blocks.png");
MinecraftForge.setToolClass(Lightpickaxe, "pickaxe", 2);
MinecraftForge.setToolClass(Lightshovel, "shovel", 2);
MinecraftForge.setToolClass(Lightaxe, "axe", 2);
MinecraftForge.setToolClass(Lightsword, "sword", 2);
MinecraftForge.setToolClass(Lighthoe, "hoe", 2);
Lighthelmet.setCreativeTab(decormods.tabtools);
Lightplate.setCreativeTab(decormods.tabtools);
Lightlegs.setCreativeTab(decormods.tabtools);
Lightboots.setCreativeTab(decormods.tabtools);
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
BiomeGenBase plains = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ);
WorldGenRedwoodTree tree = new WorldGenRedwoodTree(); //Change this to the World Gens or your tree and make sure that the parameters match if you get errors!
if(plains instanceof BiomeGenBase)
{
for(int c = 0; c < 3; c++)
{
int Xcoord = chunkX + rand.nextInt(16);
int Zcoord = chunkZ + rand.nextInt(16);
int i = world.getHeightValue(Xcoord, Zcoord);
tree.generate(world, rand, Xcoord, i, Zcoord);
}
}
}
public void BlockCreation(){ //Total IDs - Item IDs: 0,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 Block IDs: 0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32
//Block creation - Block IDs Used: 0,1,2,4,5,14,15,32
deadlight = new Blockdeadlight(deadlightID, 0).setStepSound(Block.soundStoneFootstep).setHardness(2F).setBlockName("Dead Light Block");
eternallight = new Blocketernallight(eternallightID, 1).setStepSound(Block.soundStoneFootstep).setHardness(2F).setBlockName("Eternal Light Block");
lightore = new Orelight(lightoreID, 2).setStepSound(Block.soundStoneFootstep).setHardness(3F).setBlockName("Light Shard Ore").setLightValue(0.5F);
decorglass = new Blockdecorglass(decorglassID, 14).setHardness(2.0F).setStepSound(Block.soundGlassFootstep).setBlockName("Decor Glass");
redwoodlog = new BlockRedwoodLog(redwoodlogID).setHardness(2.0F).setStepSound(Block.soundWoodFootstep).setBlockName("Redwood Log").setRequiresSelfNotify();
redwoodLeaf = new BlockRedwoodleaf(redwoodleafID, 15).setHardness(1.0F).setStepSound(Block.soundGrassFootstep).setBlockName("Redwood Leaf").setRequiresSelfNotify();
redwoodSapling = new BlockRedwoodSapling(redwoodsaplingID, 32).setHardness(0F).setBlockName("Redwood Leaf").setRequiresSelfNotify();
//Item creation - IDs Used: 0
lightshards = new Itemlightshards(lightshardsID).setIconIndex(0).setItemName("Light Shards");
//Food Creation - IDs Used: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 || Block IDs Used: 6,7,8,9,10,11,12,13,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
mutton = new ItemFoodmutton(muttonID, 12, 2.0F, false).setItemName("Mutton").setIconIndex(1);
chickenstick = new ItemFoodcstick(cstickID, 12, 2.0F, false).setItemName("Chicken Stick").setIconIndex(2);
salad = new ItemFoodsalad(saladID, 6, 2.0F, false).setItemName("Salad").setIconIndex(8);
//Corn===============
corncrop = new Blockcorncrop(corncropID, 6).setHardness(0F).setBlockName("Corn Crop");
MinecraftForge.EVENT_BUS.register(new FertilizerEventcornClass());
cornseed = new Itemcornseed(cornseedID, corncrop.blockID, Block.tilledField.blockID).setItemName("Corn Seeds").setIconIndex(13);
corn = new Itemcorn(cornID, 4, false).setItemName("Corn").setIconIndex(14);
//Onion===============
onioncrop = new Blockonioncrop(onioncropID, 16).setHardness(0F).setBlockName("Onion Crop");
MinecraftForge.EVENT_BUS.register(new FertilizerEventonionClass());
onionseed = new Itemonionseed(onionseedID, onioncrop.blockID, Block.tilledField.blockID).setItemName("Onion Seeds").setIconIndex(16);
onion = new Itemonion(cornID, 4, false).setItemName("Onion").setIconIndex(15);
//Garlic==============Construction
garliccrop = new Blockgarliccrop(garliccropID, 24).setHardness(0F).setBlockName("Garlic Crop");
MinecraftForge.EVENT_BUS.register(new FertilizerEventgarlicClass());
garlicseed = new Itemgarlicseed(garlicseedID, garliccrop.blockID, Block.tilledField.blockID).setItemName("Garlic Seeds").setIconIndex(17);
garlic = new Itemgarlic(garlicID, 4, false).setItemName("Garlic").setIconIndex(18);
//Tools Creation - IDs Used: 3,4,5,6,7,9,10,11,12
Lightpickaxe = new ItemLightPickaxe(LightpickaxeID, lighttools).setIconIndex(3).setItemName("Light Pickaxe");
Lightshovel = new ItemLightShovel(LightshovelID, lighttools).setIconIndex(4).setItemName("Light Shovel");
Lightaxe = new ItemLightAxe(LightaxeID, lighttools).setIconIndex(5).setItemName("Light Axe");
Lightsword = new ItemLightSword(LightswordID, lighttools).setIconIndex(6).setItemName("Light Sword");
Lighthoe = new ItemLightHoe(LighthoeID, lighttools).setIconIndex(7).setItemName("Light Hoe");
Lighthelmet = new ItemLightArmor(809, lightarmor, ModLoader.addArmor("Light Armor1"), 0).setIconCoord(9, 0).setItemName("Light Helmet");
Lightplate = new ItemLightArmor(810, lightarmor, ModLoader.addArmor("Light Armor2"), 1).setIconCoord(10, 0).setItemName("Light Plate");
Lightlegs = new ItemLightArmor(811, lightarmor, ModLoader.addArmor("Light Armor3"), 2).setIconCoord(11, 0).setItemName("Light Legs");
Lightboots = new ItemLightArmor(812, lightarmor, ModLoader.addArmor("Light Armor4"), 3).setIconCoord(12, 0).setItemName("Light Boots");
/*decorfood1 = new myfood1(decorfood1ID, 12, 2.0F, false).setItemName("Mutton").setIconIndex(1); //1=half heart true/false if you can feed your dog
GameRegistry.registerItem(decorfood1, "Mutton");
LanguageRegistry.addName(decorfood1, "Mutton"); //id, hp, sat, wolffood*/
}
public void GameRegisters(){
GameRegistry.registerBlock(deadlight, "Dead Light Block");
GameRegistry.registerBlock(eternallight, "Eternal Light Block");
GameRegistry.registerBlock(lightore, "Light Shard Ore");
GameRegistry.registerBlock(decorglass, "Decor Glass");
GameRegistry.registerBlock(redwoodlog, "Redwood Log");
GameRegistry.registerBlock(redwoodLeaf, "Redwood Leaf");
GameRegistry.registerBlock(redwoodSapling, "Redwood Sapling");
GameRegistry.registerItem(lightshards, "Light Shards");
GameRegistry.registerItem(mutton, "Mutton");
GameRegistry.registerItem(chickenstick, "Chicken Stick");
GameRegistry.registerItem(salad, "Salad");
GameRegistry.registerBlock(corncrop, "Corn Crop");
GameRegistry.registerItem(cornseed, "Corn Seeds");
GameRegistry.registerItem(corn, "Corn");
GameRegistry.registerBlock(onioncrop, "Onion Crop");
GameRegistry.registerItem(onionseed, "Onion Seeds");
GameRegistry.registerItem(onion, "Onion");
GameRegistry.registerBlock(garliccrop, "Garlic Crop");
GameRegistry.registerItem(garlicseed, "Garlic Seeds");
GameRegistry.registerItem(garlic, "Garlic");
GameRegistry.registerItem(Lightpickaxe, "Light Pickaxe");
GameRegistry.registerItem(Lightshovel, "Light Shovel");
GameRegistry.registerItem(Lightaxe, "Light Axe");
GameRegistry.registerItem(Lightsword, "Light Sword");
GameRegistry.registerItem(Lighthoe, "Light Hoe");
GameRegistry.registerItem(Lighthelmet, "Light Helmet");
GameRegistry.registerItem(Lightplate, "Light Plate");
GameRegistry.registerItem(Lightlegs, "Light Legs");
GameRegistry.registerItem(Lightboots, "Light Boots");
}
public void LanguageRegisters(){
LanguageRegistry.addName(deadlight, "Dead Light Block");
LanguageRegistry.addName(eternallight, "Eternal Light Block");
LanguageRegistry.addName(lightore, "Light Shard Ore");
LanguageRegistry.addName(decorglass, "Decor Glass");
LanguageRegistry.addName(redwoodlog, "Redwood Log");
LanguageRegistry.addName(redwoodLeaf, "Redwood Leaf");
LanguageRegistry.addName(redwoodSapling, "Redwood Sapling");
LanguageRegistry.addName(lightshards, "Light Shards");
LanguageRegistry.addName(mutton, "Mutton");
LanguageRegistry.addName(chickenstick, "Chicken Stick");
LanguageRegistry.addName(salad, "Salad");
LanguageRegistry.addName(corncrop, "Corn Crop");
LanguageRegistry.addName(cornseed, "Corn Seeds");
LanguageRegistry.addName(corn, "Corn");
LanguageRegistry.addName(onioncrop, "Onion Crop");
LanguageRegistry.addName(onionseed, "Onion Seeds");
LanguageRegistry.addName(onion, "Onion");
LanguageRegistry.addName(garliccrop, "Garlic Crop");
LanguageRegistry.addName(garlicseed, "Garlic Seeds");
LanguageRegistry.addName(garlic, "Garlic");
LanguageRegistry.addName(Lightpickaxe, "Light Pickaxe");
LanguageRegistry.addName(Lightshovel, "Light Shovel");
LanguageRegistry.addName(Lightaxe, "Light Axe");
LanguageRegistry.addName(Lightsword, "Light Sword");
LanguageRegistry.addName(Lighthoe, "Light Hoe");
LanguageRegistry.addName(Lighthelmet, "Light Helmet");
LanguageRegistry.addName(Lightplate, "Light Plate");
LanguageRegistry.addName(Lightlegs, "Light Legs");
LanguageRegistry.addName(Lightboots, "Light Boots");
}
public void CraftRecipes(){
//Crafting Recipes
GameRegistry.addRecipe(new ItemStack(decormods.deadlight, 1), new Object[]{
"aaa", "axa", "aaa", Character.valueOf('a'), decormods.lightshards
});
GameRegistry.addShapelessRecipe(new ItemStack(decormods.salad, 1), new Object[]{
Item.seeds,
Item.seeds,
Item.seeds
});
GameRegistry.addRecipe(new ItemStack(decormods.mutton, 1), new Object[]{
"xxx", "xbx", "xax", Character.valueOf('a'), Item.bone, Character.valueOf('b'), Item.porkCooked
});
GameRegistry.addRecipe(new ItemStack(decormods.chickenstick, 1), new Object[]{
"xxa", "xbx", "axx", Character.valueOf('a'), Item.stick, Character.valueOf('b'), Item.chickenCooked
});
GameRegistry.addShapelessRecipe(new ItemStack(decormods.cornseed, 2), new Object[]{
decormods.corn
});
GameRegistry.addShapelessRecipe(new ItemStack(decormods.onionseed, 2), new Object[]{
decormods.onion
});
GameRegistry.addShapelessRecipe(new ItemStack(decormods.garlicseed, 2), new Object[]{
decormods.garlic
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightpickaxe, 1), new Object[]{
"bbb", "xax", "xax", Character.valueOf('a'), Item.ingotIron, Character.valueOf('b'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightshovel, 1), new Object[]{
"xbx", "xax", "xax", Character.valueOf('a'), Item.ingotIron, Character.valueOf('b'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightaxe, 1), new Object[]{
"bbx", "bax", "xax", Character.valueOf('a'), Item.ingotIron, Character.valueOf('b'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightsword, 1), new Object[]{
"xbx", "xbx", "xax", Character.valueOf('a'), Item.ingotIron, Character.valueOf('b'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lighthoe, 1), new Object[]{
"bbx", "xax", "xax", Character.valueOf('a'), Item.ingotIron, Character.valueOf('b'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lighthelmet, 1), new Object[]{
"aaa", "axa", "xxx", Character.valueOf('a'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightplate, 1), new Object[]{
"axa", "aaa", "aaa", Character.valueOf('a'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightlegs, 1), new Object[]{
"aaa", "axa", "axa", Character.valueOf('a'), decormods.lightshards
});
GameRegistry.addRecipe(new ItemStack(decormods.Lightboots, 1), new Object[]{
"xxx", "axa", "axa", Character.valueOf('a'), decormods.lightshards
});
//Smelting Recipes
GameRegistry.addSmelting(decormods.deadlight.blockID, new ItemStack(decormods.eternallight, 1), 20);
}
}
/*
GameRegistry.addShapelessRecipe(new ItemStack(mod_testing.decorblock3, 4), new Object[]{
Item.appleRed,
Block.planks
});
GameRegistry.addShapelessRecipe(new ItemStack(mod_testing.RedwoodLog, 1), new Object[]{
Block.wood,
Item.appleRed
});
GameRegistry.addShapelessRecipe(new ItemStack(mod_testing.decorblock3, 4), new Object[]{
mod_testing.RedwoodLog
});
//public static final Block sand = (new BlockSand(12, 18)).setHardness(0.5F).setStepSound(soundSandFootstep).setBlockName("sand");
//public static final Block thinGlass = (new BlockPane(102, 49, 148, Material.glass, false)).setHardness(0.3F).setStepSound(soundGlassFootstep).setBlockName("thinGlass");
*/
Clientside only things such as 'preload textures' have to be in the ClientProxy.
http://www.minecraftforge.net/wiki/Category:Tutorials The tutorials here should help you figure out the basics, they might even solve your NPE. As for adding the armor textures, I know it's done in the ClientProxy but I don't know exactly how it is done: Google is your friend and it's worth a try to google your issues before posting on MCF.