- It's set in my code good with that name
- The picture in my /bin/Mod_Pics is called that
- And I have no errors in Eclipse
So everything is set how its set to be but the minecraft tells me that the image is not found!
java.lang.RuntimeException: java.lang.Exception: Image not found: /Mod_Pics/Crop3.png
at net.minecraft.src.ModLoader.RegisterAllTextureOverrides(ModLoader.java:1356)
at net.minecraft.src.ModLoader.OnTick(ModLoader.java:1069)
at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:18)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:740)
at net.minecraft.client.Minecraft.run(Minecraft.java:637)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.Exception: Image not found: /Mod_Pics/Crop3.png
at net.minecraft.src.ModLoader.loadImage(ModLoader.java:1007)
at net.minecraft.src.ModLoader.RegisterAllTextureOverrides(ModLoader.java:1348)
... 5 more
OMG! I gotta stop taking hiatus' from these forums. So many people needing help, and me not being here to do so. It's a shame really. Either way I'm back (for now) and here to answer as many questions as I can. I will also try to update the tutorial if need be.
Hi i have the same problem with the bone meal. Here is my code:
package net.minecraft.src;
import java.util.Random;
public class BlockTomato extends BlockFlower
{
protected BlockTomato(int i, int j)
{
super(i, j);
setTickOnLoad(true); // If you copied and pasted you'll notice I took out the BlockInTexture part.
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.tilledField.blockID;
}
public void updateTick(World world, int i, int j, int k, Random random)
{
super.updateTick(world, i, j, k, random);
if(world.getBlockLightValue(i, j + 1, k) >= 9)
{
int l = world.getBlockMetadata(i, j, k);
if(l < 7)
{
float f = getGrowthRate(world, i, j, k);
if(random.nextInt((int)(25F / f) + 1) == 0)
{
l++;
world.setBlockMetadataWithNotify(i, j, k, l);
}
}
}
}
public void fertilize(World world, int i, int j, int k)
{
world.setBlockMetadataWithNotify(i, j, k, 7);
}
private float getGrowthRate(World world, int i, int j, int k)
{
float f = 1.0F;
int l = world.getBlockId(i, j, k - 1);
int i1 = world.getBlockId(i, j, k + 1);
int j1 = world.getBlockId(i - 1, j, k);
int k1 = world.getBlockId(i + 1, j, k);
int l1 = world.getBlockId(i - 1, j, k - 1);
int i2 = world.getBlockId(i + 1, j, k - 1);
int j2 = world.getBlockId(i + 1, j, k + 1);
int k2 = world.getBlockId(i - 1, j, k + 1);
boolean flag = j1 == blockID || k1 == blockID;
boolean flag1 = l == blockID || i1 == blockID;
boolean flag2 = l1 == blockID || i2 == blockID || j2 == blockID || k2 == blockID;
for(int l2 = i - 1; l2 <= i + 1; l2++)
{
for(int i3 = k - 1; i3 <= k + 1; i3++)
{
int j3 = world.getBlockId(l2, j - 1, i3);
float f1 = 0.0F;
if(j3 == Block.tilledField.blockID)
{
f1 = 1.0F;
if(world.getBlockMetadata(l2, j - 1, i3) > 0)
{
f1 = 3F;
}
}
if(l2 != i || i3 != k)
{
f1 /= 4F;
}
f += f1;
}
}
if(flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
// BIGGEST CHANGE IN THIS FILE. Making the textures increment up and determining the texture for each.
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_FoodGalore.tomatoCrop1;
}
if(j == 2)
{
return mod_FoodGalore.tomatoCrop1; // In order to not have to change a lot more code we can just make
} // the plant grow the same but make it "look" like it has fewer steps
if(j == 3) // Through 8 steps the sequence is 0, 1, 1, 2, 2, 3, 3, 4.
{
return mod_FoodGalore.tomatoCrop2;
}
if(j == 4)
{
return mod_FoodGalore.tomatoCrop2;
}
if(j == 5)
{
return mod_FoodGalore.tomatoCrop3;
}
if(j == 6)
{
return mod_FoodGalore.tomatoCrop3;
}
if(j == 7)
{
return mod_FoodGalore.tomatoCrop4;
}
return -1;
}
public int getRenderType()
{
return 1; // This makes the textures look MUCH better than 6 which makes an ugly square like wheat.
}
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
{
super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0);
if(world.multiplayerWorld)
{
return;
}
int j1 = 3 + i1;
for(int k1 = 0; k1 < j1; k1++)
{
if(world.rand.nextInt(15) <= l)
{
float f1 = 0.7F;
float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(mod_FoodGalore.tomatoSeeds)); // BLAH BLAH BLAH Change this and seeds will drop before grown and when fully grown
entityitem.delayBeforeCanPickup = 10;
world.entityJoinedWorld(entityitem);
}
}
}
public int idDropped(int i, Random random, int j)
{
if(i == 7)
{
return mod_FoodGalore.tomatoVegetable.shiftedIndex;
} else
{
return -1;
}
}
public int quantityDropped(Random random)
{
return 1;
}
}
OK sorry such a long wait, and with out resolve because I had the same problem. It's due to the BlockCrops.class and since we never want to modify notches work (compatibility speaking) we just have to deal with it until we find a way to override those seeds from dropping. I haven't really looked too far into it since the OP was written so I may come back with an answer soon.
Now, I have a question. Where exactly do I need to put an image that I'm referencing? Do I put it in the minecraft.jar file or where? Any help would be greatly appreciated!
This is an easy one but even I forget to reference correctly sometimes.
When you are referencing an image it normally goes into the Public Static Final after the declared item/block ID, BUT in this case we have to declare them outside that statement with a ModLoader.addOverride function like so:
This can also be used with .ShiftedIndex for Items.
Okay so back to the question. Where do I put the images? MCPxx/bin/minecraft/MYMODIMAGEFOLDER this is of course pertaining to the example above. You should be able to see the similarities.
- It's set in my code good with that name
- The picture in my /bin/Mod_Pics is called that
- And I have no errors in Eclipse
So everything is set how its set to be but the minecraft tells me that the image is not found!
java.lang.RuntimeException: java.lang.Exception: Image not found: /Mod_Pics/Crop3.png
at net.minecraft.src.ModLoader.RegisterAllTextureOverrides(ModLoader.java:1356)
at net.minecraft.src.ModLoader.OnTick(ModLoader.java:1069)
at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:18)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:740)
at net.minecraft.client.Minecraft.run(Minecraft.java:637)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.Exception: Image not found: /Mod_Pics/Crop3.png
at net.minecraft.src.ModLoader.loadImage(ModLoader.java:1007)
at net.minecraft.src.ModLoader.RegisterAllTextureOverrides(ModLoader.java:1348)
... 5 more
Eclipse wouldn't show an image error so that kinda sucks, but the problem is the capital "C" in crop3.png change them to lower-case and you'll be fine.
src/minecraft/net/minecraft/src/BlockTomato.java:149: cannot find symbol
symbol : method entityJoinedWorld(net.minecraft.src.EntityItem)
location: class net.minecraft.src.World
world.entityJoinedWorld(entityitem);
^
1 error
I need to see your code in order to find out where your problem is, but I am sure it has something to do with your changes to the Drop Item with Chance function. Please use CODE tags and SPOILER tags too please. KKTHANXBAI
I have a problem... i did every thing and its work with bonemean and without it but when i "break" the fully grown crop its drop the custom item the custom seeds but the regular seeds too... why?
DO AS I SAY!
Change this
world.entityJoinedWorld(entityitem);
to
world.spawnEntityInWorld(entityitem);
in your "dropBlockAsItemWithChance" DO NOT USE THAT QUICK ERROR FIX 'Create Method for entityJoinedWorld'
Hello :smile.gif:
Thank you for your help ^^ This didn't work BUT I've found a solution ^^
Here it is, I hope they can help someone else ^^
1) You must know that BoneMeal is a DYE and they have special code in ItemDye.java, so when we open this files we can see that every things that can be Fertilize is declared with some code (grass, crops, mushroom and tree).
2) If we want to fertilize our crop we need to add code in this files or create a new item, I've choice to create a new item : Fertilizer
If you prefer to modify BoneMeal, you just need to copy/past "Crops" code and adapt it to your crops :smile.gif: You can look my files to see how ^^
3) When you've done, they will work fine but don't show your crop correctly after you have fertilize :/ If you broke the crops you will get right item, getting me crazy ^^" Just add the code propose by Navybofus and TADAAAAAAAAA everythings will work perfectly ^^
Here is my code :
ItemFertilizer.java
I want that my Fertilizer do everything that bonemeal can do + Fertilize my own crop
package net.minecraft.src;
import java.util.Random;
public class ItemFertilizer extends Item
{
public ItemFertilizer(int i)
{
super(i);
setMaxStackSize(64);
}
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
int i1 = world.getBlockId(i, j, k);
if(i1 == Block.sapling.blockID)
{
if(!world.multiplayerWorld)
{
((BlockSapling)Block.sapling).growTree(world, i, j, k, world.rand);
itemstack.stackSize--;
}
return true;
}
if(i1 == Block.mushroomBrown.blockID || i1 == Block.mushroomRed.blockID)
{
if(!world.multiplayerWorld && ((BlockMushroom)Block.blocksList[i1]).func_35293_c(world, i, j, k, world.rand))
{
itemstack.stackSize--;
}
return true;
}
if(i1 == Block.melonStem.blockID || i1 == Block.pumpkinStem.blockID)
{
if(!world.multiplayerWorld)
{
((BlockStem)Block.blocksList[i1]).func_35294_i(world, i, j, k);
itemstack.stackSize--;
}
return true;
}
if(i1 == Block.crops.blockID)
{
if(!world.multiplayerWorld)
{
((BlockCrops)Block.crops).fertilize(world, i, j, k);
itemstack.stackSize--;
}
return true;
}
//TomatoCrop
if(i1 == mod_TomatoCrop.newCrop.blockID)
{
if(!world.multiplayerWorld)
{
//You MUST add (BlockCrops) before your variable or they don't work
//newCrop is the name I've use for my variable in mod_TomatoCrop
((BlockCrops)mod_TomatoCrop.newCrop).fertilize(world, i, j, k);
itemstack.stackSize--;
}
return true;
}
if(i1 == Block.grass.blockID)
{
if(!world.multiplayerWorld)
{
itemstack.stackSize--;
label0:
for(int j1 = 0; j1 < 128; j1++)
{
int k1 = i;
int l1 = j + 1;
int i2 = k;
for(int j2 = 0; j2 < j1 / 16; j2++)
{
k1 += itemRand.nextInt(3) - 1;
l1 += ((itemRand.nextInt(3) - 1) * itemRand.nextInt(3)) / 2;
i2 += itemRand.nextInt(3) - 1;
if(world.getBlockId(k1, l1 - 1, i2) != Block.grass.blockID || world.isBlockNormalCube(k1, l1, i2))
{
continue label0;
}
}
if(world.getBlockId(k1, l1, i2) != 0)
{
continue;
}
if(itemRand.nextInt(10) != 0)
{
world.setBlockAndMetadataWithNotify(k1, l1, i2, Block.tallGrass.blockID, 1);
continue;
}
if(itemRand.nextInt(3) != 0)
{
world.setBlockWithNotify(k1, l1, i2, Block.plantYellow.blockID);
} else
{
world.setBlockWithNotify(k1, l1, i2, Block.plantRed.blockID);
}
}
}
return true;
}
return true;
}
}
Extract of mod_TomatoCrop.java
Here I've just added the last proposition of navybofus to get everything right :smile.gif:
If you don't do this, your crop will not display the right image when they grow up to the last stage :/
public static final Block newCrop = new BlockTomatoCrop(202, 0).setHardness(0.0F).setBlockName("newCrop").disableStats().setRequiresSelfNotify();
(edit) Don't forgot to extend BlockCrops and not BlockFlower :smile.gif:
Extract of BlockTomatoCrop.java
public class BlockTomatoCrop extends BlockCrops
Have a nice day
Narcisse
i get a error with func_35293 on line 28 and on line 38 func_35294 also has a error i can run the game perfectly but useing the fertaliser causes the game to complain that this function doesnt exist. below i have my codeing
package net.minecraft.src;
import java.util.Random;
public class Itemplantfood extends Item
{
public Itemplantfood(int i)
{
super(i);
setMaxStackSize(64);
}
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
int i1 = world.getBlockId(i, j, k);
if(i1 == Block.sapling.blockID)
{
if(!world.multiplayerWorld)
{
((BlockSapling)Block.sapling).growTree(world, i, j, k, world.rand);
itemstack.stackSize--;
}
return true;
}
if(i1 == Block.mushroomBrown.blockID || i1 == Block.mushroomRed.blockID)
{
if(!world.multiplayerWorld && ((BlockMushroom)Block.blocksList[i1]).func_35293_c(world, i, j, k, world.rand))
{
itemstack.stackSize--;
}
return true;
}
if(i1 == Block.melonStem.blockID || i1 == Block.pumpkinStem.blockID)
{
if(!world.multiplayerWorld)
{
((BlockStem)Block.blocksList[i1]).func_35294_i(world, i, j, k);
itemstack.stackSize--;
}
return true;
}
if(i1 == Block.crops.blockID)
{
if(!world.multiplayerWorld)
{
((BlockCrops)Block.crops).fertilize(world, i, j, k);
itemstack.stackSize--;
}
return true;
}
//TomatoCrop
if(i1 == mod_daniel11111112farm.carrotcrop.blockID)
{
if(!world.multiplayerWorld)
{
//You MUST add (BlockCrops) before your variable or they don't work
//newCrop is the name I've use for my variable in mod_TomatoCrop
((BlockCrops)mod_daniel11111112farm.carrotcrop).fertilize(world, i, j, k);
itemstack.stackSize--;
}
return true;
}
if(i1 == Block.grass.blockID)
{
if(!world.multiplayerWorld)
{
itemstack.stackSize--;
label0:
for(int j1 = 0; j1 < 128; j1++)
{
int k1 = i;
int l1 = j + 1;
int i2 = k;
for(int j2 = 0; j2 < j1 / 16; j2++)
{
k1 += itemRand.nextInt(3) - 1;
l1 += ((itemRand.nextInt(3) - 1) * itemRand.nextInt(3)) / 2;
i2 += itemRand.nextInt(3) - 1;
if(world.getBlockId(k1, l1 - 1, i2) != Block.grass.blockID || world.isBlockNormalCube(k1, l1, i2))
{
continue label0;
}
}
if(world.getBlockId(k1, l1, i2) != 0)
{
continue;
}
if(itemRand.nextInt(10) != 0)
{
world.setBlockAndMetadataWithNotify(k1, l1, i2, Block.tallGrass.blockID, 1);
continue;
}
if(itemRand.nextInt(3) != 0)
{
world.setBlockWithNotify(k1, l1, i2, Block.plantYellow.blockID);
} else
{
world.setBlockWithNotify(k1, l1, i2, Block.plantRed.blockID);
}
}
}
return true;
}
return true;
}
}
That is strange, but the first thing that comes to mind is the material of the crop being stone or higher. This means that when you destroy the crop that it doesn't render anything because it's material can't be harvested via "your hands" you'd need a hoe or some other tool. I recommend adding this to the protected block function in the crop's class in place of your super statement.
super(i, Material.plants);
inside of
protected BlockCropsTomato(int i, int j)
{
super(i, j);
setTickOnLoad(true);
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
If you still have problems please post your tomato crop's class here in a spoiler tag.
I tried adding the Super statement with the material.plants in it but I just get errors... I still only get my items though when i break the block, not the crop. Any Help!?!?!
public static final Item ThistleSeeds = new ItemThistleSeeds(593, mod_Thistle.ThistleCrop.blockID, Block.tilledField.blockID);
public static final Item ThistleItem = new ItemThistle(594, 2, 0.6F, false).setItemName("itemthistle");
For the first line, the error is "ItemThistleSeeds cannot be resolved to a type".
For the second line, the error is "ItemThistle cannot be resolved to a type".
I have a problem... i did every thing and its work with bonemean and without it but when i "break" the fully grown crop its drop the custom item the custom seeds but the regular seeds too... why?
You need to make a new seed type too. I would suggest copying the ItemSeeds file, and changing the 'wheat' to whatever your plant name is.
16:06:28 - == ERRORS FOUND ==
16:06:28 -
16:06:28 - src\minecraft\net\minecraft\src\BlockNewCrop.java:11: cannot find symbol
16:06:28 - symbol : method setTickOnLoad(boolean)
16:06:28 - location: class net.minecraft.src.BlockNewCrop
16:06:28 - setTickOnLoad(true); // If you copied and pasted you'll notice I took out the BlockInTexture part.
16:06:28 - ^
16:06:28 -
16:06:28 - src\minecraft\net\minecraft\src\BlockNewCrop.java:134: cannot find symbol
16:06:28 - symbol : variable multiplayerWorld
16:06:28 - location: class net.minecraft.src.World
16:06:28 - if(world.multiplayerWorld)
16:06:28 - ^
16:06:28 -
16:06:28 - 2 errors
16:06:28 - ==================
16:06:28 -
16:06:28 - !! Can not find server sources, try decompiling !!
My code:
package net.minecraft.src;
import java.util.Random;
public class BlockNewCrop extends BlockFlower
{
protected BlockNewCrop(int i, int j)
{
super(i, j);
setTickOnLoad(true);
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.tilledField.blockID;
}
public void updateTick(World world, int i, int j, int k, Random random)
{
super.updateTick(world, i, j, k, random);
if(world.getBlockLightValue(i, j + 1, k) >= 9)
{
int l = world.getBlockMetadata(i, j, k);
if(l < 7)
{
float f = getGrowthRate(world, i, j, k);
if(random.nextInt((int)(25F / f) + 1) == 0)
{
l++;
world.setBlockMetadataWithNotify(i, j, k, l);
}
}
}
}
public void fertilize(World world, int i, int j, int k)
{
world.setBlockMetadataWithNotify(i, j, k, 7);
}
private float getGrowthRate(World world, int i, int j, int k)
{
float f = 1.0F;
int l = world.getBlockId(i, j, k - 1);
int i1 = world.getBlockId(i, j, k + 1);
int j1 = world.getBlockId(i - 1, j, k);
int k1 = world.getBlockId(i + 1, j, k);
int l1 = world.getBlockId(i - 1, j, k - 1);
int i2 = world.getBlockId(i + 1, j, k - 1);
int j2 = world.getBlockId(i + 1, j, k + 1);
int k2 = world.getBlockId(i - 1, j, k + 1);
boolean flag = j1 == blockID || k1 == blockID;
boolean flag1 = l == blockID || i1 == blockID;
boolean flag2 = l1 == blockID || i2 == blockID || j2 == blockID || k2 == blockID;
for(int l2 = i - 1; l2 <= i + 1; l2++)
{
for(int i3 = k - 1; i3 <= k + 1; i3++)
{
int j3 = world.getBlockId(l2, j - 1, i3);
float f1 = 0.0F;
if(j3 == Block.tilledField.blockID)
{
f1 = 1.0F;
if(world.getBlockMetadata(l2, j - 1, i3) > 0)
{
f1 = 3F;
}
}
if(l2 != i || i3 != k)
{
f1 /= 4F;
}
f += f1;
}
}
if(flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
// BIGGEST CHANGE IN THIS FILE. Making the textures increment up and determining the texture for each.
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_Plants.newCrop1;
}
if(j == 2)
{
return mod_Plants.newCrop1; // In order to not have to change a lot more code we can just make
} // the plant grow the same but make it "look" like it has fewer steps
if(j == 3) // Through 8 steps the sequence is 0, 1, 1, 2, 2, 3, 3, 4.
{
return mod_Plants.newCrop2;
}
if(j == 4)
{
return mod_Plants.newCrop2;
}
if(j == 5)
{
return mod_Plants.newCrop3;
}
if(j == 6)
{
return mod_Plants.newCrop3;
}
if(j == 7)
{
return mod_Plants.newCrop4;
}
return -1;
}
public int getRenderType()
{
return 1; // This makes the textures look MUCH better than 6 which makes an ugly square like wheat.
}
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
{
super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0);
if(world.multiplayerWorld)
{
return;
}
int j1 = 3 + i1;
for(int k1 = 0; k1 < j1; k1++)
{
if(world.rand.nextInt(15) <= l)
{
float f1 = 0.7F;
float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(mod_Plants.newSeeds)); // BLAH BLAH BLAH Change this and seeds will drop before grown and when fully grown
entityitem.delayBeforeCanPickup = 10;
/* This next part is NEW and allows for only YOUR seeds
to drop instead of your seeds and MC's default seeds.
~~Thanks Puta4Life! */
world.spawnEntityInWorld(entityitem);
}
}
}
public int idDropped(int i, Random random, int j)
{
if(i == 7)
{
return mod_Plants.newVegetable.shiftedIndex; //Fully Grown? Drop VEGGIE!
} else
{
return -1;
}
}
public int quantityDropped(Random random)
{
return 1; // How many veggie you want? 1, 2, 50?
}
}
Edit: Problem solved.
my new code:
package net.minecraft.src;
import java.util.Random;
public class BlockNewCrop extends BlockFlower
{
protected BlockNewCrop(int i, int j)
{
super(i, j);
setTickRandomly(true);
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.tilledField.blockID;
}
public void updateTick(World par1World, int i, int j, int k, Random random)
{
super.updateTick(par1World, i, j, k, random);
if(par1World.getBlockLightValue(i, j + 1, k) >= 9)
{
int l = par1World.getBlockMetadata(i, j, k);
if(l < 7)
{
float f = getGrowthRate(par1World, i, j, k);
if(random.nextInt((int)(25F / f) + 1) == 0)
{
l++;
par1World.setBlockMetadataWithNotify(i, j, k, l);
}
}
}
}
public void fertilize(World par1World, int i, int j, int k)
{
par1World.setBlockMetadataWithNotify(i, j, k, 7);
}
private float getGrowthRate(World par1World, int i, int j, int k)
{
float f = 1.0F;
int l = par1World.getBlockId(i, j, k - 1);
int i1 = par1World.getBlockId(i, j, k + 1);
int j1 = par1World.getBlockId(i - 1, j, k);
int k1 = par1World.getBlockId(i + 1, j, k);
int l1 = par1World.getBlockId(i - 1, j, k - 1);
int i2 = par1World.getBlockId(i + 1, j, k - 1);
int j2 = par1World.getBlockId(i + 1, j, k + 1);
int k2 = par1World.getBlockId(i - 1, j, k + 1);
boolean flag = j1 == blockID || k1 == blockID;
boolean flag1 = l == blockID || i1 == blockID;
boolean flag2 = l1 == blockID || i2 == blockID || j2 == blockID || k2 == blockID;
for(int l2 = i - 1; l2 <= i + 1; l2++)
{
for(int i3 = k - 1; i3 <= k + 1; i3++)
{
int j3 = par1World.getBlockId(l2, j - 1, i3);
float f1 = 0.0F;
if(j3 == Block.tilledField.blockID)
{
f1 = 1.0F;
if(par1World.getBlockMetadata(l2, j - 1, i3) > 0)
{
f1 = 3F;
}
}
if(l2 != i || i3 != k)
{
f1 /= 4F;
}
f += f1;
}
}
if(flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
// BIGGEST CHANGE IN THIS FILE. Making the textures increment up and determining the texture for each.
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_Plants.newCrop1;
}
if(j == 2)
{
return mod_Plants.newCrop1; // In order to not have to change a lot more code we can just make
} // the plant grow the same but make it "look" like it has fewer steps
if(j == 3) // Through 8 steps the sequence is 0, 1, 1, 2, 2, 3, 3, 4.
{
return mod_Plants.newCrop2;
}
if(j == 4)
{
return mod_Plants.newCrop2;
}
if(j == 5)
{
return mod_Plants.newCrop3;
}
if(j == 6)
{
return mod_Plants.newCrop3;
}
if(j == 7)
{
return mod_Plants.newCrop4;
}
return -1;
}
public int getRenderType()
{
return 1; // This makes the textures look MUCH better than 6 which makes an ugly square like wheat.
}
public void dropBlockAsItemWithChance(World par1World, int i, int j, int k, int l, float f, int i1)
{
super.dropBlockAsItemWithChance(par1World, i, j, k, l, f, 0);
if(par1World.isRemote)
{
return;
}
int j1 = 3 + i1;
for(int k1 = 0; k1 < j1; k1++)
{
if(par1World.rand.nextInt(15) <= l)
{
float f1 = 0.7F;
float f2 = par1World.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f3 = par1World.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f4 = par1World.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
EntityItem entityitem = new EntityItem(par1World, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(mod_Plants.newSeeds)); // BLAH BLAH BLAH Change this and seeds will drop before grown and when fully grown
entityitem.delayBeforeCanPickup = 10;
/* This next part is NEW and allows for only YOUR seeds
to drop instead of your seeds and MC's default seeds.
~~Thanks Puta4Life! */
par1World.spawnEntityInWorld(entityitem);
}
}
}
public int idDropped(int i, Random random, int j)
{
if(i == 7)
{
return mod_Plants.newVegetable.shiftedIndex; //Fully Grown? Drop VEGGIE!
} else
{
return -1;
}
}
public int quantityDropped(Random random)
{
return 5; // How many veggie you want? 1, 2, 50?
}
}
- It's set in my code good with that name
- The picture in my /bin/Mod_Pics is called that
- And I have no errors in Eclipse
So everything is set how its set to be but the minecraft tells me that the image is not found!
java.lang.RuntimeException: java.lang.Exception: Image not found: /Mod_Pics/Crop3.png
at net.minecraft.src.ModLoader.RegisterAllTextureOverrides(ModLoader.java:1356)
at net.minecraft.src.ModLoader.OnTick(ModLoader.java:1069)
at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:18)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:740)
at net.minecraft.client.Minecraft.run(Minecraft.java:637)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.Exception: Image not found: /Mod_Pics/Crop3.png
at net.minecraft.src.ModLoader.loadImage(ModLoader.java:1007)
at net.minecraft.src.ModLoader.RegisterAllTextureOverrides(ModLoader.java:1348)
... 5 more
Try this out! Props to Methuselah96 for making a lot of tutorials!
http://www.minecraftforum.net/topic/854952-creating-mods-minecraft-forge-28112/#bonemeal
OK sorry such a long wait, and with out resolve because I had the same problem. It's due to the BlockCrops.class and since we never want to modify notches work (compatibility speaking) we just have to deal with it until we find a way to override those seeds from dropping. I haven't really looked too far into it since the OP was written so I may come back with an answer soon.
This is an easy one but even I forget to reference correctly sometimes.
When you are referencing an image it normally goes into the Public Static Final after the declared item/block ID, BUT in this case we have to declare them outside that statement with a ModLoader.addOverride function like so:
This can also be used with .ShiftedIndex for Items.
Okay so back to the question. Where do I put the images? MCPxx/bin/minecraft/MYMODIMAGEFOLDER this is of course pertaining to the example above. You should be able to see the similarities.
Eclipse wouldn't show an image error so that kinda sucks, but the problem is the capital "C" in crop3.png change them to lower-case and you'll be fine.
I need to see your code in order to find out where your problem is, but I am sure it has something to do with your changes to the Drop Item with Chance function. Please use CODE tags and SPOILER tags too please. KKTHANXBAI
DO AS I SAY!
Change this to in your "dropBlockAsItemWithChance" DO NOT USE THAT QUICK ERROR FIX 'Create Method for entityJoinedWorld'
i get a error with func_35293 on line 28 and on line 38 func_35294 also has a error i can run the game perfectly but useing the fertaliser causes the game to complain that this function doesnt exist. below i have my codeing
THANK YOU. +1
I really appreciate it!
Thank you! Don't forget to me!
Worked!
I tried adding the Super statement with the material.plants in it but I just get errors... I still only get my items though when i break the block, not the crop. Any Help!?!?!
Everything's working, except for the lines:
public static final Item ThistleSeeds = new ItemThistleSeeds(593, mod_Thistle.ThistleCrop.blockID, Block.tilledField.blockID);
public static final Item ThistleItem = new ItemThistle(594, 2, 0.6F, false).setItemName("itemthistle");
For the first line, the error is "ItemThistleSeeds cannot be resolved to a type".
For the second line, the error is "ItemThistle cannot be resolved to a type".
Do I need to make new classes for these?
error :
16:06:28 -
16:06:28 - src\minecraft\net\minecraft\src\BlockNewCrop.java:11: cannot find symbol
16:06:28 - symbol : method setTickOnLoad(boolean)
16:06:28 - location: class net.minecraft.src.BlockNewCrop
16:06:28 - setTickOnLoad(true); // If you copied and pasted you'll notice I took out the BlockInTexture part.
16:06:28 - ^
16:06:28 -
16:06:28 - src\minecraft\net\minecraft\src\BlockNewCrop.java:134: cannot find symbol
16:06:28 - symbol : variable multiplayerWorld
16:06:28 - location: class net.minecraft.src.World
16:06:28 - if(world.multiplayerWorld)
16:06:28 - ^
16:06:28 -
16:06:28 - 2 errors
16:06:28 - ==================
16:06:28 -
16:06:28 - !! Can not find server sources, try decompiling !!
import java.util.Random;
public class BlockNewCrop extends BlockFlower
{
protected BlockNewCrop(int i, int j)
{
super(i, j);
setTickOnLoad(true);
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.tilledField.blockID;
}
public void updateTick(World world, int i, int j, int k, Random random)
{
super.updateTick(world, i, j, k, random);
if(world.getBlockLightValue(i, j + 1, k) >= 9)
{
int l = world.getBlockMetadata(i, j, k);
if(l < 7)
{
float f = getGrowthRate(world, i, j, k);
if(random.nextInt((int)(25F / f) + 1) == 0)
{
l++;
world.setBlockMetadataWithNotify(i, j, k, l);
}
}
}
}
public void fertilize(World world, int i, int j, int k)
{
world.setBlockMetadataWithNotify(i, j, k, 7);
}
private float getGrowthRate(World world, int i, int j, int k)
{
float f = 1.0F;
int l = world.getBlockId(i, j, k - 1);
int i1 = world.getBlockId(i, j, k + 1);
int j1 = world.getBlockId(i - 1, j, k);
int k1 = world.getBlockId(i + 1, j, k);
int l1 = world.getBlockId(i - 1, j, k - 1);
int i2 = world.getBlockId(i + 1, j, k - 1);
int j2 = world.getBlockId(i + 1, j, k + 1);
int k2 = world.getBlockId(i - 1, j, k + 1);
boolean flag = j1 == blockID || k1 == blockID;
boolean flag1 = l == blockID || i1 == blockID;
boolean flag2 = l1 == blockID || i2 == blockID || j2 == blockID || k2 == blockID;
for(int l2 = i - 1; l2 <= i + 1; l2++)
{
for(int i3 = k - 1; i3 <= k + 1; i3++)
{
int j3 = world.getBlockId(l2, j - 1, i3);
float f1 = 0.0F;
if(j3 == Block.tilledField.blockID)
{
f1 = 1.0F;
if(world.getBlockMetadata(l2, j - 1, i3) > 0)
{
f1 = 3F;
}
}
if(l2 != i || i3 != k)
{
f1 /= 4F;
}
f += f1;
}
}
if(flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
// BIGGEST CHANGE IN THIS FILE. Making the textures increment up and determining the texture for each.
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_Plants.newCrop1;
}
if(j == 2)
{
return mod_Plants.newCrop1; // In order to not have to change a lot more code we can just make
} // the plant grow the same but make it "look" like it has fewer steps
if(j == 3) // Through 8 steps the sequence is 0, 1, 1, 2, 2, 3, 3, 4.
{
return mod_Plants.newCrop2;
}
if(j == 4)
{
return mod_Plants.newCrop2;
}
if(j == 5)
{
return mod_Plants.newCrop3;
}
if(j == 6)
{
return mod_Plants.newCrop3;
}
if(j == 7)
{
return mod_Plants.newCrop4;
}
return -1;
}
public int getRenderType()
{
return 1; // This makes the textures look MUCH better than 6 which makes an ugly square like wheat.
}
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
{
super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0);
if(world.multiplayerWorld)
{
return;
}
int j1 = 3 + i1;
for(int k1 = 0; k1 < j1; k1++)
{
if(world.rand.nextInt(15) <= l)
{
float f1 = 0.7F;
float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(mod_Plants.newSeeds)); // BLAH BLAH BLAH Change this and seeds will drop before grown and when fully grown
entityitem.delayBeforeCanPickup = 10;
/* This next part is NEW and allows for only YOUR seeds
to drop instead of your seeds and MC's default seeds.
~~Thanks Puta4Life! */
world.spawnEntityInWorld(entityitem);
}
}
}
public int idDropped(int i, Random random, int j)
{
if(i == 7)
{
return mod_Plants.newVegetable.shiftedIndex; //Fully Grown? Drop VEGGIE!
} else
{
return -1;
}
}
public int quantityDropped(Random random)
{
return 1; // How many veggie you want? 1, 2, 50?
}
}
Edit: Problem solved.
my new code:
import java.util.Random;
public class BlockNewCrop extends BlockFlower
{
protected BlockNewCrop(int i, int j)
{
super(i, j);
setTickRandomly(true);
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.tilledField.blockID;
}
public void updateTick(World par1World, int i, int j, int k, Random random)
{
super.updateTick(par1World, i, j, k, random);
if(par1World.getBlockLightValue(i, j + 1, k) >= 9)
{
int l = par1World.getBlockMetadata(i, j, k);
if(l < 7)
{
float f = getGrowthRate(par1World, i, j, k);
if(random.nextInt((int)(25F / f) + 1) == 0)
{
l++;
par1World.setBlockMetadataWithNotify(i, j, k, l);
}
}
}
}
public void fertilize(World par1World, int i, int j, int k)
{
par1World.setBlockMetadataWithNotify(i, j, k, 7);
}
private float getGrowthRate(World par1World, int i, int j, int k)
{
float f = 1.0F;
int l = par1World.getBlockId(i, j, k - 1);
int i1 = par1World.getBlockId(i, j, k + 1);
int j1 = par1World.getBlockId(i - 1, j, k);
int k1 = par1World.getBlockId(i + 1, j, k);
int l1 = par1World.getBlockId(i - 1, j, k - 1);
int i2 = par1World.getBlockId(i + 1, j, k - 1);
int j2 = par1World.getBlockId(i + 1, j, k + 1);
int k2 = par1World.getBlockId(i - 1, j, k + 1);
boolean flag = j1 == blockID || k1 == blockID;
boolean flag1 = l == blockID || i1 == blockID;
boolean flag2 = l1 == blockID || i2 == blockID || j2 == blockID || k2 == blockID;
for(int l2 = i - 1; l2 <= i + 1; l2++)
{
for(int i3 = k - 1; i3 <= k + 1; i3++)
{
int j3 = par1World.getBlockId(l2, j - 1, i3);
float f1 = 0.0F;
if(j3 == Block.tilledField.blockID)
{
f1 = 1.0F;
if(par1World.getBlockMetadata(l2, j - 1, i3) > 0)
{
f1 = 3F;
}
}
if(l2 != i || i3 != k)
{
f1 /= 4F;
}
f += f1;
}
}
if(flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
// BIGGEST CHANGE IN THIS FILE. Making the textures increment up and determining the texture for each.
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_Plants.newCrop1;
}
if(j == 2)
{
return mod_Plants.newCrop1; // In order to not have to change a lot more code we can just make
} // the plant grow the same but make it "look" like it has fewer steps
if(j == 3) // Through 8 steps the sequence is 0, 1, 1, 2, 2, 3, 3, 4.
{
return mod_Plants.newCrop2;
}
if(j == 4)
{
return mod_Plants.newCrop2;
}
if(j == 5)
{
return mod_Plants.newCrop3;
}
if(j == 6)
{
return mod_Plants.newCrop3;
}
if(j == 7)
{
return mod_Plants.newCrop4;
}
return -1;
}
public int getRenderType()
{
return 1; // This makes the textures look MUCH better than 6 which makes an ugly square like wheat.
}
public void dropBlockAsItemWithChance(World par1World, int i, int j, int k, int l, float f, int i1)
{
super.dropBlockAsItemWithChance(par1World, i, j, k, l, f, 0);
if(par1World.isRemote)
{
return;
}
int j1 = 3 + i1;
for(int k1 = 0; k1 < j1; k1++)
{
if(par1World.rand.nextInt(15) <= l)
{
float f1 = 0.7F;
float f2 = par1World.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f3 = par1World.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
float f4 = par1World.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
EntityItem entityitem = new EntityItem(par1World, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(mod_Plants.newSeeds)); // BLAH BLAH BLAH Change this and seeds will drop before grown and when fully grown
entityitem.delayBeforeCanPickup = 10;
/* This next part is NEW and allows for only YOUR seeds
to drop instead of your seeds and MC's default seeds.
~~Thanks Puta4Life! */
par1World.spawnEntityInWorld(entityitem);
}
}
}
public int idDropped(int i, Random random, int j)
{
if(i == 7)
{
return mod_Plants.newVegetable.shiftedIndex; //Fully Grown? Drop VEGGIE!
} else
{
return -1;
}
}
public int quantityDropped(Random random)
{
return 5; // How many veggie you want? 1, 2, 50?
}
}