Thank you for this. I really appreciate the help.
But this one didn't work either It did happen to leave some generation errors in the grass and stone so I think it was closer than mine. Am I missing something in there?
What are the errors? Probably should've asked that first...
Rollback Post to RevisionRollBack
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
Just wondering... what changed about mobs in 1.3? I heard something about "EntityTracker", but are there any specifics?
As there is an integrated server now, it must know about the entities as well. It tracks their movements so it can keep them in the correct position when sending data to the client.
error code, just added about 7 achievements... it wouldnt be that would it??
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader init
FINE: ModLoader 1.2.5 Initializing...
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader readFromClassPath
FINER: Adding mods from C:\Users\Theo\Desktop\mcp\src\minecraft
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader readFromClassPath
FINER: Directory found.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addOverride
FINER: addOverride(/gui/items.png,/theotextures/SpotMod/Armour/BRHelmet.png,38). 84 left.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addOverride
FINER: addOverride(/gui/items.png,/theotextures/SpotMod/Armour/BRChest.png,102). 83 left.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addOverride
FINER: addOverride(/gui/items.png,/theotextures/SpotMod/Armour/BRPants.png,118). 82 left.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addOverride
FINER: addOverride(/gui/items.png,/theotextures/SpotMod/Armour/BRBoots.png,119). 81 left.
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addMod
FINE: Failed to load mod from "mod_Spot.class"
Aug 06, 2012 9:20:19 PM ModLoader addMod
FINER: THROW
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:287)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1279)
at net.minecraft.src.ModLoader.init(ModLoader.java:849)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:157)
at net.minecraft.src.RenderManager.(RenderManager.java:85)
at net.minecraft.src.RenderManager.(RenderManager.java:12)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
at net.minecraft.src.ItemStack.(ItemStack.java:43)
at net.minecraft.src.Achievement.(Achievement.java:46)
at net.minecraft.src.mod_Spot.(mod_Spot.java:31)
... 15 more
Aug 06, 2012 9:20:19 PM net.minecraft.src.ModLoader addAllRenderers
FINE: Initialized
You are probably trying to use an achievement as a starter but it is further down in your code and hasn't been created yet.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Usually I can fix the code based on the error reports but this one I've never seen before...
Error
---- Minecraft Crash Report ----
// Why is it breaking
Time: 8/7/12 5:26 PM
Description: ModLoader has failed to initialize.
java.lang.ClassCastException: afn cannot be cast to java.lang.Character
at tc.a(SourceFile:588)
at ModLoader.addRecipe(ModLoader.java:452)
at mod_Farming.load(mod_Farming.java:25)
at ModLoader.init(ModLoader.java:922)
at ModLoader.addAllRenderers(ModLoader.java:169)
at avx.<init>(RenderManager.java:86)
at avx.<clinit>(RenderManager.java:12)
at net.minecraft.client.Minecraft.a(SourceFile:260)
at net.minecraft.client.Minecraft.run(SourceFile:516)
at java.lang.Thread.run(Unknown Source)
Relevant Details:
- Minecraft Version: 1.3.1
- Operating System: Windows 7 (x86) version 6.1
- Java Version: 1.7.0_05, Oracle Corporation
- Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
- Memory: 413646856 bytes (394 MB) / 518979584 bytes (494 MB) up to 1037959168 bytes (989 MB)
- JVM Flags: 2 total; -Xms512m -Xmx1024m
- ModLoader: Mods loaded: 2
ModLoader 1.3.1
mod_Farming 1.3.1
Code
mod_Farming
package net.minecraft.src;
public class mod_Farming extends BaseMod
{
public static final Block Amarillocrop = new BlockAmarillocrop(255, 0).setBlockName("Amarillocrop");
public static final Item AmarilloSeeds = new ItemAmarilloSeeds(5000, Amarillocrop.blockID, Block.tilledField.blockID).setItemName("AmarilloSeeds");
public static final Item Amarillo = new ItemAmarillo(5013).setItemName("Amarillo");
public static int AmarillocropStageOne = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo1.png");
public static int AmarillocropStageTwo = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo2.png");
public static int AmarillocropStageThree = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo3.png");
public static int AmarillocropStageFour = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo4.png");
public static int AmarillocropStageFive = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo5.png");
public static int AmarillocropStageSix = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo6.png");
public static int AmarillocropStageSeven = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo7.png");
public static int AmarillocropStageEight = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo8.png");
public void load()
{
Amarillocrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo8.png");
ModLoader.registerBlock(Amarillocrop);
ModLoader.addName(Amarillocrop, "Amarillo");
AmarilloSeeds.iconIndex = ModLoader.addOverride("/gui/items.png", "/Farming/AmarilloSeeds.png");
ModLoader.addName(AmarilloSeeds, "Amarillo Seeds");
ModLoader.addRecipe(new ItemStack(AmarilloSeeds, 64), new Object [] {"#", Block.dirt});
Amarillo.iconIndex = ModLoader.addOverride("/gui/items.png", "/Farming/Amarillo8.png");
ModLoader.addName(Amarillo, "Amarillo");
ModLoader.addRecipe(new ItemStack(Amarillo, 64), new Object [] {"#", "#", Block.dirt});
}
public String getVersion()
{
return "1.3.1";
}
}
BlockAmarillocrop
package net.minecraft.src;
import java.util.Random;
public class BlockAmarillocrop extends BlockFlower
{
public BlockAmarillocrop(int i, int j)
{
super(i, j);
blockIndexInTexture = j;
setTickRandomly(true);
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
/**
* Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of
* blockID passed in. Args: blockID.
* This basically checks to see if the block below is a tilled field/tilled dirt. If it is true then the crop can grow.
*/
protected boolean canThisPlantGrowOnThisBlockID(int par1)
{
return par1 == Block.tilledField.blockID;
}
/**
* Ticks the block if it's been scheduled. This method gets scheduled to run because of the setTickRandomly part in the constructor of the class.
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
super.updateTick(par1World, par2, par3, par4, par5Random);
if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
if (i < 8)
{
float f = getGrowthRate(par1World, par2, par3, par4);
if (par5Random.nextInt((int)(25F / f) + 1) == 0)
{
i++;
par1World.setBlockMetadataWithNotify(par2, par3, par4, i);
}
}
}
}
/**
* This method allows you to use bonemeal on your crop. Code explanation below:
ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - This line makes "itemstack" equal to the item currently in the players hand.
if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex) - This line checks if the item in players hand is equal to dye.
if(itemstack.getItemDamage() == 15) - This line checks if the damage value of that item is 15. Item.dyePowder's damage value of 15 is bonemeal.
world.setBlockMetadataWithNotify(i, j, k, 8); - This line sets the metadata value of the block to 8 which is the final growth stage.
itemstack.stackSize--; - This line makes the stack size go down by one.
world.notifyBlockChange(i, j, k, 0); - This line notifys adjacent blocks that this block has updated its state.
*/
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
ItemStack itemstack = par5EntityPlayer.inventory.getCurrentItem();
if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex)
{
if(itemstack.getItemDamage() == 15)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 8);
itemstack.stackSize--;
par1World.notifyBlockChange(par2, par3, par4, 0);
}
}
super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9);
return true;
}
/**
* Gets the growth rate for the crop. Setup to encourage rows by halving growth rate if there is diagonals, crops on
* different sides that aren't opposing, and by adding growth for every crop next to this one (and for crop below
* this one). Args: x, y, z
*/
private float getGrowthRate(World par1World, int par2, int par3, int par4)
{
float f = 1.0F;
int i = par1World.getBlockId(par2, par3, par4 - 1);
int j = par1World.getBlockId(par2, par3, par4 + 1);
int k = par1World.getBlockId(par2 - 1, par3, par4);
int l = par1World.getBlockId(par2 + 1, par3, par4);
int i1 = par1World.getBlockId(par2 - 1, par3, par4 - 1);
int j1 = par1World.getBlockId(par2 + 1, par3, par4 - 1);
int k1 = par1World.getBlockId(par2 + 1, par3, par4 + 1);
int l1 = par1World.getBlockId(par2 - 1, par3, par4 + 1);
boolean flag = k == blockID || l == blockID;
boolean flag1 = i == blockID || j == blockID;
boolean flag2 = i1 == blockID || j1 == blockID || k1 == blockID || l1 == blockID;
for (int i2 = par2 - 1; i2 <= par2 + 1; i2++)
{
for (int j2 = par4 - 1; j2 <= par4 + 1; j2++)
{
int k2 = par1World.getBlockId(i2, par3 - 1, j2);
float f1 = 0.0F;
if (k2 == Block.tilledField.blockID)
{
f1 = 1.0F;
if (par1World.getBlockMetadata(i2, par3 - 1, j2) > 0)
{
f1 = 3F;
}
}
if (i2 != par2 || j2 != par4)
{
f1 /= 4F;
}
f += f1;
}
}
if (flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
/**
* The type of render function that is called for this block. The render type of 6 gets the texture and places it four times around the sides of the block and leaves nothing on the top or bottom.
*/
public int getRenderType()
{
return 6;
}
/**
* Drops the block items with a specified chance of dropping the specified items
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
if (par1World.isRemote)
{
return;
}
int i = 3 + par7;
for (int j = 0; j < i; j++)
{
if (par1World.rand.nextInt(15) <= par5)
{
float f = 0.7F;
float f1 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float f2 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float f3 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
EntityItem entityitem = new EntityItem(par1World, (float)par2 + f1, (float)par3 + f2, (float)par4 + f3, new ItemStack(mod_Farming.AmarilloSeeds));
entityitem.delayBeforeCanPickup = 10;
par1World.spawnEntityInWorld(entityitem);
}
}
}
/**
* Returns the ID of the items to drop on destruction. "i" is equal to the blocks metadata value(explained slightly more in the getBlockTextureFromSideAndMetadata method below). This means that it will check that that value is equal to 8(the final stage of growth) and if it is then it will drop wheat. It may be fairly obvious, but the 'else' statement means that if the growth state is not equal to 7 then drop nothing (-1 means nothing)
*/
public int idDropped(int i, Random random, int j)
{
if (i == 8)
{
return mod_Farming.Amarillo.shiftedIndex;
}
else
{
return -1;
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random random)
{
return 1;
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata.
* As you may have been able to tell from the line above, "j" is equal to the metadata value of the block. This checks if that value is equal to a certain number then sets the blocks texture to what you have defined.
* The things that are being returned are the ints in your mod_ class which you created and set to your texture for the specific stages of growth.
*/
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_Farming.AmarillocropStageOne;
}
if(j == 2)
{
return mod_Farming.AmarillocropStageTwo;
}
if(j == 3)
{
return mod_Farming.AmarillocropStageThree;
}
if(j == 4)
{
return mod_Farming.AmarillocropStageFour;
}
if(j == 5)
{
return mod_Farming.AmarillocropStageFive;
}
if(j == 6)
{
return mod_Farming.AmarillocropStageSix;
}
if(j == 7)
{
return mod_Farming.AmarillocropStageSeven;
}
if(j == 8)
{
return mod_Farming.AmarillocropStageEight;
}
return j;
}
}
ItemAmarilloSeeds
package net.minecraft.src;
public class ItemAmarilloSeeds extends Item
{
/** The type of block this seed turns into (wheat or pumpkin stems for instance)*/
private int blockType;
/** BlockID of the block the seeds can be planted on. */
private int soilBlockID;
public ItemAmarilloSeeds(int i, int j, int k)
{
super(i);
blockType = j;
soilBlockID = k;
}
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS !
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (par7 != 1)
{
return false;
}
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6) || !par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
if (i == soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6))
{
par3World.setBlockWithNotify(par4, par5 + 1, par6, blockType);
par1ItemStack.stackSize--;
return true;
}
else
{
return false;
}
}
}
ItemAmarillo
package net.minecraft.src;
public class ItemAmarillo extends Item
{
public ItemAmarillo(int i)
{
super(i);
maxStackSize = 64;
}
}
Thanks. I knew setBlockAndMetadataWithNotify places the block, but i thought the 1 at the end is for setting the type of wood if you're using planks, logs, slabs, etc. But what if i wanted a birch, spruce or junglewood stairblock (not the oak variant) and also have it face a specific direction?
That i can't understand. :S
I beleive all of the stairs are different blocks, so you have: stairsWoodSpruce, stairsWoodBirch, stairsWoodJungle, and stairCompactPlanks for all of the wood types.
I would also suggest that you ask this in mod development, as that is the point of that entire forum.
Edit: actually, are you using 1.3.1? Is so your entity will be invisible, if your entity turns white, then go ask in mod development, but if it is gone entirely then you just need to wait for someone to come out with entity API for 1.3.1
Quick question, what .class file is the hunger bar code in, id like to speed up the rate it goes down, also is it possible to increase the rate it goes down or do i have to change the jar class files
Quick question, what .class file is the hunger bar code in, id like to speed up the rate it goes down, also is it possible to increase the rate it goes down or do i have to change the jar class files
Usually I can fix the code based on the error reports but this one I've never seen before...
Error
---- Minecraft Crash Report ----
// Why is it breaking
Time: 8/7/12 5:26 PM
Description: ModLoader has failed to initialize.
java.lang.ClassCastException: afn cannot be cast to java.lang.Character
at tc.a(SourceFile:588)
at ModLoader.addRecipe(ModLoader.java:452)
at mod_Farming.load(mod_Farming.java:25)
at ModLoader.init(ModLoader.java:922)
at ModLoader.addAllRenderers(ModLoader.java:169)
at avx.<init>(RenderManager.java:86)
at avx.<clinit>(RenderManager.java:12)
at net.minecraft.client.Minecraft.a(SourceFile:260)
at net.minecraft.client.Minecraft.run(SourceFile:516)
at java.lang.Thread.run(Unknown Source)
Relevant Details:
- Minecraft Version: 1.3.1
- Operating System: Windows 7 (x86) version 6.1
- Java Version: 1.7.0_05, Oracle Corporation
- Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
- Memory: 413646856 bytes (394 MB) / 518979584 bytes (494 MB) up to 1037959168 bytes (989 MB)
- JVM Flags: 2 total; -Xms512m -Xmx1024m
- ModLoader: Mods loaded: 2
ModLoader 1.3.1
mod_Farming 1.3.1
Code
mod_Farming
package net.minecraft.src;
public class mod_Farming extends BaseMod
{
public static final Block Amarillocrop = new BlockAmarillocrop(255, 0).setBlockName("Amarillocrop");
public static final Item AmarilloSeeds = new ItemAmarilloSeeds(5000, Amarillocrop.blockID, Block.tilledField.blockID).setItemName("AmarilloSeeds");
public static final Item Amarillo = new ItemAmarillo(5013).setItemName("Amarillo");
public static int AmarillocropStageOne = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo1.png");
public static int AmarillocropStageTwo = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo2.png");
public static int AmarillocropStageThree = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo3.png");
public static int AmarillocropStageFour = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo4.png");
public static int AmarillocropStageFive = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo5.png");
public static int AmarillocropStageSix = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo6.png");
public static int AmarillocropStageSeven = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo7.png");
public static int AmarillocropStageEight = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo8.png");
public void load()
{
Amarillocrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo8.png");
ModLoader.registerBlock(Amarillocrop);
ModLoader.addName(Amarillocrop, "Amarillo");
AmarilloSeeds.iconIndex = ModLoader.addOverride("/gui/items.png", "/Farming/AmarilloSeeds.png");
ModLoader.addName(AmarilloSeeds, "Amarillo Seeds");
ModLoader.addRecipe(new ItemStack(AmarilloSeeds, 64), new Object [] {"#", Block.dirt});
Amarillo.iconIndex = ModLoader.addOverride("/gui/items.png", "/Farming/Amarillo8.png");
ModLoader.addName(Amarillo, "Amarillo");
ModLoader.addRecipe(new ItemStack(Amarillo, 64), new Object [] {"#", "#", Block.dirt});
}
public String getVersion()
{
return "1.3.1";
}
}
BlockAmarillocrop
package net.minecraft.src;
import java.util.Random;
public class BlockAmarillocrop extends BlockFlower
{
public BlockAmarillocrop(int i, int j)
{
super(i, j);
blockIndexInTexture = j;
setTickRandomly(true);
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
/**
* Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of
* blockID passed in. Args: blockID.
* This basically checks to see if the block below is a tilled field/tilled dirt. If it is true then the crop can grow.
*/
protected boolean canThisPlantGrowOnThisBlockID(int par1)
{
return par1 == Block.tilledField.blockID;
}
/**
* Ticks the block if it's been scheduled. This method gets scheduled to run because of the setTickRandomly part in the constructor of the class.
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
super.updateTick(par1World, par2, par3, par4, par5Random);
if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
if (i < 8)
{
float f = getGrowthRate(par1World, par2, par3, par4);
if (par5Random.nextInt((int)(25F / f) + 1) == 0)
{
i++;
par1World.setBlockMetadataWithNotify(par2, par3, par4, i);
}
}
}
}
/**
* This method allows you to use bonemeal on your crop. Code explanation below:
ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - This line makes "itemstack" equal to the item currently in the players hand.
if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex) - This line checks if the item in players hand is equal to dye.
if(itemstack.getItemDamage() == 15) - This line checks if the damage value of that item is 15. Item.dyePowder's damage value of 15 is bonemeal.
world.setBlockMetadataWithNotify(i, j, k, 8); - This line sets the metadata value of the block to 8 which is the final growth stage.
itemstack.stackSize--; - This line makes the stack size go down by one.
world.notifyBlockChange(i, j, k, 0); - This line notifys adjacent blocks that this block has updated its state.
*/
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
ItemStack itemstack = par5EntityPlayer.inventory.getCurrentItem();
if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex)
{
if(itemstack.getItemDamage() == 15)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 8);
itemstack.stackSize--;
par1World.notifyBlockChange(par2, par3, par4, 0);
}
}
super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9);
return true;
}
/**
* Gets the growth rate for the crop. Setup to encourage rows by halving growth rate if there is diagonals, crops on
* different sides that aren't opposing, and by adding growth for every crop next to this one (and for crop below
* this one). Args: x, y, z
*/
private float getGrowthRate(World par1World, int par2, int par3, int par4)
{
float f = 1.0F;
int i = par1World.getBlockId(par2, par3, par4 - 1);
int j = par1World.getBlockId(par2, par3, par4 + 1);
int k = par1World.getBlockId(par2 - 1, par3, par4);
int l = par1World.getBlockId(par2 + 1, par3, par4);
int i1 = par1World.getBlockId(par2 - 1, par3, par4 - 1);
int j1 = par1World.getBlockId(par2 + 1, par3, par4 - 1);
int k1 = par1World.getBlockId(par2 + 1, par3, par4 + 1);
int l1 = par1World.getBlockId(par2 - 1, par3, par4 + 1);
boolean flag = k == blockID || l == blockID;
boolean flag1 = i == blockID || j == blockID;
boolean flag2 = i1 == blockID || j1 == blockID || k1 == blockID || l1 == blockID;
for (int i2 = par2 - 1; i2 <= par2 + 1; i2++)
{
for (int j2 = par4 - 1; j2 <= par4 + 1; j2++)
{
int k2 = par1World.getBlockId(i2, par3 - 1, j2);
float f1 = 0.0F;
if (k2 == Block.tilledField.blockID)
{
f1 = 1.0F;
if (par1World.getBlockMetadata(i2, par3 - 1, j2) > 0)
{
f1 = 3F;
}
}
if (i2 != par2 || j2 != par4)
{
f1 /= 4F;
}
f += f1;
}
}
if (flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
/**
* The type of render function that is called for this block. The render type of 6 gets the texture and places it four times around the sides of the block and leaves nothing on the top or bottom.
*/
public int getRenderType()
{
return 6;
}
/**
* Drops the block items with a specified chance of dropping the specified items
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
if (par1World.isRemote)
{
return;
}
int i = 3 + par7;
for (int j = 0; j < i; j++)
{
if (par1World.rand.nextInt(15) <= par5)
{
float f = 0.7F;
float f1 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float f2 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float f3 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
EntityItem entityitem = new EntityItem(par1World, (float)par2 + f1, (float)par3 + f2, (float)par4 + f3, new ItemStack(mod_Farming.AmarilloSeeds));
entityitem.delayBeforeCanPickup = 10;
par1World.spawnEntityInWorld(entityitem);
}
}
}
/**
* Returns the ID of the items to drop on destruction. "i" is equal to the blocks metadata value(explained slightly more in the getBlockTextureFromSideAndMetadata method below). This means that it will check that that value is equal to 8(the final stage of growth) and if it is then it will drop wheat. It may be fairly obvious, but the 'else' statement means that if the growth state is not equal to 7 then drop nothing (-1 means nothing)
*/
public int idDropped(int i, Random random, int j)
{
if (i == 8)
{
return mod_Farming.Amarillo.shiftedIndex;
}
else
{
return -1;
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random random)
{
return 1;
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata.
* As you may have been able to tell from the line above, "j" is equal to the metadata value of the block. This checks if that value is equal to a certain number then sets the blocks texture to what you have defined.
* The things that are being returned are the ints in your mod_ class which you created and set to your texture for the specific stages of growth.
*/
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_Farming.AmarillocropStageOne;
}
if(j == 2)
{
return mod_Farming.AmarillocropStageTwo;
}
if(j == 3)
{
return mod_Farming.AmarillocropStageThree;
}
if(j == 4)
{
return mod_Farming.AmarillocropStageFour;
}
if(j == 5)
{
return mod_Farming.AmarillocropStageFive;
}
if(j == 6)
{
return mod_Farming.AmarillocropStageSix;
}
if(j == 7)
{
return mod_Farming.AmarillocropStageSeven;
}
if(j == 8)
{
return mod_Farming.AmarillocropStageEight;
}
return j;
}
}
ItemAmarilloSeeds
package net.minecraft.src;
public class ItemAmarilloSeeds extends Item
{
/** The type of block this seed turns into (wheat or pumpkin stems for instance)*/
private int blockType;
/** BlockID of the block the seeds can be planted on. */
private int soilBlockID;
public ItemAmarilloSeeds(int i, int j, int k)
{
super(i);
blockType = j;
soilBlockID = k;
}
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS !
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (par7 != 1)
{
return false;
}
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6) || !par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
if (i == soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6))
{
par3World.setBlockWithNotify(par4, par5 + 1, par6, blockType);
par1ItemStack.stackSize--;
return true;
}
else
{
return false;
}
}
}
ItemAmarillo
package net.minecraft.src;
public class ItemAmarillo extends Item
{
public ItemAmarillo(int i)
{
super(i);
maxStackSize = 64;
}
}
Your recipe isn't set up correctly. Easily fixed, though:
ModLoader.addRecipe(new ItemStack(Amarillo, 64), new Object [] {"#", "#", Character.valueOf('#'), Block.dirt});
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
Thank you Bombshell for fixing that, everything loads now and I can use my cheat recipe to get my items. However, I can't plant my crop...sorry for being a noob coder but if someone could help again, thanks.
AmarilloSeeds
package net.minecraft.src;
public class ItemAmarilloSeeds extends Item
{
/** The type of block this seed turns into (wheat or pumpkin stems for instance)*/
private int blockType;
/** BlockID of the block the seeds can be planted on. */
private int soilBlockID;
public ItemAmarilloSeeds(int i, int j, int k)
{
super(i);
blockType = j;
soilBlockID = k;
}
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS !
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (par7 != 1)
{
return false;
}
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6) || !par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
if (i == soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6))
{
par3World.setBlockWithNotify(par4, par5 + 1, par6, blockType);
par1ItemStack.stackSize--;
return true;
}
else
{
return false;
}
}
}
Thank you Bombshell for fixing that, everything loads now and I can use my cheat recipe to get my items. However, I can't plant my crop...sorry for being a noob coder but if someone could help again, thanks.
AmarilloSeeds
package net.minecraft.src;
public class ItemAmarilloSeeds extends Item
{
/** The type of block this seed turns into (wheat or pumpkin stems for instance)*/
private int blockType;
/** BlockID of the block the seeds can be planted on. */
private int soilBlockID;
public ItemAmarilloSeeds(int i, int j, int k)
{
super(i);
blockType = j;
soilBlockID = k;
}
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS !
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (par7 != 1)
{
return false;
}
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6) || !par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
if (i == soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6))
{
par3World.setBlockWithNotify(par4, par5 + 1, par6, blockType);
par1ItemStack.stackSize--;
return true;
}
else
{
return false;
}
}
}
I don't exactly know how to fix it directly, but when did you write your Item class? There could be updated code like with the new ItemAxe, ItemSword, ItemPickaxe etc.
Rollback Post to RevisionRollBack
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
I wrote it like an hour ago following the example as closely as I could. Maybe the planting is effected in a different file so here are all the files
Code
mod_Farming
~~~~Ignore the messed up crafting recipe, I already fixed that, I just copied this code from the original post~~~~
package net.minecraft.src;
public class mod_Farming extends BaseMod
{
public static final Block Amarillocrop = new BlockAmarillocrop(255, 0).setBlockName("Amarillocrop");
public static final Item AmarilloSeeds = new ItemAmarilloSeeds(5000, Amarillocrop.blockID, Block.tilledField.blockID).setItemName("AmarilloSeeds");
public static final Item Amarillo = new ItemAmarillo(5013).setItemName("Amarillo");
public static int AmarillocropStageOne = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo1.png");
public static int AmarillocropStageTwo = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo2.png");
public static int AmarillocropStageThree = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo3.png");
public static int AmarillocropStageFour = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo4.png");
public static int AmarillocropStageFive = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo5.png");
public static int AmarillocropStageSix = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo6.png");
public static int AmarillocropStageSeven = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo7.png");
public static int AmarillocropStageEight = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo8.png");
public void load()
{
Amarillocrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo8.png");
ModLoader.registerBlock(Amarillocrop);
ModLoader.addName(Amarillocrop, "Amarillo");
AmarilloSeeds.iconIndex = ModLoader.addOverride("/gui/items.png", "/Farming/AmarilloSeeds.png");
ModLoader.addName(AmarilloSeeds, "Amarillo Seeds");
ModLoader.addRecipe(new ItemStack(AmarilloSeeds, 64), new Object [] {"#", Block.dirt});
Amarillo.iconIndex = ModLoader.addOverride("/gui/items.png", "/Farming/Amarillo8.png");
ModLoader.addName(Amarillo, "Amarillo");
ModLoader.addRecipe(new ItemStack(Amarillo, 64), new Object [] {"#", "#", Block.dirt});
}
public String getVersion()
{
return "1.3.1";
}
}
BlockAmarillocrop
package net.minecraft.src;
import java.util.Random;
public class BlockAmarillocrop extends BlockFlower
{
public BlockAmarillocrop(int i, int j)
{
super(i, j);
blockIndexInTexture = j;
setTickRandomly(true);
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
/**
* Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of
* blockID passed in. Args: blockID.
* This basically checks to see if the block below is a tilled field/tilled dirt. If it is true then the crop can grow.
*/
protected boolean canThisPlantGrowOnThisBlockID(int par1)
{
return par1 == Block.tilledField.blockID;
}
/**
* Ticks the block if it's been scheduled. This method gets scheduled to run because of the setTickRandomly part in the constructor of the class.
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
super.updateTick(par1World, par2, par3, par4, par5Random);
if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
if (i < 8)
{
float f = getGrowthRate(par1World, par2, par3, par4);
if (par5Random.nextInt((int)(25F / f) + 1) == 0)
{
i++;
par1World.setBlockMetadataWithNotify(par2, par3, par4, i);
}
}
}
}
/**
* This method allows you to use bonemeal on your crop. Code explanation below:
ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - This line makes "itemstack" equal to the item currently in the players hand.
if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex) - This line checks if the item in players hand is equal to dye.
if(itemstack.getItemDamage() == 15) - This line checks if the damage value of that item is 15. Item.dyePowder's damage value of 15 is bonemeal.
world.setBlockMetadataWithNotify(i, j, k, 8); - This line sets the metadata value of the block to 8 which is the final growth stage.
itemstack.stackSize--; - This line makes the stack size go down by one.
world.notifyBlockChange(i, j, k, 0); - This line notifys adjacent blocks that this block has updated its state.
*/
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
ItemStack itemstack = par5EntityPlayer.inventory.getCurrentItem();
if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex)
{
if(itemstack.getItemDamage() == 15)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 8);
itemstack.stackSize--;
par1World.notifyBlockChange(par2, par3, par4, 0);
}
}
super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9);
return true;
}
/**
* Gets the growth rate for the crop. Setup to encourage rows by halving growth rate if there is diagonals, crops on
* different sides that aren't opposing, and by adding growth for every crop next to this one (and for crop below
* this one). Args: x, y, z
*/
private float getGrowthRate(World par1World, int par2, int par3, int par4)
{
float f = 1.0F;
int i = par1World.getBlockId(par2, par3, par4 - 1);
int j = par1World.getBlockId(par2, par3, par4 + 1);
int k = par1World.getBlockId(par2 - 1, par3, par4);
int l = par1World.getBlockId(par2 + 1, par3, par4);
int i1 = par1World.getBlockId(par2 - 1, par3, par4 - 1);
int j1 = par1World.getBlockId(par2 + 1, par3, par4 - 1);
int k1 = par1World.getBlockId(par2 + 1, par3, par4 + 1);
int l1 = par1World.getBlockId(par2 - 1, par3, par4 + 1);
boolean flag = k == blockID || l == blockID;
boolean flag1 = i == blockID || j == blockID;
boolean flag2 = i1 == blockID || j1 == blockID || k1 == blockID || l1 == blockID;
for (int i2 = par2 - 1; i2 <= par2 + 1; i2++)
{
for (int j2 = par4 - 1; j2 <= par4 + 1; j2++)
{
int k2 = par1World.getBlockId(i2, par3 - 1, j2);
float f1 = 0.0F;
if (k2 == Block.tilledField.blockID)
{
f1 = 1.0F;
if (par1World.getBlockMetadata(i2, par3 - 1, j2) > 0)
{
f1 = 3F;
}
}
if (i2 != par2 || j2 != par4)
{
f1 /= 4F;
}
f += f1;
}
}
if (flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
/**
* The type of render function that is called for this block. The render type of 6 gets the texture and places it four times around the sides of the block and leaves nothing on the top or bottom.
*/
public int getRenderType()
{
return 6;
}
/**
* Drops the block items with a specified chance of dropping the specified items
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
if (par1World.isRemote)
{
return;
}
int i = 3 + par7;
for (int j = 0; j < i; j++)
{
if (par1World.rand.nextInt(15) <= par5)
{
float f = 0.7F;
float f1 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float f2 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float f3 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
EntityItem entityitem = new EntityItem(par1World, (float)par2 + f1, (float)par3 + f2, (float)par4 + f3, new ItemStack(mod_Farming.AmarilloSeeds));
entityitem.delayBeforeCanPickup = 10;
par1World.spawnEntityInWorld(entityitem);
}
}
}
/**
* Returns the ID of the items to drop on destruction. "i" is equal to the blocks metadata value(explained slightly more in the getBlockTextureFromSideAndMetadata method below). This means that it will check that that value is equal to 8(the final stage of growth) and if it is then it will drop wheat. It may be fairly obvious, but the 'else' statement means that if the growth state is not equal to 7 then drop nothing (-1 means nothing)
*/
public int idDropped(int i, Random random, int j)
{
if (i == 8)
{
return mod_Farming.Amarillo.shiftedIndex;
}
else
{
return -1;
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random random)
{
return 1;
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata.
* As you may have been able to tell from the line above, "j" is equal to the metadata value of the block. This checks if that value is equal to a certain number then sets the blocks texture to what you have defined.
* The things that are being returned are the ints in your mod_ class which you created and set to your texture for the specific stages of growth.
*/
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_Farming.AmarillocropStageOne;
}
if(j == 2)
{
return mod_Farming.AmarillocropStageTwo;
}
if(j == 3)
{
return mod_Farming.AmarillocropStageThree;
}
if(j == 4)
{
return mod_Farming.AmarillocropStageFour;
}
if(j == 5)
{
return mod_Farming.AmarillocropStageFive;
}
if(j == 6)
{
return mod_Farming.AmarillocropStageSix;
}
if(j == 7)
{
return mod_Farming.AmarillocropStageSeven;
}
if(j == 8)
{
return mod_Farming.AmarillocropStageEight;
}
return j;
}
}
ItemAmarilloSeeds
package net.minecraft.src;
public class ItemAmarilloSeeds extends Item
{
/** The type of block this seed turns into (wheat or pumpkin stems for instance)*/
private int blockType;
/** BlockID of the block the seeds can be planted on. */
private int soilBlockID;
public ItemAmarilloSeeds(int i, int j, int k)
{
super(i);
blockType = j;
soilBlockID = k;
}
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS !
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (par7 != 1)
{
return false;
}
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6) || !par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
if (i == soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6))
{
par3World.setBlockWithNotify(par4, par5 + 1, par6, blockType);
par1ItemStack.stackSize--;
return true;
}
else
{
return false;
}
}
}
ItemAmarillo
package net.minecraft.src;
public class ItemAmarillo extends Item
{
public ItemAmarillo(int i)
{
super(i);
maxStackSize = 64;
}
}
I wrote it like an hour ago following the example as closely as I could. Maybe the planting is effected in a different file so here are all the files
Code
mod_Farming
~~~~Ignore the messed up crafting recipe, I already fixed that, I just copied this code from the original post~~~~
package net.minecraft.src;
public class mod_Farming extends BaseMod
{
public static final Block Amarillocrop = new BlockAmarillocrop(255, 0).setBlockName("Amarillocrop");
public static final Item AmarilloSeeds = new ItemAmarilloSeeds(5000, Amarillocrop.blockID, Block.tilledField.blockID).setItemName("AmarilloSeeds");
public static final Item Amarillo = new ItemAmarillo(5013).setItemName("Amarillo");
public static int AmarillocropStageOne = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo1.png");
public static int AmarillocropStageTwo = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo2.png");
public static int AmarillocropStageThree = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo3.png");
public static int AmarillocropStageFour = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo4.png");
public static int AmarillocropStageFive = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo5.png");
public static int AmarillocropStageSix = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo6.png");
public static int AmarillocropStageSeven = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo7.png");
public static int AmarillocropStageEight = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo8.png");
public void load()
{
Amarillocrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo8.png");
ModLoader.registerBlock(Amarillocrop);
ModLoader.addName(Amarillocrop, "Amarillo");
AmarilloSeeds.iconIndex = ModLoader.addOverride("/gui/items.png", "/Farming/AmarilloSeeds.png");
ModLoader.addName(AmarilloSeeds, "Amarillo Seeds");
ModLoader.addRecipe(new ItemStack(AmarilloSeeds, 64), new Object [] {"#", Block.dirt});
Amarillo.iconIndex = ModLoader.addOverride("/gui/items.png", "/Farming/Amarillo8.png");
ModLoader.addName(Amarillo, "Amarillo");
ModLoader.addRecipe(new ItemStack(Amarillo, 64), new Object [] {"#", "#", Block.dirt});
}
public String getVersion()
{
return "1.3.1";
}
}
BlockAmarillocrop
package net.minecraft.src;
import java.util.Random;
public class BlockAmarillocrop extends BlockFlower
{
public BlockAmarillocrop(int i, int j)
{
super(i, j);
blockIndexInTexture = j;
setTickRandomly(true);
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
/**
* Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of
* blockID passed in. Args: blockID.
* This basically checks to see if the block below is a tilled field/tilled dirt. If it is true then the crop can grow.
*/
protected boolean canThisPlantGrowOnThisBlockID(int par1)
{
return par1 == Block.tilledField.blockID;
}
/**
* Ticks the block if it's been scheduled. This method gets scheduled to run because of the setTickRandomly part in the constructor of the class.
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
super.updateTick(par1World, par2, par3, par4, par5Random);
if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
if (i < 8)
{
float f = getGrowthRate(par1World, par2, par3, par4);
if (par5Random.nextInt((int)(25F / f) + 1) == 0)
{
i++;
par1World.setBlockMetadataWithNotify(par2, par3, par4, i);
}
}
}
}
/**
* This method allows you to use bonemeal on your crop. Code explanation below:
ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - This line makes "itemstack" equal to the item currently in the players hand.
if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex) - This line checks if the item in players hand is equal to dye.
if(itemstack.getItemDamage() == 15) - This line checks if the damage value of that item is 15. Item.dyePowder's damage value of 15 is bonemeal.
world.setBlockMetadataWithNotify(i, j, k, 8); - This line sets the metadata value of the block to 8 which is the final growth stage.
itemstack.stackSize--; - This line makes the stack size go down by one.
world.notifyBlockChange(i, j, k, 0); - This line notifys adjacent blocks that this block has updated its state.
*/
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
ItemStack itemstack = par5EntityPlayer.inventory.getCurrentItem();
if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex)
{
if(itemstack.getItemDamage() == 15)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 8);
itemstack.stackSize--;
par1World.notifyBlockChange(par2, par3, par4, 0);
}
}
super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9);
return true;
}
/**
* Gets the growth rate for the crop. Setup to encourage rows by halving growth rate if there is diagonals, crops on
* different sides that aren't opposing, and by adding growth for every crop next to this one (and for crop below
* this one). Args: x, y, z
*/
private float getGrowthRate(World par1World, int par2, int par3, int par4)
{
float f = 1.0F;
int i = par1World.getBlockId(par2, par3, par4 - 1);
int j = par1World.getBlockId(par2, par3, par4 + 1);
int k = par1World.getBlockId(par2 - 1, par3, par4);
int l = par1World.getBlockId(par2 + 1, par3, par4);
int i1 = par1World.getBlockId(par2 - 1, par3, par4 - 1);
int j1 = par1World.getBlockId(par2 + 1, par3, par4 - 1);
int k1 = par1World.getBlockId(par2 + 1, par3, par4 + 1);
int l1 = par1World.getBlockId(par2 - 1, par3, par4 + 1);
boolean flag = k == blockID || l == blockID;
boolean flag1 = i == blockID || j == blockID;
boolean flag2 = i1 == blockID || j1 == blockID || k1 == blockID || l1 == blockID;
for (int i2 = par2 - 1; i2 <= par2 + 1; i2++)
{
for (int j2 = par4 - 1; j2 <= par4 + 1; j2++)
{
int k2 = par1World.getBlockId(i2, par3 - 1, j2);
float f1 = 0.0F;
if (k2 == Block.tilledField.blockID)
{
f1 = 1.0F;
if (par1World.getBlockMetadata(i2, par3 - 1, j2) > 0)
{
f1 = 3F;
}
}
if (i2 != par2 || j2 != par4)
{
f1 /= 4F;
}
f += f1;
}
}
if (flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
/**
* The type of render function that is called for this block. The render type of 6 gets the texture and places it four times around the sides of the block and leaves nothing on the top or bottom.
*/
public int getRenderType()
{
return 6;
}
/**
* Drops the block items with a specified chance of dropping the specified items
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
if (par1World.isRemote)
{
return;
}
int i = 3 + par7;
for (int j = 0; j < i; j++)
{
if (par1World.rand.nextInt(15) <= par5)
{
float f = 0.7F;
float f1 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float f2 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float f3 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
EntityItem entityitem = new EntityItem(par1World, (float)par2 + f1, (float)par3 + f2, (float)par4 + f3, new ItemStack(mod_Farming.AmarilloSeeds));
entityitem.delayBeforeCanPickup = 10;
par1World.spawnEntityInWorld(entityitem);
}
}
}
/**
* Returns the ID of the items to drop on destruction. "i" is equal to the blocks metadata value(explained slightly more in the getBlockTextureFromSideAndMetadata method below). This means that it will check that that value is equal to 8(the final stage of growth) and if it is then it will drop wheat. It may be fairly obvious, but the 'else' statement means that if the growth state is not equal to 7 then drop nothing (-1 means nothing)
*/
public int idDropped(int i, Random random, int j)
{
if (i == 8)
{
return mod_Farming.Amarillo.shiftedIndex;
}
else
{
return -1;
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random random)
{
return 1;
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata.
* As you may have been able to tell from the line above, "j" is equal to the metadata value of the block. This checks if that value is equal to a certain number then sets the blocks texture to what you have defined.
* The things that are being returned are the ints in your mod_ class which you created and set to your texture for the specific stages of growth.
*/
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_Farming.AmarillocropStageOne;
}
if(j == 2)
{
return mod_Farming.AmarillocropStageTwo;
}
if(j == 3)
{
return mod_Farming.AmarillocropStageThree;
}
if(j == 4)
{
return mod_Farming.AmarillocropStageFour;
}
if(j == 5)
{
return mod_Farming.AmarillocropStageFive;
}
if(j == 6)
{
return mod_Farming.AmarillocropStageSix;
}
if(j == 7)
{
return mod_Farming.AmarillocropStageSeven;
}
if(j == 8)
{
return mod_Farming.AmarillocropStageEight;
}
return j;
}
}
ItemAmarilloSeeds
package net.minecraft.src;
public class ItemAmarilloSeeds extends Item
{
/** The type of block this seed turns into (wheat or pumpkin stems for instance)*/
private int blockType;
/** BlockID of the block the seeds can be planted on. */
private int soilBlockID;
public ItemAmarilloSeeds(int i, int j, int k)
{
super(i);
blockType = j;
soilBlockID = k;
}
/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS !
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (par7 != 1)
{
return false;
}
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6) || !par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6))
{
return false;
}
int i = par3World.getBlockId(par4, par5, par6);
if (i == soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6))
{
par3World.setBlockWithNotify(par4, par5 + 1, par6, blockType);
par1ItemStack.stackSize--;
return true;
}
else
{
return false;
}
}
}
ItemAmarillo
package net.minecraft.src;
public class ItemAmarillo extends Item
{
public ItemAmarillo(int i)
{
super(i);
maxStackSize = 64;
}
}
Sorry, I'm a new at crops... Maybe in ItemAmarilloSeeds, instead of soilBlockID, just put Block.tilledField.blockID or Block.tilledField.
If this doesn't help, you may want to wait for TechGuy.
Rollback Post to RevisionRollBack
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
Thanks for letting me know! Anyways I just looked at the post and now the tools are in black so does that mean that the tools code is incompatible with 1.3.1?
hey techguy sorry for bringing this up again but I looked all over the entity player class and the render player class but I still couldn't find where to change the players view height please help
Can someone help me with this crafting recipe error?
Here are my codes and the crash report
Crash Report
---- Minecraft Crash Report ----
// My bad.
Time: 8/7/12 6:12 PM
Description: ModLoader has failed to initialize.
java.lang.ArrayIndexOutOfBoundsException: 0
at net.minecraft.src.CraftingManager.addRecipe(CraftingManager.java:133)
at net.minecraft.src.ModLoader.addRecipe(ModLoader.java:482)
at net.minecraft.src.mod_zombie.load(mod_zombie.java:13)
at net.minecraft.src.ModLoader.init(ModLoader.java:927)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:161)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:86)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:14)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:404)
at net.minecraft.client.Minecraft.run(Minecraft.java:724)
at java.lang.Thread.run(Thread.java:722)
Relevant Details:
- Minecraft Version: 1.3.1
- Operating System: Windows XP (x86) version 5.1
- Java Version: 1.7.0_05, Oracle Corporation
- Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
- Memory: 1002345416 bytes (955 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
- JVM Flags: 3 total; -Xincgc -Xms1024M -Xmx1024M
- ModLoader: Mods loaded: 2
ModLoader 1.3.1
mod_zombie 1.3.1
mod_zombie.java
package net.minecraft.src;
public class mod_zombie extends BaseMod
{
public static final Block Dolomite = new BlockDolomite(160, 0).setBlockName("anyDolomite").setHardness(3F).setResistance(4F).setLightValue(1F);
public static final Item DolomiteRock = new ItemDolomiteRock(500).setItemName("DolomiteRock");
public static final Item SteelIngot = new ItemSteelIngot(501).setItemName("SteelIngot");
public static final Item Machete = new ItemMacheteSword(5000, EnumToolZombie.SteelIngot).setItemName("Machete");
public void load()
{
Dolomite.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/Dolomite.png");
ModLoader.registerBlock(Dolomite);
ModLoader.addName(Dolomite, "Dolomite");
ModLoader.addRecipe(new ItemStack(Dolomite, 1));
DolomiteRock.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/DolomiteRock.png");
ModLoader.addName(DolomiteRock, "Dolomite Rock");
ModLoader.addRecipe(new ItemStack(DolomiteRock, 1));
SteelIngot.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/SteelIngot.png");
ModLoader.addName(SteelIngot, "Steel Ingot");
ModLoader.addRecipe(new ItemStack(SteelIngot, 1));
ModLoader.addRecipe(new ItemStack(SteelIngot, 1), new Object [] {"#@", Character.valueOf('#'),
Item.ingotIron, Character.valueOf('@'), mod_zombie.DolomiteRock});
Machete.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/Machete.png");
ModLoader.addName(Machete, "Machete");
ModLoader.addRecipe(new ItemStack(Machete, 1), new Object [] {"#", "#", "%", '#', Block.dirt, '%', Item.stick});
}
public String getVersion()
{
return "1.3.1";
}
}
ItemMacheteSword.java
package net.minecraft.src;
public class ItemMacheteSword extends Item
{
private int weaponDamage;
private final EnumToolZombie toolMaterial;
public ItemMacheteSword(int par1, EnumToolZombie par2EnumToolZombie)
{
super(par1);
toolMaterial = par2EnumToolZombie;
maxStackSize = 1;
setMaxDamage(par2EnumToolZombie.getMaxUses());
weaponDamage = 4 + par2EnumToolZombie.getDamageVsEntity();
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return par2Block.blockID != Block.web.blockID ? 1.5F : 15F;
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(1, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(2, par6EntityLiving);
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return weaponDamage;
}
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.block;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 0x11940;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
return par1Block.blockID == Block.web.blockID;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
EnumToolZombie.java
package net.minecraft.src;
public enum EnumToolZombie
{
SteelIngot(3, 7500, 8.0F, 5, 15);
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
private final int harvestLevel;
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
private final int maxUses;
/**
* The strength of this tool material against blocks which it is effective against.
*/
private final float efficiencyOnProperMaterial;
/** Damage versus entities. */
private final int damageVsEntity;
/** Defines the natural enchantability factor of the material. */
private final int enchantability;
private EnumToolEsc(int par3, int par4, float par5, int par6, int par7)
{
this.harvestLevel = par3;
this.maxUses = par4;
this.efficiencyOnProperMaterial = par5;
this.damageVsEntity = par6;
this.enchantability = par7;
}
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
public int getMaxUses()
{
return this.maxUses;
}
/**
* The strength of this tool material against blocks which it is effective against.
*/
public float getEfficiencyOnProperMaterial()
{
return this.efficiencyOnProperMaterial;
}
/**
* Damage versus entities.
*/
public int getDamageVsEntity()
{
return this.damageVsEntity;
}
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
public int getHarvestLevel()
{
return this.harvestLevel;
}
/**
* Return the natural enchantability factor of the material.
*/
public int getEnchantability()
{
return this.enchantability;
}
}
Can someone help me with this crafting recipe error?
Here are my codes and the crash report
---- Minecraft Crash Report ----
// My bad.
Time: 8/7/12 6:12 PM
Description: ModLoader has failed to initialize.
java.lang.ArrayIndexOutOfBoundsException: 0
at net.minecraft.src.CraftingManager.addRecipe(CraftingManager.java:133)
at net.minecraft.src.ModLoader.addRecipe(ModLoader.java:482)
at net.minecraft.src.mod_zombie.load(mod_zombie.java:13)
at net.minecraft.src.ModLoader.init(ModLoader.java:927)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:161)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:86)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:14)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:404)
at net.minecraft.client.Minecraft.run(Minecraft.java:724)
at java.lang.Thread.run(Thread.java:722)
Relevant Details:
- Minecraft Version: 1.3.1
- Operating System: Windows XP (x86) version 5.1
- Java Version: 1.7.0_05, Oracle Corporation
- Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
- Memory: 1002345416 bytes (955 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
- JVM Flags: 3 total; -Xincgc -Xms1024M -Xmx1024M
- ModLoader: Mods loaded: 2
ModLoader 1.3.1
mod_zombie 1.3.1
mod_zombie.java
package net.minecraft.src;
public class mod_zombie extends BaseMod
{
public static final Block Dolomite = new BlockDolomite(160, 0).setBlockName("anyDolomite").setHardness(3F).setResistance(4F).setLightValue(1F);
public static final Item DolomiteRock = new ItemDolomiteRock(500).setItemName("DolomiteRock");
public static final Item SteelIngot = new ItemSteelIngot(501).setItemName("SteelIngot");
public static final Item Machete = new ItemMacheteSword(5000, EnumToolZombie.SteelIngot).setItemName("Machete");
public void load()
{
Dolomite.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/Dolomite.png");
ModLoader.registerBlock(Dolomite);
ModLoader.addName(Dolomite, "Dolomite");
ModLoader.addRecipe(new ItemStack(Dolomite, 1));
DolomiteRock.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/DolomiteRock.png");
ModLoader.addName(DolomiteRock, "Dolomite Rock");
ModLoader.addRecipe(new ItemStack(DolomiteRock, 1));
SteelIngot.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/SteelIngot.png");
ModLoader.addName(SteelIngot, "Steel Ingot");
ModLoader.addRecipe(new ItemStack(SteelIngot, 1));
ModLoader.addRecipe(new ItemStack(SteelIngot, 1), new Object [] {"#@", Character.valueOf('#'),
Item.ingotIron, Character.valueOf('@'), mod_zombie.DolomiteRock});
Machete.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/Machete.png");
ModLoader.addName(Machete, "Machete");
ModLoader.addRecipe(new ItemStack(Machete, 1), new Object [] {"#", "#", "%", '#', Block.dirt, '%', Item.stick});
}
public String getVersion()
{
return "1.3.1";
}
}
ItemMacheteSword.java
package net.minecraft.src;
public class ItemMacheteSword extends Item
{
private int weaponDamage;
private final EnumToolZombie toolMaterial;
public ItemMacheteSword(int par1, EnumToolZombie par2EnumToolZombie)
{
super(par1);
toolMaterial = par2EnumToolZombie;
maxStackSize = 1;
setMaxDamage(par2EnumToolZombie.getMaxUses());
weaponDamage = 4 + par2EnumToolZombie.getDamageVsEntity();
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
return par2Block.blockID != Block.web.blockID ? 1.5F : 15F;
}
/**
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
* the damage on the stack.
*/
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
par1ItemStack.damageItem(1, par3EntityLiving);
return true;
}
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
{
par1ItemStack.damageItem(2, par6EntityLiving);
return true;
}
/**
* Returns the damage against a given entity.
*/
public int getDamageVsEntity(Entity par1Entity)
{
return weaponDamage;
}
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D()
{
return true;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.block;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 0x11940;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
return par1Block.blockID == Block.web.blockID;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
EnumToolZombie.java
package net.minecraft.src;
public enum EnumToolZombie
{
SteelIngot(3, 7500, 8.0F, 5, 15);
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
private final int harvestLevel;
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
private final int maxUses;
/**
* The strength of this tool material against blocks which it is effective against.
*/
private final float efficiencyOnProperMaterial;
/** Damage versus entities. */
private final int damageVsEntity;
/** Defines the natural enchantability factor of the material. */
private final int enchantability;
private EnumToolEsc(int par3, int par4, float par5, int par6, int par7)
{
this.harvestLevel = par3;
this.maxUses = par4;
this.efficiencyOnProperMaterial = par5;
this.damageVsEntity = par6;
this.enchantability = par7;
}
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
public int getMaxUses()
{
return this.maxUses;
}
/**
* The strength of this tool material against blocks which it is effective against.
*/
public float getEfficiencyOnProperMaterial()
{
return this.efficiencyOnProperMaterial;
}
/**
* Damage versus entities.
*/
public int getDamageVsEntity()
{
return this.damageVsEntity;
}
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
public int getHarvestLevel()
{
return this.harvestLevel;
}
/**
* Return the natural enchantability factor of the material.
*/
public int getEnchantability()
{
return this.enchantability;
}
}
Your crafting recipes are, no offense, completely wrong.
They follow this format:
ModLoader.addRecipe(new ItemStack(nameHere, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
Thanks for letting me know! Anyways I just looked at the post and now the tools are in black so does that mean that the tools code is incompatible with 1.3.1?
Not entirely, but they won't take damage, and hoes don't till soil. Spades, pickaxes, axes, and swords still function normally but don't take damage. You just have to update your tool classes with the new code, and then change them as you need to.
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
Ok so after much frustration I finally managed to get my crop to plant and everything to work but it doesn't seem to grow...It plants and its texture is stage 1 and if I use bonemeal it shows stage 8 and harvests correctly but it won't show stage 2-7...Once again I need help ;(
Update: If you exit the world and rejoin, some of the crops have grown. Also you are able to right click crops (how do I make it so you can't right click). Third sometimes the crop appears as the default purple texture (I wonder which texture is missing...)
Update 2: I checked and the textures for all 8 growth stages are working so I have no idea what is causing the purple boxes to appear...
BlockAmarilloCrop
package net.minecraft.src;
import java.util.Random;
public class BlockAmarillocrop extends BlockFlower
{
public BlockAmarillocrop(int i, int j)
{
super(i, j);
blockIndexInTexture = j;
setTickRandomly(true);
float f = 0.5F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
}
/**
* Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of
* blockID passed in. Args: blockID.
* This basically checks to see if the block below is a tilled field/tilled dirt. If it is true then the crop can grow.
*/
protected boolean canThisPlantGrowOnThisBlockID(int par1)
{
return par1 == Block.tilledField.blockID;
}
/**
* Ticks the block if it's been scheduled. This method gets scheduled to run because of the setTickRandomly part in the constructor of the class.
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
super.updateTick(par1World, par2, par3, par4, par5Random);
if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9)
{
int i = par1World.getBlockMetadata(par2, par3, par4);
if (i < 8)
{
float f = getGrowthRate(par1World, par2, par3, par4);
if (par5Random.nextInt((int)(25F / f) + 1) == 0)
{
i++;
par1World.setBlockMetadataWithNotify(par2, par3, par4, i);
}
}
}
}
/**
* This method allows you to use bonemeal on your crop. Code explanation below:
ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - This line makes "itemstack" equal to the item currently in the players hand.
if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex) - This line checks if the item in players hand is equal to dye.
if(itemstack.getItemDamage() == 15) - This line checks if the damage value of that item is 15. Item.dyePowder's damage value of 15 is bonemeal.
world.setBlockMetadataWithNotify(i, j, k, 8); - This line sets the metadata value of the block to 8 which is the final growth stage.
itemstack.stackSize--; - This line makes the stack size go down by one.
world.notifyBlockChange(i, j, k, 0); - This line notifys adjacent blocks that this block has updated its state.
*/
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
ItemStack itemstack = par5EntityPlayer.inventory.getCurrentItem();
if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex)
{
if(itemstack.getItemDamage() == 15)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 8);
itemstack.stackSize--;
par1World.notifyBlockChange(par2, par3, par4, 0);
}
}
super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9);
return true;
}
/**
* Gets the growth rate for the crop. Setup to encourage rows by halving growth rate if there is diagonals, crops on
* different sides that aren't opposing, and by adding growth for every crop next to this one (and for crop below
* this one). Args: x, y, z
*/
private float getGrowthRate(World par1World, int par2, int par3, int par4)
{
float f = 1.0F;
int i = par1World.getBlockId(par2, par3, par4 - 1);
int j = par1World.getBlockId(par2, par3, par4 + 1);
int k = par1World.getBlockId(par2 - 1, par3, par4);
int l = par1World.getBlockId(par2 + 1, par3, par4);
int i1 = par1World.getBlockId(par2 - 1, par3, par4 - 1);
int j1 = par1World.getBlockId(par2 + 1, par3, par4 - 1);
int k1 = par1World.getBlockId(par2 + 1, par3, par4 + 1);
int l1 = par1World.getBlockId(par2 - 1, par3, par4 + 1);
boolean flag = k == blockID || l == blockID;
boolean flag1 = i == blockID || j == blockID;
boolean flag2 = i1 == blockID || j1 == blockID || k1 == blockID || l1 == blockID;
for (int i2 = par2 - 1; i2 <= par2 + 1; i2++)
{
for (int j2 = par4 - 1; j2 <= par4 + 1; j2++)
{
int k2 = par1World.getBlockId(i2, par3 - 1, j2);
float f1 = 0.0F;
if (k2 == Block.tilledField.blockID)
{
f1 = 1.0F;
if (par1World.getBlockMetadata(i2, par3 - 1, j2) > 0)
{
f1 = 3F;
}
}
if (i2 != par2 || j2 != par4)
{
f1 /= 4F;
}
f += f1;
}
}
if (flag2 || flag && flag1)
{
f /= 2.0F;
}
return f;
}
/**
* The type of render function that is called for this block. The render type of 6 gets the texture and places it four times around the sides of the block and leaves nothing on the top or bottom.
*/
public int getRenderType()
{
return 6;
}
/**
* Drops the block items with a specified chance of dropping the specified items
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
if (par1World.isRemote)
{
return;
}
int i = 3 + par7;
for (int j = 0; j < i; j++)
{
if (par1World.rand.nextInt(15) <= par5)
{
float f = 0.7F;
float f1 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float f2 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float f3 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F;
EntityItem entityitem = new EntityItem(par1World, (float)par2 + f1, (float)par3 + f2, (float)par4 + f3, new ItemStack(mod_Farming.AmarilloSeeds));
entityitem.delayBeforeCanPickup = 10;
par1World.spawnEntityInWorld(entityitem);
}
}
}
/**
* Returns the ID of the items to drop on destruction. "i" is equal to the blocks metadata value(explained slightly more in the getBlockTextureFromSideAndMetadata method below). This means that it will check that that value is equal to 8(the final stage of growth) and if it is then it will drop wheat. It may be fairly obvious, but the 'else' statement means that if the growth state is not equal to 7 then drop nothing (-1 means nothing)
*/
public int idDropped(int i, Random random, int j)
{
if (i == 8)
{
return Item.wheat.shiftedIndex;
}
else
{
return -1;
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random random)
{
return 1;
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata.
* As you may have been able to tell from the line above, "j" is equal to the metadata value of the block. This checks if that value is equal to a certain number then sets the blocks texture to what you have defined.
* The things that are being returned are the ints in your mod_ class which you created and set to your texture for the specific stages of growth.
*/
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(j == 0)
{
return blockIndexInTexture;
}
if(j == 1)
{
return mod_Farming.AmarillocropStageOne;
}
if(j == 2)
{
return mod_Farming.AmarillocropStageTwo;
}
if(j == 3)
{
return mod_Farming.AmarillocropStageThree;
}
if(j == 4)
{
return mod_Farming.AmarillocropStageFour;
}
if(j == 5)
{
return mod_Farming.AmarillocropStageFive;
}
if(j == 6)
{
return mod_Farming.AmarillocropStageSix;
}
if(j == 7)
{
return mod_Farming.AmarillocropStageSeven;
}
if(j == 8)
{
return mod_Farming.AmarillocropStageEight;
}
return j;
}
}
mod_Farming
package net.minecraft.src;
public class mod_Farming extends BaseMod
{
public static final Block Amarillocrop = new BlockAmarillocrop(255, 0).setBlockName("Amarillocrop");
public static final Item AmarilloSeeds = new ItemAmarilloSeeds(5000, Amarillocrop.blockID, Block.tilledField.blockID).setItemName("AmarilloSeeds");
public static final Item Amarillo = new ItemAmarillo(5013).setItemName("Amarillo");
public static int AmarillocropStageOne = ModLoader.addOverride("/terrain.png", "/Amarillo1.png");
public static int AmarillocropStageTwo = ModLoader.addOverride("/terrain.png", "/Amarillo2.png");
public static int AmarillocropStageThree = ModLoader.addOverride("/terrain.png", "/Amarillo3.png");
public static int AmarillocropStageFour = ModLoader.addOverride("/terrain.png", "/Amarillo4.png");
public static int AmarillocropStageFive = ModLoader.addOverride("/terrain.png", "/Amarillo5.png");
public static int AmarillocropStageSix = ModLoader.addOverride("/terrain.png", "/Amarillo6.png");
public static int AmarillocropStageSeven = ModLoader.addOverride("/terrain.png", "/Amarillo7.png");
public static int AmarillocropStageEight = ModLoader.addOverride("/terrain.png", "/Amarillo8.png");
public void load()
{
Amarillocrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Amarillo1.png");
ModLoader.registerBlock(Amarillocrop);
ModLoader.addName(Amarillocrop, "Amarillo");
AmarilloSeeds.iconIndex = ModLoader.addOverride("/gui/items.png", "/AmarilloSeeds.png");
ModLoader.addName(AmarilloSeeds, "Amarillo Seeds");
ModLoader.addRecipe(new ItemStack(AmarilloSeeds, 64), new Object [] {"#", Character.valueOf('#'), Block.dirt});
Amarillo.iconIndex = ModLoader.addOverride("/gui/items.png", "/Amarillo8.png");
ModLoader.addName(Amarillo, "Amarillo");
ModLoader.addRecipe(new ItemStack(Amarillo, 64), new Object [] {"#", "#", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.3.1";
}
}
Wow, thanks for your help! You're very reliable and i'm surprised you can keep up with this many people sending you questions. Thanks again
-
View User Profile
-
View Posts
-
Send Message
Retired StaffWhat are the errors? Probably should've asked that first...
As there is an integrated server now, it must know about the entities as well. It tracks their movements so it can keep them in the correct position when sending data to the client.
You are probably trying to use an achievement as a starter but it is further down in your code and hasn't been created yet.
I don't have a tutorial on it yet so I'm not helping, sorry.
The stairs tutorial has already been updated since then.
together they are powerful beyond imagination."
Error
Code
mod_Farming
package net.minecraft.src; public class mod_Farming extends BaseMod { public static final Block Amarillocrop = new BlockAmarillocrop(255, 0).setBlockName("Amarillocrop"); public static final Item AmarilloSeeds = new ItemAmarilloSeeds(5000, Amarillocrop.blockID, Block.tilledField.blockID).setItemName("AmarilloSeeds"); public static final Item Amarillo = new ItemAmarillo(5013).setItemName("Amarillo"); public static int AmarillocropStageOne = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo1.png"); public static int AmarillocropStageTwo = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo2.png"); public static int AmarillocropStageThree = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo3.png"); public static int AmarillocropStageFour = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo4.png"); public static int AmarillocropStageFive = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo5.png"); public static int AmarillocropStageSix = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo6.png"); public static int AmarillocropStageSeven = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo7.png"); public static int AmarillocropStageEight = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo8.png"); public void load() { Amarillocrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo8.png"); ModLoader.registerBlock(Amarillocrop); ModLoader.addName(Amarillocrop, "Amarillo"); AmarilloSeeds.iconIndex = ModLoader.addOverride("/gui/items.png", "/Farming/AmarilloSeeds.png"); ModLoader.addName(AmarilloSeeds, "Amarillo Seeds"); ModLoader.addRecipe(new ItemStack(AmarilloSeeds, 64), new Object [] {"#", Block.dirt}); Amarillo.iconIndex = ModLoader.addOverride("/gui/items.png", "/Farming/Amarillo8.png"); ModLoader.addName(Amarillo, "Amarillo"); ModLoader.addRecipe(new ItemStack(Amarillo, 64), new Object [] {"#", "#", Block.dirt}); } public String getVersion() { return "1.3.1"; } }BlockAmarillocrop
package net.minecraft.src; import java.util.Random; public class BlockAmarillocrop extends BlockFlower { public BlockAmarillocrop(int i, int j) { super(i, j); blockIndexInTexture = j; setTickRandomly(true); float f = 0.5F; setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); } /** * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of * blockID passed in. Args: blockID. * This basically checks to see if the block below is a tilled field/tilled dirt. If it is true then the crop can grow. */ protected boolean canThisPlantGrowOnThisBlockID(int par1) { return par1 == Block.tilledField.blockID; } /** * Ticks the block if it's been scheduled. This method gets scheduled to run because of the setTickRandomly part in the constructor of the class. */ public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { super.updateTick(par1World, par2, par3, par4, par5Random); if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) { int i = par1World.getBlockMetadata(par2, par3, par4); if (i < 8) { float f = getGrowthRate(par1World, par2, par3, par4); if (par5Random.nextInt((int)(25F / f) + 1) == 0) { i++; par1World.setBlockMetadataWithNotify(par2, par3, par4, i); } } } } /** * This method allows you to use bonemeal on your crop. Code explanation below: ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - This line makes "itemstack" equal to the item currently in the players hand. if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex) - This line checks if the item in players hand is equal to dye. if(itemstack.getItemDamage() == 15) - This line checks if the damage value of that item is 15. Item.dyePowder's damage value of 15 is bonemeal. world.setBlockMetadataWithNotify(i, j, k, 8); - This line sets the metadata value of the block to 8 which is the final growth stage. itemstack.stackSize--; - This line makes the stack size go down by one. world.notifyBlockChange(i, j, k, 0); - This line notifys adjacent blocks that this block has updated its state. */ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { ItemStack itemstack = par5EntityPlayer.inventory.getCurrentItem(); if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex) { if(itemstack.getItemDamage() == 15) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 8); itemstack.stackSize--; par1World.notifyBlockChange(par2, par3, par4, 0); } } super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9); return true; } /** * Gets the growth rate for the crop. Setup to encourage rows by halving growth rate if there is diagonals, crops on * different sides that aren't opposing, and by adding growth for every crop next to this one (and for crop below * this one). Args: x, y, z */ private float getGrowthRate(World par1World, int par2, int par3, int par4) { float f = 1.0F; int i = par1World.getBlockId(par2, par3, par4 - 1); int j = par1World.getBlockId(par2, par3, par4 + 1); int k = par1World.getBlockId(par2 - 1, par3, par4); int l = par1World.getBlockId(par2 + 1, par3, par4); int i1 = par1World.getBlockId(par2 - 1, par3, par4 - 1); int j1 = par1World.getBlockId(par2 + 1, par3, par4 - 1); int k1 = par1World.getBlockId(par2 + 1, par3, par4 + 1); int l1 = par1World.getBlockId(par2 - 1, par3, par4 + 1); boolean flag = k == blockID || l == blockID; boolean flag1 = i == blockID || j == blockID; boolean flag2 = i1 == blockID || j1 == blockID || k1 == blockID || l1 == blockID; for (int i2 = par2 - 1; i2 <= par2 + 1; i2++) { for (int j2 = par4 - 1; j2 <= par4 + 1; j2++) { int k2 = par1World.getBlockId(i2, par3 - 1, j2); float f1 = 0.0F; if (k2 == Block.tilledField.blockID) { f1 = 1.0F; if (par1World.getBlockMetadata(i2, par3 - 1, j2) > 0) { f1 = 3F; } } if (i2 != par2 || j2 != par4) { f1 /= 4F; } f += f1; } } if (flag2 || flag && flag1) { f /= 2.0F; } return f; } /** * The type of render function that is called for this block. The render type of 6 gets the texture and places it four times around the sides of the block and leaves nothing on the top or bottom. */ public int getRenderType() { return 6; } /** * Drops the block items with a specified chance of dropping the specified items */ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) { super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); if (par1World.isRemote) { return; } int i = 3 + par7; for (int j = 0; j < i; j++) { if (par1World.rand.nextInt(15) <= par5) { float f = 0.7F; float f1 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F; float f2 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F; float f3 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F; EntityItem entityitem = new EntityItem(par1World, (float)par2 + f1, (float)par3 + f2, (float)par4 + f3, new ItemStack(mod_Farming.AmarilloSeeds)); entityitem.delayBeforeCanPickup = 10; par1World.spawnEntityInWorld(entityitem); } } } /** * Returns the ID of the items to drop on destruction. "i" is equal to the blocks metadata value(explained slightly more in the getBlockTextureFromSideAndMetadata method below). This means that it will check that that value is equal to 8(the final stage of growth) and if it is then it will drop wheat. It may be fairly obvious, but the 'else' statement means that if the growth state is not equal to 7 then drop nothing (-1 means nothing) */ public int idDropped(int i, Random random, int j) { if (i == 8) { return mod_Farming.Amarillo.shiftedIndex; } else { return -1; } } /** * Returns the quantity of items to drop on block destruction. */ public int quantityDropped(Random random) { return 1; } /** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata. * As you may have been able to tell from the line above, "j" is equal to the metadata value of the block. This checks if that value is equal to a certain number then sets the blocks texture to what you have defined. * The things that are being returned are the ints in your mod_ class which you created and set to your texture for the specific stages of growth. */ public int getBlockTextureFromSideAndMetadata(int i, int j) { if(j == 0) { return blockIndexInTexture; } if(j == 1) { return mod_Farming.AmarillocropStageOne; } if(j == 2) { return mod_Farming.AmarillocropStageTwo; } if(j == 3) { return mod_Farming.AmarillocropStageThree; } if(j == 4) { return mod_Farming.AmarillocropStageFour; } if(j == 5) { return mod_Farming.AmarillocropStageFive; } if(j == 6) { return mod_Farming.AmarillocropStageSix; } if(j == 7) { return mod_Farming.AmarillocropStageSeven; } if(j == 8) { return mod_Farming.AmarillocropStageEight; } return j; } }ItemAmarilloSeeds
package net.minecraft.src; public class ItemAmarilloSeeds extends Item { /** The type of block this seed turns into (wheat or pumpkin stems for instance)*/ private int blockType; /** BlockID of the block the seeds can be planted on. */ private int soilBlockID; public ItemAmarilloSeeds(int i, int j, int k) { super(i); blockType = j; soilBlockID = k; } /** * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return * True if something happen and false if it don't. This is for ITEMS, not BLOCKS ! */ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7) { if (par7 != 1) { return false; } if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6) || !par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6)) { return false; } int i = par3World.getBlockId(par4, par5, par6); if (i == soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6)) { par3World.setBlockWithNotify(par4, par5 + 1, par6, blockType); par1ItemStack.stackSize--; return true; } else { return false; } } }ItemAmarillo
package net.minecraft.src; public class ItemAmarillo extends Item { public ItemAmarillo(int i) { super(i); maxStackSize = 64; } }-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI beleive all of the stairs are different blocks, so you have: stairsWoodSpruce, stairsWoodBirch, stairsWoodJungle, and stairCompactPlanks for all of the wood types.
I would suggest that you ask this in mod development, as that is the point of that entire forum.
I would also suggest that you ask this in mod development, as that is the point of that entire forum.
Edit: actually, are you using 1.3.1? Is so your entity will be invisible, if your entity turns white, then go ask in mod development, but if it is gone entirely then you just need to wait for someone to come out with entity API for 1.3.1
-
View User Profile
-
View Posts
-
Send Message
Retired StaffWhy would you do that?
Your recipe isn't set up correctly. Easily fixed, though:
ModLoader.addRecipe(new ItemStack(Amarillo, 64), new Object [] {"#", "#", Character.valueOf('#'), Block.dirt});AmarilloSeeds
package net.minecraft.src; public class ItemAmarilloSeeds extends Item { /** The type of block this seed turns into (wheat or pumpkin stems for instance)*/ private int blockType; /** BlockID of the block the seeds can be planted on. */ private int soilBlockID; public ItemAmarilloSeeds(int i, int j, int k) { super(i); blockType = j; soilBlockID = k; } /** * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return * True if something happen and false if it don't. This is for ITEMS, not BLOCKS ! */ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7) { if (par7 != 1) { return false; } if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6) || !par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6)) { return false; } int i = par3World.getBlockId(par4, par5, par6); if (i == soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6)) { par3World.setBlockWithNotify(par4, par5 + 1, par6, blockType); par1ItemStack.stackSize--; return true; } else { return false; } } }-
View User Profile
-
View Posts
-
Send Message
Retired StaffI don't exactly know how to fix it directly, but when did you write your Item class? There could be updated code like with the new ItemAxe, ItemSword, ItemPickaxe etc.
Code
mod_Farming
~~~~Ignore the messed up crafting recipe, I already fixed that, I just copied this code from the original post~~~~
package net.minecraft.src; public class mod_Farming extends BaseMod { public static final Block Amarillocrop = new BlockAmarillocrop(255, 0).setBlockName("Amarillocrop"); public static final Item AmarilloSeeds = new ItemAmarilloSeeds(5000, Amarillocrop.blockID, Block.tilledField.blockID).setItemName("AmarilloSeeds"); public static final Item Amarillo = new ItemAmarillo(5013).setItemName("Amarillo"); public static int AmarillocropStageOne = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo1.png"); public static int AmarillocropStageTwo = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo2.png"); public static int AmarillocropStageThree = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo3.png"); public static int AmarillocropStageFour = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo4.png"); public static int AmarillocropStageFive = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo5.png"); public static int AmarillocropStageSix = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo6.png"); public static int AmarillocropStageSeven = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo7.png"); public static int AmarillocropStageEight = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo8.png"); public void load() { Amarillocrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Farming/Amarillo8.png"); ModLoader.registerBlock(Amarillocrop); ModLoader.addName(Amarillocrop, "Amarillo"); AmarilloSeeds.iconIndex = ModLoader.addOverride("/gui/items.png", "/Farming/AmarilloSeeds.png"); ModLoader.addName(AmarilloSeeds, "Amarillo Seeds"); ModLoader.addRecipe(new ItemStack(AmarilloSeeds, 64), new Object [] {"#", Block.dirt}); Amarillo.iconIndex = ModLoader.addOverride("/gui/items.png", "/Farming/Amarillo8.png"); ModLoader.addName(Amarillo, "Amarillo"); ModLoader.addRecipe(new ItemStack(Amarillo, 64), new Object [] {"#", "#", Block.dirt}); } public String getVersion() { return "1.3.1"; } }BlockAmarillocrop
package net.minecraft.src; import java.util.Random; public class BlockAmarillocrop extends BlockFlower { public BlockAmarillocrop(int i, int j) { super(i, j); blockIndexInTexture = j; setTickRandomly(true); float f = 0.5F; setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); } /** * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of * blockID passed in. Args: blockID. * This basically checks to see if the block below is a tilled field/tilled dirt. If it is true then the crop can grow. */ protected boolean canThisPlantGrowOnThisBlockID(int par1) { return par1 == Block.tilledField.blockID; } /** * Ticks the block if it's been scheduled. This method gets scheduled to run because of the setTickRandomly part in the constructor of the class. */ public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { super.updateTick(par1World, par2, par3, par4, par5Random); if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) { int i = par1World.getBlockMetadata(par2, par3, par4); if (i < 8) { float f = getGrowthRate(par1World, par2, par3, par4); if (par5Random.nextInt((int)(25F / f) + 1) == 0) { i++; par1World.setBlockMetadataWithNotify(par2, par3, par4, i); } } } } /** * This method allows you to use bonemeal on your crop. Code explanation below: ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - This line makes "itemstack" equal to the item currently in the players hand. if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex) - This line checks if the item in players hand is equal to dye. if(itemstack.getItemDamage() == 15) - This line checks if the damage value of that item is 15. Item.dyePowder's damage value of 15 is bonemeal. world.setBlockMetadataWithNotify(i, j, k, 8); - This line sets the metadata value of the block to 8 which is the final growth stage. itemstack.stackSize--; - This line makes the stack size go down by one. world.notifyBlockChange(i, j, k, 0); - This line notifys adjacent blocks that this block has updated its state. */ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { ItemStack itemstack = par5EntityPlayer.inventory.getCurrentItem(); if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex) { if(itemstack.getItemDamage() == 15) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 8); itemstack.stackSize--; par1World.notifyBlockChange(par2, par3, par4, 0); } } super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9); return true; } /** * Gets the growth rate for the crop. Setup to encourage rows by halving growth rate if there is diagonals, crops on * different sides that aren't opposing, and by adding growth for every crop next to this one (and for crop below * this one). Args: x, y, z */ private float getGrowthRate(World par1World, int par2, int par3, int par4) { float f = 1.0F; int i = par1World.getBlockId(par2, par3, par4 - 1); int j = par1World.getBlockId(par2, par3, par4 + 1); int k = par1World.getBlockId(par2 - 1, par3, par4); int l = par1World.getBlockId(par2 + 1, par3, par4); int i1 = par1World.getBlockId(par2 - 1, par3, par4 - 1); int j1 = par1World.getBlockId(par2 + 1, par3, par4 - 1); int k1 = par1World.getBlockId(par2 + 1, par3, par4 + 1); int l1 = par1World.getBlockId(par2 - 1, par3, par4 + 1); boolean flag = k == blockID || l == blockID; boolean flag1 = i == blockID || j == blockID; boolean flag2 = i1 == blockID || j1 == blockID || k1 == blockID || l1 == blockID; for (int i2 = par2 - 1; i2 <= par2 + 1; i2++) { for (int j2 = par4 - 1; j2 <= par4 + 1; j2++) { int k2 = par1World.getBlockId(i2, par3 - 1, j2); float f1 = 0.0F; if (k2 == Block.tilledField.blockID) { f1 = 1.0F; if (par1World.getBlockMetadata(i2, par3 - 1, j2) > 0) { f1 = 3F; } } if (i2 != par2 || j2 != par4) { f1 /= 4F; } f += f1; } } if (flag2 || flag && flag1) { f /= 2.0F; } return f; } /** * The type of render function that is called for this block. The render type of 6 gets the texture and places it four times around the sides of the block and leaves nothing on the top or bottom. */ public int getRenderType() { return 6; } /** * Drops the block items with a specified chance of dropping the specified items */ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) { super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); if (par1World.isRemote) { return; } int i = 3 + par7; for (int j = 0; j < i; j++) { if (par1World.rand.nextInt(15) <= par5) { float f = 0.7F; float f1 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F; float f2 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F; float f3 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F; EntityItem entityitem = new EntityItem(par1World, (float)par2 + f1, (float)par3 + f2, (float)par4 + f3, new ItemStack(mod_Farming.AmarilloSeeds)); entityitem.delayBeforeCanPickup = 10; par1World.spawnEntityInWorld(entityitem); } } } /** * Returns the ID of the items to drop on destruction. "i" is equal to the blocks metadata value(explained slightly more in the getBlockTextureFromSideAndMetadata method below). This means that it will check that that value is equal to 8(the final stage of growth) and if it is then it will drop wheat. It may be fairly obvious, but the 'else' statement means that if the growth state is not equal to 7 then drop nothing (-1 means nothing) */ public int idDropped(int i, Random random, int j) { if (i == 8) { return mod_Farming.Amarillo.shiftedIndex; } else { return -1; } } /** * Returns the quantity of items to drop on block destruction. */ public int quantityDropped(Random random) { return 1; } /** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata. * As you may have been able to tell from the line above, "j" is equal to the metadata value of the block. This checks if that value is equal to a certain number then sets the blocks texture to what you have defined. * The things that are being returned are the ints in your mod_ class which you created and set to your texture for the specific stages of growth. */ public int getBlockTextureFromSideAndMetadata(int i, int j) { if(j == 0) { return blockIndexInTexture; } if(j == 1) { return mod_Farming.AmarillocropStageOne; } if(j == 2) { return mod_Farming.AmarillocropStageTwo; } if(j == 3) { return mod_Farming.AmarillocropStageThree; } if(j == 4) { return mod_Farming.AmarillocropStageFour; } if(j == 5) { return mod_Farming.AmarillocropStageFive; } if(j == 6) { return mod_Farming.AmarillocropStageSix; } if(j == 7) { return mod_Farming.AmarillocropStageSeven; } if(j == 8) { return mod_Farming.AmarillocropStageEight; } return j; } }ItemAmarilloSeeds
package net.minecraft.src; public class ItemAmarilloSeeds extends Item { /** The type of block this seed turns into (wheat or pumpkin stems for instance)*/ private int blockType; /** BlockID of the block the seeds can be planted on. */ private int soilBlockID; public ItemAmarilloSeeds(int i, int j, int k) { super(i); blockType = j; soilBlockID = k; } /** * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return * True if something happen and false if it don't. This is for ITEMS, not BLOCKS ! */ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7) { if (par7 != 1) { return false; } if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6) || !par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6)) { return false; } int i = par3World.getBlockId(par4, par5, par6); if (i == soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6)) { par3World.setBlockWithNotify(par4, par5 + 1, par6, blockType); par1ItemStack.stackSize--; return true; } else { return false; } } }ItemAmarillo
package net.minecraft.src; public class ItemAmarillo extends Item { public ItemAmarillo(int i) { super(i); maxStackSize = 64; } }-
View User Profile
-
View Posts
-
Send Message
Retired StaffSorry, I'm a new at crops... Maybe in ItemAmarilloSeeds, instead of soilBlockID, just put Block.tilledField.blockID or Block.tilledField.
If this doesn't help, you may want to wait for TechGuy.
Here are my codes and the crash report
Crash Report
mod_zombie.java
package net.minecraft.src; public class mod_zombie extends BaseMod { public static final Block Dolomite = new BlockDolomite(160, 0).setBlockName("anyDolomite").setHardness(3F).setResistance(4F).setLightValue(1F); public static final Item DolomiteRock = new ItemDolomiteRock(500).setItemName("DolomiteRock"); public static final Item SteelIngot = new ItemSteelIngot(501).setItemName("SteelIngot"); public static final Item Machete = new ItemMacheteSword(5000, EnumToolZombie.SteelIngot).setItemName("Machete"); public void load() { Dolomite.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/Dolomite.png"); ModLoader.registerBlock(Dolomite); ModLoader.addName(Dolomite, "Dolomite"); ModLoader.addRecipe(new ItemStack(Dolomite, 1)); DolomiteRock.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/DolomiteRock.png"); ModLoader.addName(DolomiteRock, "Dolomite Rock"); ModLoader.addRecipe(new ItemStack(DolomiteRock, 1)); SteelIngot.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/SteelIngot.png"); ModLoader.addName(SteelIngot, "Steel Ingot"); ModLoader.addRecipe(new ItemStack(SteelIngot, 1)); ModLoader.addRecipe(new ItemStack(SteelIngot, 1), new Object [] {"#@", Character.valueOf('#'), Item.ingotIron, Character.valueOf('@'), mod_zombie.DolomiteRock}); Machete.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/Machete.png"); ModLoader.addName(Machete, "Machete"); ModLoader.addRecipe(new ItemStack(Machete, 1), new Object [] {"#", "#", "%", '#', Block.dirt, '%', Item.stick}); } public String getVersion() { return "1.3.1"; } }ItemMacheteSword.java
package net.minecraft.src; public class ItemMacheteSword extends Item { private int weaponDamage; private final EnumToolZombie toolMaterial; public ItemMacheteSword(int par1, EnumToolZombie par2EnumToolZombie) { super(par1); toolMaterial = par2EnumToolZombie; maxStackSize = 1; setMaxDamage(par2EnumToolZombie.getMaxUses()); weaponDamage = 4 + par2EnumToolZombie.getDamageVsEntity(); } /** * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if * sword */ public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) { return par2Block.blockID != Block.web.blockID ? 1.5F : 15F; } /** * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise * the damage on the stack. */ public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { par1ItemStack.damageItem(1, par3EntityLiving); return true; } public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving) { par1ItemStack.damageItem(2, par6EntityLiving); return true; } /** * Returns the damage against a given entity. */ public int getDamageVsEntity(Entity par1Entity) { return weaponDamage; } /** * Returns True is the item is renderer in full 3D when hold. */ public boolean isFull3D() { return true; } /** * returns the action that specifies what animation to play when the items is being used */ public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.block; } /** * How long it takes to use or consume an item */ public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 0x11940; } /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack)); return par1ItemStack; } /** * Returns if the item (tool) can harvest results from the block type. */ public boolean canHarvestBlock(Block par1Block) { return par1Block.blockID == Block.web.blockID; } /** * Return the enchantability factor of the item, most of the time is based on material. */ public int getItemEnchantability() { return toolMaterial.getEnchantability(); } }EnumToolZombie.java
package net.minecraft.src; public enum EnumToolZombie { SteelIngot(3, 7500, 8.0F, 5, 15); /** * The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD) */ private final int harvestLevel; /** * The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32) */ private final int maxUses; /** * The strength of this tool material against blocks which it is effective against. */ private final float efficiencyOnProperMaterial; /** Damage versus entities. */ private final int damageVsEntity; /** Defines the natural enchantability factor of the material. */ private final int enchantability; private EnumToolEsc(int par3, int par4, float par5, int par6, int par7) { this.harvestLevel = par3; this.maxUses = par4; this.efficiencyOnProperMaterial = par5; this.damageVsEntity = par6; this.enchantability = par7; } /** * The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32) */ public int getMaxUses() { return this.maxUses; } /** * The strength of this tool material against blocks which it is effective against. */ public float getEfficiencyOnProperMaterial() { return this.efficiencyOnProperMaterial; } /** * Damage versus entities. */ public int getDamageVsEntity() { return this.damageVsEntity; } /** * The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD) */ public int getHarvestLevel() { return this.harvestLevel; } /** * Return the natural enchantability factor of the material. */ public int getEnchantability() { return this.enchantability; } }-
View User Profile
-
View Posts
-
Send Message
Retired StaffYour crafting recipes are, no offense, completely wrong.
They follow this format:
ModLoader.addRecipe(new ItemStack(nameHere, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
Not entirely, but they won't take damage, and hoes don't till soil. Spades, pickaxes, axes, and swords still function normally but don't take damage. You just have to update your tool classes with the new code, and then change them as you need to.
In the Tips and Tricks it says to only use one mod_class for the whole mod
Why is that?
Can it cause problems?
Update: If you exit the world and rejoin, some of the crops have grown. Also you are able to right click crops (how do I make it so you can't right click). Third sometimes the crop appears as the default purple texture (I wonder which texture is missing...)
Update 2: I checked and the textures for all 8 growth stages are working so I have no idea what is causing the purple boxes to appear...
BlockAmarilloCrop
package net.minecraft.src; import java.util.Random; public class BlockAmarillocrop extends BlockFlower { public BlockAmarillocrop(int i, int j) { super(i, j); blockIndexInTexture = j; setTickRandomly(true); float f = 0.5F; setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); } /** * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of * blockID passed in. Args: blockID. * This basically checks to see if the block below is a tilled field/tilled dirt. If it is true then the crop can grow. */ protected boolean canThisPlantGrowOnThisBlockID(int par1) { return par1 == Block.tilledField.blockID; } /** * Ticks the block if it's been scheduled. This method gets scheduled to run because of the setTickRandomly part in the constructor of the class. */ public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { super.updateTick(par1World, par2, par3, par4, par5Random); if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) { int i = par1World.getBlockMetadata(par2, par3, par4); if (i < 8) { float f = getGrowthRate(par1World, par2, par3, par4); if (par5Random.nextInt((int)(25F / f) + 1) == 0) { i++; par1World.setBlockMetadataWithNotify(par2, par3, par4, i); } } } } /** * This method allows you to use bonemeal on your crop. Code explanation below: ItemStack itemstack = entityplayer.inventory.getCurrentItem(); - This line makes "itemstack" equal to the item currently in the players hand. if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex) - This line checks if the item in players hand is equal to dye. if(itemstack.getItemDamage() == 15) - This line checks if the damage value of that item is 15. Item.dyePowder's damage value of 15 is bonemeal. world.setBlockMetadataWithNotify(i, j, k, 8); - This line sets the metadata value of the block to 8 which is the final growth stage. itemstack.stackSize--; - This line makes the stack size go down by one. world.notifyBlockChange(i, j, k, 0); - This line notifys adjacent blocks that this block has updated its state. */ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { ItemStack itemstack = par5EntityPlayer.inventory.getCurrentItem(); if(itemstack != null && itemstack.itemID == Item.dyePowder.shiftedIndex) { if(itemstack.getItemDamage() == 15) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 8); itemstack.stackSize--; par1World.notifyBlockChange(par2, par3, par4, 0); } } super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9); return true; } /** * Gets the growth rate for the crop. Setup to encourage rows by halving growth rate if there is diagonals, crops on * different sides that aren't opposing, and by adding growth for every crop next to this one (and for crop below * this one). Args: x, y, z */ private float getGrowthRate(World par1World, int par2, int par3, int par4) { float f = 1.0F; int i = par1World.getBlockId(par2, par3, par4 - 1); int j = par1World.getBlockId(par2, par3, par4 + 1); int k = par1World.getBlockId(par2 - 1, par3, par4); int l = par1World.getBlockId(par2 + 1, par3, par4); int i1 = par1World.getBlockId(par2 - 1, par3, par4 - 1); int j1 = par1World.getBlockId(par2 + 1, par3, par4 - 1); int k1 = par1World.getBlockId(par2 + 1, par3, par4 + 1); int l1 = par1World.getBlockId(par2 - 1, par3, par4 + 1); boolean flag = k == blockID || l == blockID; boolean flag1 = i == blockID || j == blockID; boolean flag2 = i1 == blockID || j1 == blockID || k1 == blockID || l1 == blockID; for (int i2 = par2 - 1; i2 <= par2 + 1; i2++) { for (int j2 = par4 - 1; j2 <= par4 + 1; j2++) { int k2 = par1World.getBlockId(i2, par3 - 1, j2); float f1 = 0.0F; if (k2 == Block.tilledField.blockID) { f1 = 1.0F; if (par1World.getBlockMetadata(i2, par3 - 1, j2) > 0) { f1 = 3F; } } if (i2 != par2 || j2 != par4) { f1 /= 4F; } f += f1; } } if (flag2 || flag && flag1) { f /= 2.0F; } return f; } /** * The type of render function that is called for this block. The render type of 6 gets the texture and places it four times around the sides of the block and leaves nothing on the top or bottom. */ public int getRenderType() { return 6; } /** * Drops the block items with a specified chance of dropping the specified items */ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) { super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); if (par1World.isRemote) { return; } int i = 3 + par7; for (int j = 0; j < i; j++) { if (par1World.rand.nextInt(15) <= par5) { float f = 0.7F; float f1 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F; float f2 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F; float f3 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5F; EntityItem entityitem = new EntityItem(par1World, (float)par2 + f1, (float)par3 + f2, (float)par4 + f3, new ItemStack(mod_Farming.AmarilloSeeds)); entityitem.delayBeforeCanPickup = 10; par1World.spawnEntityInWorld(entityitem); } } } /** * Returns the ID of the items to drop on destruction. "i" is equal to the blocks metadata value(explained slightly more in the getBlockTextureFromSideAndMetadata method below). This means that it will check that that value is equal to 8(the final stage of growth) and if it is then it will drop wheat. It may be fairly obvious, but the 'else' statement means that if the growth state is not equal to 7 then drop nothing (-1 means nothing) */ public int idDropped(int i, Random random, int j) { if (i == 8) { return Item.wheat.shiftedIndex; } else { return -1; } } /** * Returns the quantity of items to drop on block destruction. */ public int quantityDropped(Random random) { return 1; } /** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata. * As you may have been able to tell from the line above, "j" is equal to the metadata value of the block. This checks if that value is equal to a certain number then sets the blocks texture to what you have defined. * The things that are being returned are the ints in your mod_ class which you created and set to your texture for the specific stages of growth. */ public int getBlockTextureFromSideAndMetadata(int i, int j) { if(j == 0) { return blockIndexInTexture; } if(j == 1) { return mod_Farming.AmarillocropStageOne; } if(j == 2) { return mod_Farming.AmarillocropStageTwo; } if(j == 3) { return mod_Farming.AmarillocropStageThree; } if(j == 4) { return mod_Farming.AmarillocropStageFour; } if(j == 5) { return mod_Farming.AmarillocropStageFive; } if(j == 6) { return mod_Farming.AmarillocropStageSix; } if(j == 7) { return mod_Farming.AmarillocropStageSeven; } if(j == 8) { return mod_Farming.AmarillocropStageEight; } return j; } }mod_Farming
package net.minecraft.src; public class mod_Farming extends BaseMod { public static final Block Amarillocrop = new BlockAmarillocrop(255, 0).setBlockName("Amarillocrop"); public static final Item AmarilloSeeds = new ItemAmarilloSeeds(5000, Amarillocrop.blockID, Block.tilledField.blockID).setItemName("AmarilloSeeds"); public static final Item Amarillo = new ItemAmarillo(5013).setItemName("Amarillo"); public static int AmarillocropStageOne = ModLoader.addOverride("/terrain.png", "/Amarillo1.png"); public static int AmarillocropStageTwo = ModLoader.addOverride("/terrain.png", "/Amarillo2.png"); public static int AmarillocropStageThree = ModLoader.addOverride("/terrain.png", "/Amarillo3.png"); public static int AmarillocropStageFour = ModLoader.addOverride("/terrain.png", "/Amarillo4.png"); public static int AmarillocropStageFive = ModLoader.addOverride("/terrain.png", "/Amarillo5.png"); public static int AmarillocropStageSix = ModLoader.addOverride("/terrain.png", "/Amarillo6.png"); public static int AmarillocropStageSeven = ModLoader.addOverride("/terrain.png", "/Amarillo7.png"); public static int AmarillocropStageEight = ModLoader.addOverride("/terrain.png", "/Amarillo8.png"); public void load() { Amarillocrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Amarillo1.png"); ModLoader.registerBlock(Amarillocrop); ModLoader.addName(Amarillocrop, "Amarillo"); AmarilloSeeds.iconIndex = ModLoader.addOverride("/gui/items.png", "/AmarilloSeeds.png"); ModLoader.addName(AmarilloSeeds, "Amarillo Seeds"); ModLoader.addRecipe(new ItemStack(AmarilloSeeds, 64), new Object [] {"#", Character.valueOf('#'), Block.dirt}); Amarillo.iconIndex = ModLoader.addOverride("/gui/items.png", "/Amarillo8.png"); ModLoader.addName(Amarillo, "Amarillo"); ModLoader.addRecipe(new ItemStack(Amarillo, 64), new Object [] {"#", "#", Character.valueOf('#'), Block.dirt}); } public String getVersion() { return "1.3.1"; } }