Jump to content

Recommended Posts

Posted

Hey, can somebody pls tell me how to add GrassSeeds?

I tried it with MinecraftForge.addGrassSeed(itemID, metadata, quantity, probability)

but first i don't know what to add under metadata and when i add something like 1 ok 0 or an other int it gives me this error:

 

 

BEGIN ERROR REPORT ee4af955 --------

Generated 18.05.12 18:12

 

Minecraft: Minecraft 1.2.5

OS: Windows Vista (amd64) version 6.0

Java: 1.6.0_29, Sun Microsystems Inc.

VM: Java HotSpot™ 64-Bit Server VM (mixed mode), Sun Microsystems Inc.

LWJGL: 2.4.2

OpenGL: GeForce 9500 GS/PCIe/SSE2 version 3.3.0, NVIDIA Corporation

 

java.lang.NullPointerException

at net.minecraft.src.RenderItem.doRenderItem(RenderItem.java:150)

at net.minecraft.src.RenderItem.doRender(RenderItem.java:526)

at net.minecraft.src.RenderManager.renderEntityWithPosYaw(RenderManager.java:189)

at net.minecraft.src.RenderManager.renderEntity(RenderManager.java:176)

at net.minecraft.src.RenderGlobal.renderEntities(RenderGlobal.java:431)

at net.minecraft.src.EntityRenderer.renderWorld(EntityRenderer.java:1094)

at net.minecraft.src.EntityRenderer.updateCameraAndRender(EntityRenderer.java:903)

at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:20)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:869)

at net.minecraft.client.Minecraft.run(Minecraft.java:747)

at java.lang.Thread.run(Unknown Source)

--- END ERROR REPORT cbb2ff50 ----------

 

 

The item I want to add is my potatoseed and I tried it with melonseed too and it gaves me the same error. The Error appears when im hitting grass and if i would become the seed

it crashs.

I don't know how to fix it and im new on Forge modding.

I hope somebody can help me,

Bye :D

 

Ps: Sry for my bad English, i hope you can excuse me. :S

Posted

Remember to +256 your item id, Or, more properly: item.itemID is the value you should use.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

I cant use item.ItemID it says its not applicabel for Item int int int

and it gives me no error with MinecraftForge.addGrassSeed(1015, 0, 1, 20);

only if i hit grass Minecraft crashs I think I have to add a render for my seed or something like that but

no idea how to do this

Posted

Your item.itemID, that is a number, not a item, and it should work fine.

The problem is your item id is not a valid ID hence the null pointer.

Pass in a proper value {using one of the methods I described before}

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Item Etc:

 

public class mod_Food extends BaseMod

{

public static final Item PotatoSeed = new ItemSeedsTextureHandler(386, mod_Food.Potato.blockID, Block.tilledField.blockID).setItemName("PotatoSeed").setIconIndex(8);

 

static {

ModLoader.addName(PotatoSeed, "Potato Seed");

 

public String getVersion()

{

return "1.2.5";}

 

public void load() {

MinecraftForge.addGrassSeed(386,0,1,10);

}

 

 

} }

 

 

ItemSeedsTextureHandler:

 

 

package net.minecraft.src;

 

import net.minecraft.src.forge.ITextureProvider;

 

public class ItemSeedsTextureHandler extends ItemSeeds implements ITextureProvider

 

{

  public ItemSeedsTextureHandler (int par1, int par2, int par3) {

  super(par1,par2,par3);

  }

public String getTextureFile()

    {

            return "/FoodMod/gui/items.png";

    }

 

 

{

 

}

}

 

Posted

Item Etc:

 

public class mod_Food extends BaseMod

{

public static final Item PotatoSeed = new ItemSeedsTextureHandler(386, mod_Food.Potato.blockID, Block.tilledField.blockID).setItemName("PotatoSeed").setIconIndex(8);

 

static {

ModLoader.addName(PotatoSeed, "Potato Seed");

 

public String getVersion()

{

return "1.2.5";}

 

public void load() {

MinecraftForge.addGrassSeed(386,0,1,10);

}

 

 

} }

 

 

ItemSeedsTextureHandler:

 

 

package net.minecraft.src;

 

import net.minecraft.src.forge.ITextureProvider;

 

public class ItemSeedsTextureHandler extends ItemSeeds implements ITextureProvider

 

{

  public ItemSeedsTextureHandler (int par1, int par2, int par3) {

  super(par1,par2,par3);

  }

public String getTextureFile()

    {

            return "/FoodMod/gui/items.png";

    }

 

 

{

 

}

}

 

 

For note, you completely ignored what Lex stated, look at this:

MinecraftForge.addGrassSeed(386,0,1,10);

So you use the shifted itemID of 386, however your item uses this:

public static final Item PotatoSeed = new ItemSeedsTextureHandler(386, mod_Food.Potato.blockID, Block.tilledField.blockID)./*snip*/;

Which is a *non*shifted itemID of 386.

 

As Lex said, you need to use the shifted itemID, either of these will work:

MinecraftForge.addGrassSeed(PotatoSeed.itemID,0,1,10);

MinecraftForge.addGrassSeed(386+256,0,1,10);

 

Remember, Minecraft is stupid with itemIDs, you need to take the stupidity in to account.

  • 2 weeks later...
Posted

Item Etc:

 

public class mod_Food extends BaseMod //if you plan to make it smp change BaseMod to NetworkMod

{

public static final Item PotatoSeed = new ItemSeedsTextureHandler(386, mod_Food.Potato.blockID, Block.tilledField.blockID).setItemName("PotatoSeed").setIconIndex(8);

 

static {

ModLoader.addName(PotatoSeed, "Potato Seed");

 

public String getVersion()

{

return "1.2.5";}

 

public void load() {

MinecraftForge.addGrassSeed(386,0,1,10);

}

 

 

} }

 

 

ItemSeedsTextureHandler:

 

 

package net.minecraft.src;

 

import net.minecraft.src.forge.ITextureProvider;

 

public class ItemSeedsTextureHandler extends ItemSeeds implements ITextureProvider

 

{

  public ItemSeedsTextureHandler (int par1, int par2, int par3) {

  super(par1,par2,par3);

  }

public String getTextureFile()

    {

            return "/FoodMod/gui/items.png";

    }

 

 

{

 

}

}

 

 

 

 

public class mod_Food extends BaseMod

{

public static final Item PotatoSeed = new ItemSeedsTextureHandler(386, mod_Food.Potato.blockID, Block.tilledField.blockID).setItemName("PotatoSeed").setIconIndex(8);

 

static {

ModLoader.addName(PotatoSeed, "Potato Seed");

 

public String getVersion()

{

return "1.2.5";}

 

public void load() {

MinecraftForge.addGrassSeed(PotatoSeed.itemID,0,1,10); //i think its itemID, if not change it to shiftedIndex

}

 

 

} }

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.