After coding in a flower block with plenty of guessing, and adding a item to drop from the flower block, I've cut my errors down by 1. Surprisingly to me, I only had 3 to begin with. I have no idea what the first error means, but the second one, I'm pretty sure, is directed at the item's texture, even though I know the location I set it to is right.
== MCP v4.3 ==
> Recompiling client...
javac.exe -g -verbose -classpath "lib/;lib/*;jars/bin/minecraft.jar;jars/bin/jin
put.jar;jars/bin/lwjgl.jar;jars/bin/lwjgl_util.jar" -sourcepath src/minecraft -d
bin/minecraft src/minecraft\net\minecraft\client\*.java src/minecraft\net\minec
raft\isom\*.java src/minecraft\net\minecraft\src\*.java conf/patches/*.java fai
led.
Return code : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\mod_DesertFlower.java:6: error: cannot find symb
ol
public static final FlowerBlock desertFlower = new BlockDesertFlower(1999, 10).s
etHardness(0.0F).setBlockName("desertFlower");
^
symbol: class FlowerBlock
location: class mod_DesertFlower
src\minecraft\net\minecraft\src\mod_Desert.java:24: error: cannot find symbol
desertFruit.iconIndex = Modloader.addOverride("/gui/items.png", "/DesertTextures
/DesertFruit.png");
^
symbol: variable Modloader
location: class mod_Desert
2 errors
==================
> Done in 6.78 seconds
> Recompiling server...
!! Can not find server sources !!
Press any key to continue . . .
Can anyone help me with this?
mod_Block code
package net.minecraft.src;
import java.util.Random;
public class mod_DesertFlower extends BaseMod
{
public static final FlowerBlock desertFlower = new BlockDesertFlower(1999, 10).setHardness(0.0F).setBlockName("desertFlower");
public mod_DesertFlower()
{
ModLoader.RegisterBlock(desertFlower);
desertFlower.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/DesertTextures/DesertFlower.png");
ModLoader.addName(desertFlower, "Desert Flower");
}
public String Version()
{
return "3.14159265";
}
}
Block
package net.minecraft.src;
import java.util.Random;
public class BlockDesertFlower extends BlockFlower
{
protected BlockDesertFlower(int i, int j)
{
super (i,j);
float f = 0.4F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f);
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.sand.blockID;
}
public int idDropped(int i, Random random)
{
return mod_Desert.desertFruit.shiftedIndex;
}
public int quantityDropped(Random random)
{
return 3;
}
}
item
package net.minecraft.src;
public class ItemDesertFruit extends Item
{
private int healAmount;
public ItemDesertFruit (int i)
{
super (i);
maxStackSize = 1;
healAmount = 4;
}
public int getHealAmount()
{
return healAmount;
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
itemstack.stackSize--;
entityplayer.heal(healAmount);
return itemstack;
}
}
First error is because you wrote FlowerBlock instead of BlockFlower, like Kegan187 said. The other error is because you wrote Modloader instead of ModLoader. Hope this helps.
I'll fix those. I knew it would be something small like that. It always is. First error is still there, though the second one was fixed and replaced by a new one.
== MCP v4.3 ==
> Recompiling client...
javac.exe -g -verbose -classpath "lib/;lib/*;jars/bin/minecraft.jar;jars/bin/jin
put.jar;jars/bin/lwjgl.jar;jars/bin/lwjgl_util.jar" -sourcepath src/minecraft -d
bin/minecraft src/minecraft\net\minecraft\client\*.java src/minecraft\net\minec
raft\isom\*.java src/minecraft\net\minecraft\src\*.java conf/patches/*.java fai
led.
Return code : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\mod_DesertFlower.java:6: error: incompatible typ
es
public static final BlockFlower desertFlower = new BlockDesertFlower(1999, 10).s
etHardness(0.0F).setBlockName("desertFlower");
^
required: BlockFlower
found: Block
src\minecraft\net\minecraft\src\mod_DesertFlower.java:11: error: cannot find sym
bol
ModLoader.addName(desertFlower, "Desert Flower");
^
symbol: method addName(BlockFlower,String)
location: class ModLoader
2 errors
==================
> Done in 15.30 seconds
> Recompiling server...
!! Can not find server sources !!
Press any key to continue . . .
Second error is easy, you just wrote addName instead of AddName.
First error is a little bit trickier, you have to cast desertFlower to BlockFlower. I don't fully understand casting, but I know you have to do it with flowers. To fix it, just add (BlockFlower) before your declaration, like this:
public static final BlockFlower desertFlower = (BlockFlower)new BlockDesertFlower(1999, 10).setHardness(0.0F).setBlockName("desertFlower");
Minecraft crashes right after I open it in Eclipse :/
That is because you used a texture override. You can't launch it from MCP or Eclipse or it crashes. Install it into your regular minecraft and it will work.
That is because you used a texture override. You can't launch it from MCP or Eclipse or it crashes. Install it into your regular minecraft and it will work.
Aug 22, 2011 10:02:44 PM ModLoader init
FINE: ModLoader Beta 1.7.3 Initializing...
Aug 22, 2011 10:02:44 PM ModLoader readFromClassPath
FINER: Adding mods from C:\Users\OEM\AppData\Roaming\.minecraft\bin\minecraft.jar
Aug 22, 2011 10:02:44 PM ModLoader readFromClassPath
FINER: Zip found.
Aug 22, 2011 10:02:44 PM ModLoader addMod
FINE: Failed to load mod from "mod_Desert.class"
Aug 22, 2011 10:02:44 PM ModLoader addMod
FINER: THROW
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at ModLoader.addMod(ModLoader.java:272)
at ModLoader.readFromClassPath(ModLoader.java:1104)
at ModLoader.init(ModLoader.java:812)
at ModLoader.AddAllRenderers(ModLoader.java:183)
at th.<init>(th.java:60)
at th.<clinit>(th.java:9)
at net.minecraft.client.Minecraft.a(SourceFile:318)
at net.minecraft.client.Minecraft.run(SourceFile:716)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1999
at uu.<init>(SourceFile:243)
at wb.<init>(SourceFile:11)
at BlockDesertFlower.<init>(BlockDesertFlower.java:8)
at mod_Desert.<clinit>(mod_Desert.java:9)
... 15 more
Aug 22, 2011 10:02:54 PM ModLoader AddAllRenderers
FINE: Initialized
Aug 22, 2011 10:02:44 PM ModLoader init
FINE: ModLoader Beta 1.7.3 Initializing...
Aug 22, 2011 10:02:44 PM ModLoader readFromClassPath
FINER: Adding mods from C:\Users\OEM\AppData\Roaming\.minecraft\bin\minecraft.jar
Aug 22, 2011 10:02:44 PM ModLoader readFromClassPath
FINER: Zip found.
Aug 22, 2011 10:02:44 PM ModLoader addMod
FINE: Failed to load mod from "mod_Desert.class"
Aug 22, 2011 10:02:44 PM ModLoader addMod
FINER: THROW
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at ModLoader.addMod(ModLoader.java:272)
at ModLoader.readFromClassPath(ModLoader.java:1104)
at ModLoader.init(ModLoader.java:812)
at ModLoader.AddAllRenderers(ModLoader.java:183)
at th.<init>(th.java:60)
at th.<clinit>(th.java:9)
at net.minecraft.client.Minecraft.a(SourceFile:318)
at net.minecraft.client.Minecraft.run(SourceFile:716)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1999
at uu.<init>(SourceFile:243)
at wb.<init>(SourceFile:11)
at BlockDesertFlower.<init>(BlockDesertFlower.java:8)
at mod_Desert.<clinit>(mod_Desert.java:9)
... 15 more
Aug 22, 2011 10:02:54 PM ModLoader AddAllRenderers
FINE: Initialized
Yep. Also, change the 10 right after the id, the location of the texture, to 0 or put ModLoader.addOverride("/terrain.png", "/DesertTextures/DesertFlower.png");
Yep. Also, change the 10 right after the id, the location of the texture, to 0 or put ModLoader.addOverride("/terrain.png", "/DesertTextures/DesertFlower.png");
Isn't that number supposed to specify the line that the override is on?
Can anyone help me with this?
mod_Block code
Block
item
First error is a little bit trickier, you have to cast desertFlower to BlockFlower. I don't fully understand casting, but I know you have to do it with flowers. To fix it, just add (BlockFlower) before your declaration, like this:
Thanks for the help. Now I have to test it to see how it spawns, if it drops, and a few other things :tongue.gif:
That is because you used a texture override. You can't launch it from MCP or Eclipse or it crashes. Install it into your regular minecraft and it will work.
Just tried that and it crashed that too.
Also, you might have to change BlockDesertFlower to Flower.
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1999
I guess that's not a usable block id? :tongue.gif:
Blocks can have any id from 1-256 as long as it isn't already taken.
Well there's the problem :tongue.gif:
Yep. Also, change the 10 right after the id, the location of the texture, to 0 or put ModLoader.addOverride("/terrain.png", "/DesertTextures/DesertFlower.png");
Isn't that number supposed to specify the line that the override is on?
No, its best if you just put it there instead of the number. I think so anyway.