I want to make a crop and I followed the tutorial for it, I get no error's but when i place my crop on the ground it becomes just a block not a growing crop. Hope someone can help me out
Code
mod_carrot
package net.minecraft.src;
import java.util.*;
import net.minecraft.client.Minecraft;
public class mod_carrot extends BaseModMp
{
public static final Block WildCarrot = (new BlockWildCarrot(179, 0)).setHardness(0.0F).setResistance(11F).setBlockName("WildCarrot");
public static final Item Carrot = (new ItemFood(1002, 4, 0.3F, false)).setIconCoord(0, 0).setItemName("WildCarrot");
public static final Item carrotseeds;
public static final Block CarrotCrop = (new BlockCarrotCrop(178, 0).setBlockName("cropNameHere"));
public static int CarrotStage1 = ModLoader.addOverride("/terrain.png","/world/Cs1.png");
public static int CarrotStage2 = ModLoader.addOverride("/terrain.png","/world/Cs2.png");
public static int CarrotStage3 = ModLoader.addOverride("/terrain.png","/world/Cs3.png");
public static int CarrotStage4 = ModLoader.addOverride("/terrain.png","/world/Cs4.png");
public void load()
{
WildCarrot.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/World/WildCarrot.png");
Carrot.iconIndex = ModLoader.addOverride("/gui/items.png","/World/Carrot.png");
carrotseeds.iconIndex = ModLoader.addOverride("/gui/items.png","/World/carrotseeds.png");
CarrotCrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/World/WildCarrot1.png");
ModLoader.registerBlock(WildCarrot);
ModLoader.registerBlock(CarrotCrop);
ModLoader.addName(WildCarrot, "Wild Carrot");
ModLoader.addName(Carrot, "Carrot");
ModLoader.addName(CarrotCrop, "Carrot Crop");
ModLoader.addName(carrotseeds, "Carrot Seeds");
}
public void generateSurface(World world, Random random, int i, int j)
{
for (int k = 0; k > 7; k++) { }
{
int l = i + random.nextInt(16);
int i1 = random.nextInt(128);
int j1 = j + random.nextInt(16);
(new WorldGenFlowers(WildCarrot.blockID)).generate(world, random, l, i1, j1);
}
}
static
{
carrotseeds = (new Itemcarrotseeds(1003, mod_carrot.CarrotCrop.blockID, Block.tilledField.blockID)).setIconCoord(9, 0).setItemName("seeds");
}
public String getVersion()
{
return "1.3.0";
}
}
BlockCarrotCrop
package net.minecraft.src;
import java.util.Random;
public class BlockCarrotCrop extends BlockFlower
{
public BlockCarrotCrop(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.
/**
* 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 1;
}
/**
* 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_carrot.carrotseeds));
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_carrot.Carrot.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_carrot.CarrotStage1;
}
if(j == 2)
{
return mod_carrot.CarrotStage1;
}
if(j == 3)
{
return mod_carrot.CarrotStage2;
}
if(j == 4)
{
return mod_carrot.CarrotStage2;
}
if(j == 5)
{
return mod_carrot.CarrotStage2;
}
if(j == 6)
{
return mod_carrot.CarrotStage3;
}
if(j == 7)
{
return mod_carrot.CarrotStage3;
}
if(j == 8)
{
return mod_carrot.CarrotStage4;
}
return j;
}
}
Itemcarrotseed
package net.minecraft.src;
public class Itemcarrotseeds 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 Itemcarrotseeds(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 just chanched from the code from Itemseeds.java to your code but now when i right click nothing happends you do get the animation from something happening but nothing happens
I get this same exact problem. I used some of the game's main code to make it work better, but mostly yours. That didn't make a difference tho, all I get is the block that doesn't grow, weird thing is, bonemeal does make it grow into the grown plant like it should. It won't grow naturally tho :/
Any reason that my mob is invisible? I've made sure that the texture is correctly linked and everything no errors it's just invisible. Here's the code.
I'll try and redo some of your code to fix it. Brb.
name it mod_Core
package net.minecraft.src;
public class mod_Core extends BaseMod
{
public static final Block mod_Core = new Core(200, 0).setBlockName("mod_Core").setHardness(3F).setResistance(4F).setLightValue(12F);
public void load()
{
mod_Core.blockIndexInTexture = ModLoader.addOverride("/gui/item.png", "/C:/Users/Anthony/Desktop/core.png");
ModLoader.registerBlock(mod_Core);
ModLoader.addName(mod_Core, "Core");
ModLoader.addRecipe(new ItemStack(mod_Core, 1), new Object [] {"#", "#", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.3.1";
}
}
Name this Core
package net.minecraft.src;
import java.util.Random;
public class Core extends Block
{
public Core(int i, int j)
{
super(200, 0, Material.rock);
}
public int id200(int i, Random random, int j)
{
return mod_Core.mod_Core.blockID;
}
public int quantity1(Random random)
{
return 1;
}
}
I kept all the variables the same (block ID, resistance ,ect).Also you don't need the file you had named "Modloader" , delete it. You don't have to accept my above remake of your code, but it has no errors. Your texture path s a bit messed up. i'd change it to "/Core.png" and put it inside of your minecraf.jar inside of your bin folder inside of the jars folder inside of your MPC folder.
EDIT: I can explain what I did if you want .
I tried what code you gave me, Tech_warrior, but it's still not showing up in game. I put the dirt int eh crafting table and nothing happens.
I tried what code you gave me, Tech_warrior, but it's still not showing up in game. I put the dirt int eh crafting table and nothing happens.
Don't name your mod item the same as the mod class.
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.
Well, I made a biome, and it does generate. However, there is a problem. The code I gave the biome to make the grass and whatnot an orange-ish color isn't working: everything looks like a normal green.
mod_mangmod.java
package net.minecraft.src;
public class mod_mangmod extends BaseMod
{
public static final BiomeGenBase fall = (new fall(25)).setColor(0xee9a00).setBiomeName("fall");
public static final Block bluebrick = new bluebrick(200, 0).setBlockName("bluebrick").setHardness(2.0F).setResistance(10F);
public void load()
{
ModLoader.addBiome(fall);
bluebrick.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mangmod/bluebrick.png");
ModLoader.registerBlock(bluebrick);
ModLoader.addName(bluebrick, "Blue Brick");
ModLoader.addRecipe(new ItemStack(bluebrick, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
}
public String getVersion()
{
return "1.3.1";
}
}
fall.java
package net.minecraft.src;
public class fall extends BiomeGenBase
{
public fall(int par1)
{
super(par1);
topBlock = (byte)Block.grass.blockID;
fillerBlock = (byte)Block.dirt.blockID;
theBiomeDecorator.treesPerChunk = 1;
theBiomeDecorator.flowersPerChunk = 0;
theBiomeDecorator.grassPerChunk = 8;
theBiomeDecorator.deadBushPerChunk = 2;
theBiomeDecorator.waterlilyPerChunk = 5;
}
}
Just quoting myself...originally this was on page 196...but it got covered up and ignored.
Hey techguy i made a flower, using your advanced code and i took out a few things but when i create a world it gets stuck on loading terrain and doesn't change, plz help
I'm familiar to java and minecraft modding and this is confusing.
mod_Kill
package net.minecraft.src;
import java.util.Random;
public class mod_Kill extends BaseMod
{
public static final Block blueFlower= new BlueFlower(165, 0).setBlockName("blue flower");
public void load()
{
ModLoader.registerBlock(blueFlower);
blueFlower.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Textures/BlueFlower.png");
ModLoader.addName(blueFlower, "Bluebell");
}
public void generateSurface(World world, Random random, int i, int j)
{
for(int k = 0; k < 7; k++)
{
int randPosX = i + random.nextInt(16);
int randPosY = random.nextInt(128);
int randPosZ = j + random.nextInt(16);
(new WorldGenFlowers(blueFlower.blockID)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
public String getVersion()
{
return "1.3.1";
}
}
BlueFlower
package net.minecraft.src;
import java.util.Random;
public class BlueFlower extends Block
{
protected BlueFlower(int i, int j)
{
super(i, Material.plants);
blockIndexInTexture = j;
setTickRandomly(true);
float f = 0.2F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3F, 0.5F + f);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
return super.canPlaceBlockAt(world, i, j, k) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k));
}
protected boolean canThisPlantGrowOnThisBlockID(int i)
{
return i == Block.grass.blockID || i == Block.dirt.blockID;
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 1;
}
}
[01:47:39] Overriding /gui/items.png with /textures/lurium.png @ 38. 80 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumhotiron.png @ 102. 79
left.
[01:47:39] Overriding /gui/items.png with /textures/luriumpickaxe.png @ 118. 78
left.
[01:47:39] Overriding /gui/items.png with /textures/luriumaxe.png @ 119. 77 left
.
[01:47:39] Overriding /gui/items.png with /textures/luriumshovel.png @ 120. 76 l
eft.
[01:47:39] Overriding /gui/items.png with /textures/luriumsword.png @ 134. 75 le
ft.
[01:47:39] Overriding /gui/items.png with /textures/luriumhoe.png @ 144. 74 left
.
[01:47:39] Overriding /gui/items.png with /textures/luriumhelmet.png @ 145. 73 l
eft.
[01:47:39] Overriding /gui/items.png with /textures/luriumchestplate.png @ 146.
72 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumleggins.png @ 147. 71
left.
[01:47:39] Overriding /gui/items.png with /textures/luriumboots.png @ 148. 70 le
ft.
[01:47:39] Overriding /gui/items.png with /textures/luriumiron.png @ 149. 69 lef
t.
[01:47:39] Overriding /gui/items.png with /textures/luriumaxebillet.png @ 150. 6
8 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumpickaxebillet.png @ 15
2. 67 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumhoebillet.png @ 160. 6
6 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumshovelbillet.png @ 161
. 65 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumswordbilletpartone.png
@ 162. 64 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumswordbilletpartotwo.pn
g @ 163. 63 left.
[01:47:39] Overriding /gui/items.png with /textures/hiltofluriumsword.png @ 164.
62 left.
[01:47:49] Exception in thread "Minecraft main thread" java.lang.ExceptionInInit
ializerError
[01:47:49] at net.minecraft.client.Minecraft.startGame(Minecraft.java:404)
[01:47:49] at net.minecraft.client.Minecraft.run(Minecraft.java:724)
[01:47:49] at java.lang.Thread.run(Thread.java:722)
[01:47:49] Caused by: java.lang.RuntimeException: java.lang.StringIndexOutOfBoun
dsException: String index out of range: 10
[01:47:49] at net.minecraft.src.ModLoader.init(ModLoader.java:963)
[01:47:49] at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:16
1)
[01:47:49] at net.minecraft.src.RenderManager.<init>(RenderManager.java:86)
[01:47:49] at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:1
4)
[01:47:49] ... 3 more
[01:47:49] Caused by: java.lang.StringIndexOutOfBoundsException: String index ou
t of range: 10
[01:47:49] at java.lang.String.charAt(String.java:695)
[01:47:49] at net.minecraft.src.CraftingManager.addRecipe(CraftingManager.j
ava:185)
[01:47:49] at net.minecraft.src.ModLoader.addRecipe(ModLoader.java:482)
[01:47:49] at net.minecraft.src.mod_litto.load(mod_litto.java:112)
[01:47:49] at net.minecraft.src.ModLoader.init(ModLoader.java:927)
[01:47:49] ... 6 more
Minecraft Error
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem; ModLoader has failed to initialize.
This error has been saved to C:\Users\Litto\Desktop\Minecraft Coder Pack\jars\.\crash-reports\crash-2012-08-11_01.47.49-client.txt for your convenience. Please include a copy of this file if you report this crash to anyone.
--- BEGIN ERROR REPORT f49d38a --------
Generated 11.08.12 1:47
- Minecraft Version: 1.3.1
- Operating System: Windows 7 (amd64) version 6.1
- Java Version: 1.7.0_05, Oracle Corporation
- Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
- Memory: 997854656 bytes (951 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
- JVM Flags: 3 total; -Xincgc -Xms1024M -Xmx1024M
- ModLoader: Mods loaded: 2
ModLoader 1.3.1
mod_litto 1.3.1
java.lang.StringIndexOutOfBoundsException: String index out of range: 10
at java.lang.String.charAt(String.java:695)
at net.minecraft.src.CraftingManager.addRecipe(CraftingManager.java:185)
at net.minecraft.src.ModLoader.addRecipe(ModLoader.java:482)
at net.minecraft.src.mod_litto.load(mod_litto.java:112)
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)
--- END ERROR REPORT dee0d599 ----------
Here is my mod_litto code
package net.minecraft.src;
import java.util.Random;
public class mod_litto extends BaseMod
{
public static final Block LuriumOre = new BlockLuriumOre(160, 0).setBlockName("LuriumOre").setHardness(3.0F).setResistance(5F).setLightValue(0F).setCreativeTab(CreativeTabs.tabBlock);
public static final Block LuriumBlock = new BlockLuriumBlock(161, 0).setBlockName("LuriumBlock").setHardness(3F).setResistance(4F).setLightValue(0F).setCreativeTab(CreativeTabs.tabBlock);
public static final Item Lurium = new ItemLurium(5000).setItemName("Lurium").setTabToDisplayOn(CreativeTabs.tabMaterials);
public static final Item LuriumIron = new ItemLuriumIron(5001).setItemName("LuriumIron").setTabToDisplayOn(CreativeTabs.tabMaterials).setTabToDisplayOn(CreativeTabs.tabMaterials);
public static final Item Pickaxe = new ItemLuriumPickaxe(5002, EnumToolMaterialLurium.MATERIALLurium).setItemName("Pickaxe").setTabToDisplayOn(CreativeTabs.tabTools);
public static final Item Axe = new ItemLuriumAxe(5003, EnumToolMaterialLurium.MATERIALLurium).setItemName("Axe").setTabToDisplayOn(CreativeTabs.tabTools);
public static final Item Shovel = new ItemLuriumShovel(5004, EnumToolMaterialLurium.MATERIALLurium).setItemName("Shovel").setTabToDisplayOn(CreativeTabs.tabTools);
public static final Item Sword = new ItemLuriumSword(5005, EnumToolMaterialLurium.MATERIALLurium).setItemName("Sword").setTabToDisplayOn(CreativeTabs.tabTools);
public static final Item Hoe = new ItemLuriumHoe(5006, EnumToolMaterialLurium.MATERIALLurium).setItemName("Hoe").setTabToDisplayOn(CreativeTabs.tabTools);
public static Item LuriumHelmet=(new ItemArmor(5007, EnumArmorMaterial.Lurium, 5, 0)).setItemName("LuriumHelmet").setTabToDisplayOn(CreativeTabs.tabCombat);
public static Item LuriumChestplate=(new ItemArmor(5008, EnumArmorMaterial.Lurium, 5, 1)).setItemName("LuriumChestplate").setTabToDisplayOn(CreativeTabs.tabCombat);
public static Item LuriumLeggins=(new ItemArmor(5009, EnumArmorMaterial.Lurium, 5, 2)).setItemName("LuriumLeggins").setTabToDisplayOn(CreativeTabs.tabCombat);
public static Item LuriumBoots=(new ItemArmor(5010, EnumArmorMaterial.Lurium, 5, 3)).setItemName("LuriumBoots").setTabToDisplayOn(CreativeTabs.tabCombat);
public static final Item LuriumHotIron = new ItemLuriumHotIron(5011).setItemName("LuriumHotIron").setTabToDisplayOn(CreativeTabs.tabMaterials);
public static final Item LuriumAxeBillet = new ItemLuriumAxeBillet(5012).setItemName("LuriumAxeBillet").setTabToDisplayOn(CreativeTabs.tabMaterials);
public static final Item LuriumPickaxeBillet = new ItemLuriumPickaxeBillet(5013).setItemName("LuriumPickAxe").setTabToDisplayOn(CreativeTabs.tabMaterials);
public static final Item LuriumHoeBillet = new ItemLuriumHoeBillet(5014).setItemName("LuriumHoeBillet").setTabToDisplayOn(CreativeTabs.tabMaterials);
public static final Item LuriumShovelBillet = new ItemLuriumShovelBillet(5015).setItemName("LuriumShovelBillet").setTabToDisplayOn(CreativeTabs.tabMaterials);
public static final Item LuriumSwordBilletPartOne = new ItemLuriumSwordBilletPartOne(5016).setItemName("LuriumSwordBilletPartOne").setTabToDisplayOn(CreativeTabs.tabMaterials);
public static final Item LuriumSwordBilletPartTwo = new ItemLuriumSwordBilletPartTwo(5017).setItemName("SwordBilletPartTwo").setTabToDisplayOn(CreativeTabs.tabMaterials);
public static final Item HiltOfLuriumSword = new ItemHiltOfLuriumSword(5018).setItemName("HiltOfLuriumSword").setTabToDisplayOn(CreativeTabs.tabMaterials);
public void load()
{
LuriumOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/textures/luriumore.png");
ModLoader.registerBlock(LuriumOre);
ModLoader.addName(LuriumOre, "Lurium Ore");
LuriumBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/textures/luriumblock.png");
ModLoader.registerBlock(LuriumBlock);
ModLoader.addName(LuriumBlock, "LuriumBlock");
ModLoader.addRecipe(new ItemStack(LuriumBlock, 1), new Object [] {"###", "###", "###", Character.valueOf('#'), mod_litto.Lurium});
Lurium.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/lurium.png");
ModLoader.addName(Lurium, "Lurium");
ModLoader.addRecipe(new ItemStack(Lurium, 9), new Object [] {"#", Character.valueOf('#'), mod_litto.LuriumBlock});
LuriumHotIron.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumhotiron.png");
ModLoader.addName(LuriumHotIron, "Lurium Hot Iron");
ModLoader.addSmelting(mod_litto.LuriumIron.shiftedIndex, new ItemStack(mod_litto.LuriumHotIron, 1), 1.0F);
Pickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumpickaxe.png");
ModLoader.addName(Pickaxe, "Lurium Pickaxe");
ModLoader.addRecipe(new ItemStack(Pickaxe, 1), new Object [] {" # ", " % ", " % ", '#', mod_litto.LuriumPickaxeBillet, '%', Item.stick});
Axe.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumaxe.png");
ModLoader.addName(Axe, "Lurium Axe");
ModLoader.addRecipe(new ItemStack(Axe, 1), new Object [] {"# ", " % ", " % ", '#', mod_litto.LuriumAxeBillet, '%', Item.stick});
Shovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumshovel.png");
ModLoader.addName(Shovel, "Lurium Shovel");
ModLoader.addRecipe(new ItemStack(Shovel, 1), new Object [] {"#", "%", "%", '#', mod_litto.LuriumShovelBillet, '%', Item.stick});
Sword.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumsword.png");
ModLoader.addName(Sword, "Lurium Sword");
ModLoader.addRecipe(new ItemStack(Sword, 1), new Object [] {" #", " X ", "% ", '#', mod_litto.LuriumSwordBilletPartOne, '%', mod_litto.HiltOfLuriumSword, 'X', mod_litto.LuriumSwordBilletPartTwo});
Hoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumhoe.png");
ModLoader.addName(Hoe, "Lurium Hoe");
ModLoader.addRecipe(new ItemStack(Hoe, 1), new Object [] {" # ", " % ", " % ", '#', mod_litto.LuriumHoeBillet, '%', Item.stick});
LuriumHelmet.iconIndex=ModLoader.addOverride("/gui/items.png", "/textures/luriumhelmet.png");
ModLoader.addName(LuriumHelmet, "Lurium Helmet");
ModLoader.addRecipe(new ItemStack(LuriumHelmet, 1), new Object[]{ "XXX", "X X", Character.valueOf('X'), mod_litto.LuriumHotIron});
LuriumChestplate.iconIndex=ModLoader.addOverride("/gui/items.png", "/textures/luriumchestplate.png");
ModLoader.addName(LuriumChestplate, "Lurium Chestplate");
ModLoader.addRecipe(new ItemStack(LuriumChestplate, 1), new Object[]{ "X X", "XXX","XXX", Character.valueOf('X'), mod_litto.LuriumHotIron});
LuriumLeggins.iconIndex=ModLoader.addOverride("/gui/items.png", "/textures/luriumleggins.png");
ModLoader.addName(LuriumLeggins, "Lurium Leggins");
ModLoader.addRecipe(new ItemStack(LuriumLeggins, 1), new Object[]{ "XXX", "X X","X X", Character.valueOf('X'), mod_litto.LuriumHotIron});
LuriumBoots.iconIndex=ModLoader.addOverride("/gui/items.png", "/textures/luriumboots.png");
ModLoader.addName(LuriumBoots, "Lurium Boots");
ModLoader.addRecipe(new ItemStack(LuriumBoots, 1), new Object[]{ "X X", "X X", Character.valueOf('X'), mod_litto.LuriumHotIron});
LuriumIron.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumiron.png");
ModLoader.addName(LuriumIron, "Lurium Iron");
ModLoader.addRecipe(new ItemStack(LuriumIron, 1), new Object [] {"#X#","X#X", "#X#", Character.valueOf('#'), mod_litto.Lurium, Character.valueOf('X'), Item.ingotIron});
LuriumAxeBillet.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumaxebillet.png");
ModLoader.addName(LuriumAxeBillet, "Lurium Axe Billet");
ModLoader.addRecipe(new ItemStack(LuriumAxeBillet, 1), new Object [] {"## ","# ", Character.valueOf('#'), mod_litto.LuriumHotIron});
LuriumPickaxeBillet.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumpickaxebillet.png");
ModLoader.addName(LuriumPickaxeBillet, "Lurium Pickaxe Billet");
ModLoader.addRecipe(new ItemStack(LuriumPickaxeBillet, 1), new Object [] {"###", Character.valueOf('#'), mod_litto.LuriumHotIron});
LuriumHoeBillet.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumhoebillet.png");
ModLoader.addName(LuriumHoeBillet, "Lurium Hoe Billet");
ModLoader.addRecipe(new ItemStack(LuriumHoeBillet, 1), new Object [] {"#", Character.valueOf('#'), mod_litto.LuriumHotIron});
LuriumShovelBillet.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumshovelbillet.png");
ModLoader.addName(LuriumShovelBillet, "Lurium Shovel Billet");
ModLoader.addRecipe(new ItemStack(LuriumShovelBillet, 1), new Object [] {" # ", " ", " ", Character.valueOf('#'), mod_litto.LuriumHotIron});
LuriumSwordBilletPartOne.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumswordbilletpartone.png");
ModLoader.addName(LuriumSwordBilletPartOne, "Lurium Sword Billet Part One");
ModLoader.addRecipe(new ItemStack(LuriumSwordBilletPartOne, 1), new Object [] {" #"," "," ", Character.valueOf('#'), mod_litto.LuriumIron});
LuriumSwordBilletPartTwo.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumswordbilletpartotwo.png");
ModLoader.addName(LuriumSwordBilletPartTwo, "Lurium Sword Billet Part Two");
ModLoader.addRecipe(new ItemStack(LuriumSwordBilletPartTwo, 1), new Object [] {" "," # "," ", Character.valueOf('#'), mod_litto.LuriumIron});
HiltOfLuriumSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/hiltofluriumsword.png");
ModLoader.addName(HiltOfLuriumSword, "Hilt Of Lurium Sword");
ModLoader.addRecipe(new ItemStack(HiltOfLuriumSword, 1), new Object [] {" "," # ","# ", Character.valueOf('#'), Item.stick});
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
for(int i = 0; i < 170; i++)
{
int randPosX = chunkX + random.nextInt(16);
int randPosY = random.nextInt(128);
int randPosZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(LuriumOre.blockID, 6)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
public String getVersion()
{
return "1.3.1";
}
}
Don't name your mod item the same as the mod class.
Wait, do you mean I have to rename a file or replace all of the respectful names with soemthing else?
If you can give me an example, preferably telling me what I need to rename it, please use Core_Block. It's the original name I had for the block itself, as should be seen in game, but now I'm not even sure what to call it, or do.
Hey everyone! So, I codded my new mob exactly as it says in the tutorial, but when I go to my world this error appears:
java.lang.NullPointerException
at net.minecraft.src.NetClientHandler.handleMobSpawn(NetClientHandler.java:730)
at net.minecraft.src.Packet24MobSpawn.processPacket(Packet24MobSpawn.java:137)
at net.minecraft.src.MemoryConnection.processReadPackets(MemoryConnection.java:70)
at net.minecraft.src.NetClientHandler.processReadPackets(NetClientHandler.java:89)
at net.minecraft.src.WorldClient.tick(WorldClient.java:63)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1760)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:821)
at net.minecraft.client.Minecraft.run(Minecraft.java:751)
at java.lang.Thread.run(Unknown Source)
java.io.IOException: Stream Closed
at java.io.RandomAccessFile.seek(Native Method)
at net.minecraft.src.RegionFile.write(RegionFile.java:291)
at net.minecraft.src.RegionFile.write(RegionFile.java:206)
at net.minecraft.src.RegionFileChunkBuffer.close(RegionFileChunkBuffer.java:23)
at java.util.zip.DeflaterOutputStream.close(Unknown Source)
at java.io.FilterOutputStream.close(Unknown Source)
at net.minecraft.src.AnvilChunkLoader.writeChunkNBTTags(AnvilChunkLoader.java:181)
at net.minecraft.src.AnvilChunkLoader.writeNextIO(AnvilChunkLoader.java:166)
at net.minecraft.src.ThreadedFileIOBase.processQueue(ThreadedFileIOBase.java:39)
at net.minecraft.src.ThreadedFileIOBase.run(ThreadedFileIOBase.java:27)
at java.lang.Thread.run(Unknown Source)
And besides this error, I saw that in the Eclipse console, it says Skipping Entity with id Ender Spirit (which is the mob I added).
Can someone help me please? I really want my mod to work! And btw TechGuy, great tutorials!
If you didn't see the massive red bold letters saying it wasn't updated, or you started before that was done. Mobs are not updated yet.
Is it possible to add a recipe to an item already in the game without modifying a default class file? Say I added a cyan flower and I wanted to be able to craft cyan dye with it, could I add the crafting recipe to mod_CyanFlower?
Edit: I got it working, but now I was wondering if I could make my flower actually sound like a flower when it gets destroyed, it currently sounds like stone.
Yes, that's easy. Go to the part of your code where you declare your block, then add this on the end. .setStepSound(soundGrassFootstep)
So it looks like this.
public static final Block myBlock = new BlockMyblock(160, 0).setBlockName("blocky blocky").setStepSound(Block.grassStoneFootstep).setHardness(0.40F).setResistance(4F).setLightValue(1F);
And, in your Block file, you can change the material. Change it to Material.plants. Only if you didn't have that already.
Wait, do you mean I have to rename a file or replace all of the respectful names with soemthing else?
If you can give me an example, preferably telling me what I need to rename it, please use Core_Block. It's the original name I had for the block itself, as should be seen in game, but now I'm not even sure what to call it, or do.
You should understand the things you declare.
public static final Block celestialBronzeOre = new BlockCelestialBronze(160, 0).setBlockName("CelestialBronzeOre").setStepSound(Block.soundStoneFootstep).setHardness(0.40F).setResistance(4F).setLightValue(1F);
for example, celestialBronzeOre just gives you code something that refers to your block. celestialBronze is just what you refer to your block inside your mod class. Naming you mod class should be easy, just put there anything that you think is good. It really depends to you. Now, the part where it says new BlockCelestialBronze just refers to the main class in which all the features of the block itself are found. To summarize it up,
mod_ = just the name of your mod. ex. mod_CarMod, mod_GunMod
celestialBronzeOre = the one you use to refer to your block inside the mod_ class
BlockCelestialBronze = where the features of the block itself are explained.
You see, naming isn't really a problem, but remember that no two class files can have the same name. It's all up to you.
Hey dude im a really big fan of your mod tutorials ^o^
I looked a tutorial for Dimensions on youtube!
I got 3 problems!
1.I CANNOT create a portal but i can craft 1 and enter the dimension:
DeathlandsPortal.java class:
[code]package net.minecraft.src;
import java.util.List;
import java.util.ArrayList;
public class DeathlandsPortal extends BlockPortalBase
{
//Look in BlockPortalBase.java to see the full array of hooks you can use for your portal block.
public DeathlandsPortal(int i)
{
super(i, ModLoader.addOverride("/terrain.png", "/Blocks/DeathPortal.png"), Material.portal);
//Get a unique sprite index for the portal texture so that it doesn't override another
//texture.
}
public WorldProviderBase getDimension()
{
return new WorldProviderDeathlands();
}
public Teleporter getTeleporter()
{
return new TeleporterDeathlands();
}
//You can get to this dimension from the overworld (0) and Nether (-1).
//You should probably make the portal non-solid so you can step into it...
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
}
/**
* Updates the blocks bounds based on its current state. Args: world, x, y, z
*/
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
if (par1IBlockAccess.getBlockId(par2 - 1, par3, par4) == blockID || par1IBlockAccess.getBlockId(par2 + 1, par3, par4) == blockID)
{
float f = 0.5F;
float f2 = 0.125F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f2, 0.5F + f, 1.0F, 0.5F + f2);
}
else
{
float f1 = 0.125F;
float f3 = 0.5F;
setBlockBounds(0.5F - f1, 0.0F, 0.5F - f3, 0.5F + f1, 1.0F, 0.5F + f3);
}
}
public List canTeleportFromDimension()
{
ArrayList arraylist = new ArrayList();
arraylist.add(Integer.valueOf(0));//player can teleport from overworld to this dimension
arraylist.add(Integer.valueOf(-1));//player can teleport from Nether to this dimension
return arraylist;
}
/**
* Is this block (a) opaque and ( a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* Checks to see if this location is valid to create a portal and will return True if it does. Args: world, x, y, z
*/
public boolean tryToCreatePortal(World par1World, int par2, int par3, int par4)
{
int i = 0;
int j = 0;
if (par1World.getBlockId(par2 - 1, par3, par4) == Block.stoneBrick.blockID || par1World.getBlockId(par2 + 1, par3, par4) == Block.stoneBrick.blockID )
{
i = 1;
}
if (par1World.getBlockId(par2, par3, par4 - 1) == Block.stoneBrick.blockID || par1World.getBlockId(par2, par3, par4 + 1) == Block.stoneBrick.blockID )
{
j = 1;
}
if (i == j)
{
return false;
}
if (par1World.getBlockId(par2 - i, par3, par4 - j) == 0)
{
par2 -= i;
par4 -= j;
}
for (int k = -1; k <= 2; k++)
{
for (int i1 = -1; i1 <= 3; i1++)
{
boolean flag = k == -1 || k == 2 || i1 == -1 || i1 == 3;
if ((k == -1 || k == 2) && (i1 == -1 || i1 == 3))
{
continue;
}
int k1 = par1World.getBlockId(par2 + i * k, par3 + i1, par4 + j * k);
if (flag)
{
if (k1 != Block.stoneBrick.blockID )
{
return false;
}
continue;
}
if (k1 != 0 && k1 != Block.fire.blockID)
{
return false;
}
}
}
par1World.editingBlocks = true;
for (int l = 0; l < 2; l++)
{
for (int j1 = 0; j1 < 3; j1++)
{
par1World.setBlockWithNotify(par2 + i * l, par3 + j1, par4 + j * l, mod_Deathlands.deathlandsPortal.blockID);
}
}
par1World.editingBlocks = false;
return true;
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
int i = 0;
int j = 1;
if (par1World.getBlockId(par2 - 1, par3, par4) == blockID || par1World.getBlockId(par2 + 1, par3, par4) == blockID)
{
i = 1;
j = 0;
}
int k;
for (k = par3; par1World.getBlockId(par2, k - 1, par4) == blockID; k--) { }
if (par1World.getBlockId(par2, k - 1, par4) != Block.stoneBrick.blockID )
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
return;
}
int l;
for (l = 1; l < 4 && par1World.getBlockId(par2, k + l, par4) == blockID; l++) { }
if (l != 3 || par1World.getBlockId(par2, k + l, par4) != Block.stoneBrick.blockID )
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
return;
}
boolean flag = par1World.getBlockId(par2 - 1, par3, par4) == blockID || par1World.getBlockId(par2 + 1, par3, par4) == blockID;
boolean flag1 = par1World.getBlockId(par2, par3, par4 - 1) == blockID || par1World.getBlockId(par2, par3, par4 + 1) == blockID;
if (flag && flag1)
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
return;
}
if ((par1World.getBlockId(par2 + i, par3, par4 + j) != Block.stoneBrick.blockID || par1World.getBlockId(par2 - i, par3, par4 - j) != blockID) && (par1World.getBlockId(par2 - i, par3, par4 - j) != Block.stoneBrick.blockID || par1World.getBlockId(par2 + i, par3, par4 + j) != blockID))
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
return;
}
else
{
return;
}
}
/**
* Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
* coordinates. Args: blockAccess, x, y, z, side
*/
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
if (par1IBlockAccess.getBlockId(par2, par3, par4) == blockID)
{
return false;
}
boolean flag = par1IBlockAccess.getBlockId(par2 - 1, par3, par4) == blockID && par1IBlockAccess.getBlockId(par2 - 2, par3, par4) != blockID;
boolean flag1 = par1IBlockAccess.getBlockId(par2 + 1, par3, par4) == blockID && par1IBlockAccess.getBlockId(par2 + 2, par3, par4) != blockID;
boolean flag2 = par1IBlockAccess.getBlockId(par2, par3, par4 - 1) == blockID && par1IBlockAccess.getBlockId(par2, par3, par4 - 2) != blockID;
boolean flag3 = par1IBlockAccess.getBlockId(par2, par3, par4 + 1) == blockID && par1IBlockAccess.getBlockId(par2, par3, par4 + 2) != blockID;
boolean flag4 = flag || flag1;
boolean flag5 = flag2 || flag3;
if (flag4 && par5 == 4)
{
return true;
}
if (flag4 && par5 == 5)
{
return true;
}
if (flag5 && par5 == 2)
{
return true;
}
return flag5 && par5 == 3;
}
public boolean displayPortalOverlay()
{
return true;
}
public int getOverlayTexture()
{
return blockIndexInTexture;
}
public int getPortalDelay()
{
return 85;//default
}
public String getEnteringMessage() {
return "Entering The Deathlands";
}
public String getLeavingMessage() {
return "Exiting The Deathlands";
}
}[/code]
2. I tried to do a complete black sky and fog but it didnt worked:
WorldProviderDeathlands:
[code]package net.minecraft.src;
import java.util.Random;
public class WorldProviderDeathlands extends WorldProviderBase
{
//The WorldProvider covers all the basics of the dimension. Look in WorldProviderBase.java and
//WorldProvider.java for all the potential qualities you can assign to your dimension.
public WorldProviderDeathlands()
{
}
protected void generateLightBrightnessTable()
{
float var1 = 0.1F;
for (int var2 = 0; var2 <= 15; ++var2)
{
float var3 = 1.0F - (float)var2 / 15.0F;
this.lightBrightnessTable[var2] = (1.0F - var3) / (var3 * 3.0F + 1.0F) * (1.0F - var1) + var1;
}
}
//The save file will be called DIM65 (DIM + id number).
public int getDimensionID()
{
return 65;
}
public float calculateCelestialAngle(long par1, float par3)
{
return 1.0F;
}
public int getSkyColorByTemp(float par1)
{
return 0x000000;
}
//You can use an existing WorldChunkManager, or create your own. You must create your own to
//add multiple unique biomes to a dimension.
public void registerWorldChunkManager()
{
worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.deathLands, 1.0F, 0.0F);
}
public Vec3 getFogColor(float par1, float par2)
{
return Vec3.getVec3Pool().getVecFromPool(0.0D, 0.0D, 0.0D);
}
//This is where you define your terrain generator.
public IChunkProvider getChunkProvider()
{
return new ChunkProviderDeathlands(worldObj, worldObj.getSeed());
}
//Note that, if you respawn in the dimension, you will end up at the coordinates of your
//overworld spawn point, not at the location of your first entrance to the dimension or
//something like that. Note also that beds don't work if you cannot respawn in the dimension.
public boolean canRespawnHere()
{
return false;
}
}[/code]
ChunkProviderDeathlands:
package net.minecraft.src;
import java.util.List;
import java.util.Random;
public class ChunkProviderDeathlands extends ChunkProviderGenerate
implements IChunkProvider
{
//This class inherits most of the terrain generation from ChunkProviderGenerate, since the terrain
//is basically just like the overworld's, except all desert. I have removed strongholds, villages,
//and mineshafts, however. Your terrain generator does not have to inherit ChunkProviderGenerate,
//but it must implement the IChunkProvider interface. I did not include modifications to the noise
//generator here; you'll have to tinker around with it yourself.
private Random rand;
private World worldObj;
private BiomeGenBase biomesForGeneration[];
public ChunkProviderDeathlands(World world, long l)
{
super(world, l, true);
worldObj = world;
rand = new Random(l);
}
//This is necessary to override the structure generator.
public Chunk provideChunk(int par1, int par2)
{
rand.setSeed((long)par1 * 0x4f9939f508L + (long)par2 * 0x1ef1565bd5L);
byte abyte0[] = new byte[32768];
generateTerrain(par1, par2, abyte0);
biomesForGeneration = worldObj.getWorldChunkManager().loadBlockGeneratorData(biomesForGeneration, par1 * 16, par2 * 16, 16, 16);
replaceBlocksForBiome(par1, par2, abyte0, biomesForGeneration);
Chunk chunk = new Chunk(worldObj, abyte0, par1, par2);
chunk.generateSkylightMap();
return chunk;
}
//This is where world generation, the more superficial aspects of the terrain such as flowers
//and ores, occurs. It is analogous to BaseMod's GenerateSurface method. Since 1.8, world
//generation has been covered mostly by BiomeDecorator.java, which is called toward the end
//of this method.
public void populate(IChunkProvider ichunkprovider, int i, int j)
{
BlockSand.fallInstantly = true;
int k = i * 16;
int l = j * 16;
BiomeGenBase biomegenbase = worldObj.getWorldChunkManager().getBiomeGenAt(k + 16, l + 16);
rand.setSeed(worldObj.getSeed());
long l1 = (rand.nextLong() / 2L) * 2L + 1L;
long l2 = (rand.nextLong() / 2L) * 2L + 1L;
rand.setSeed((long)i * l1 + (long)j * l2 ^ worldObj.getSeed());
boolean flag = false;
if (!flag && rand.nextInt(4) == 0)
{
int i1 = k + rand.nextInt(16) + 8;
int j2 = rand.nextInt(128);
int k3 = l + rand.nextInt(16) + 8;
(new WorldGenLakes(Block.waterStill.blockID)).generate(worldObj, rand, i1, j2, k3);
}
if (!flag && rand.nextInt(8) == 0)
{
int j1 = k + rand.nextInt(16) + 8;
int k2 = rand.nextInt(rand.nextInt(128 - 8) + 8);
int l3 = l + rand.nextInt(16) + 8;
if (k2 < 63 || rand.nextInt(10) == 0)
{
(new WorldGenLakes(Block.lavaStill.blockID)).generate(worldObj, rand, j1, k2, l3);
}
}
for (int k1 = 0; k1 < 8; k1++)
{
int i3 = k + rand.nextInt(16) + 8;
int i4 = rand.nextInt(128);
int k4 = l + rand.nextInt(16) + 8;
if (!(new WorldGenDungeons()).generate(worldObj, rand, i3, i4, k4));
}
//Here is where BiomeDecorator takes over the world generation. You can create your own
//version of it, or simply place all of your world generation right here instead.
biomegenbase.decorate(worldObj, rand, k, l);
SpawnerAnimals.performWorldGenSpawning(worldObj, biomegenbase, k + 8, l + 8, 16, 16, rand);
k += 8;
l += 8;
BlockSand.fallInstantly = false;
}
public int getSkyColorByTemp(float par1)
{
return 0x000000;
}
//This has to do with strongholds, which I removed, so it just returns null.
public ChunkPosition func_40376_a(World world, String s, int i, int j, int k)
{
return null;
}
}
[/CODE]
3.I dont want that there are normal blocks in my dimension like stone,ores,dirt...
[code]package net.minecraft.src;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public abstract class BiomeGenBase
{
/** An array of all the biomes, indexed by biome id. */
public static final BiomeGenBase[] biomeList = new BiomeGenBase[256];
public static final BiomeGenBase ocean = (new BiomeGenOcean(0)).setColor(112).setBiomeName("Ocean").setMinMaxHeight(-1.0F, 0.4F);
public static final BiomeGenBase plains = (new BiomeGenPlains(1)).setColor(9286496).setBiomeName("Plains").setTemperatureRainfall(0.8F, 0.4F);
public static final BiomeGenBase deathLands = (new BiomeGenDeathland(16)).setColor(0x000000).setBiomeName("Deathland").setTemperatureRainfall(0.8F, 0.4F);
public static final BiomeGenBase desert = (new BiomeGenDesert(2)).setColor(16421912).setBiomeName("Desert").setDisableRain().setTemperatureRainfall(2.0F, 0.0F).setMinMaxHeight(0.1F, 0.2F);
public static final BiomeGenBase extremeHills = (new BiomeGenHills(3)).setColor(6316128).setBiomeName("Extreme Hills").setMinMaxHeight(0.3F, 1.5F).setTemperatureRainfall(0.2F, 0.3F);
public static final BiomeGenBase forest = (new BiomeGenForest(4)).setColor(353825).setBiomeName("Forest").func_76733_a(5159473).setTemperatureRainfall(0.7F, 0.8F);
public static final BiomeGenBase taiga = (new BiomeGenTaiga(5)).setColor(747097).setBiomeName("Taiga").func_76733_a(5159473).setEnableSnow().setTemperatureRainfall(0.05F, 0.8F).setMinMaxHeight(0.1F, 0.4F);
public static final BiomeGenBase swampland = (new BiomeGenSwamp(6)).setColor(522674).setBiomeName("Swampland").func_76733_a(9154376).setMinMaxHeight(-0.2F, 0.1F).setTemperatureRainfall(0.8F, 0.9F);
public static final BiomeGenBase river = (new BiomeGenRiver(7)).setColor(255).setBiomeName("River").setMinMaxHeight(-0.5F, 0.0F);
public static final BiomeGenBase hell = (new BiomeGenHell(8)).setColor(16711680).setBiomeName("Hell").setDisableRain().setTemperatureRainfall(2.0F, 0.0F);
/** Is the biome used for sky world. */
public static final BiomeGenBase sky = (new BiomeGenEnd(9)).setColor(8421631).setBiomeName("Sky").setDisableRain();
public static final BiomeGenBase frozenOcean = (new BiomeGenOcean(10)).setColor(9474208).setBiomeName("FrozenOcean").setEnableSnow().setMinMaxHeight(-1.0F, 0.5F).setTemperatureRainfall(0.0F, 0.5F);
public static final BiomeGenBase frozenRiver = (new BiomeGenRiver(11)).setColor(10526975).setBiomeName("FrozenRiver").setEnableSnow().setMinMaxHeight(-0.5F, 0.0F).setTemperatureRainfall(0.0F, 0.5F);
public static final BiomeGenBase icePlains = (new BiomeGenSnow(12)).setColor(16777215).setBiomeName("Ice Plains").setEnableSnow().setTemperatureRainfall(0.0F, 0.5F);
public static final BiomeGenBase iceMountains = (new BiomeGenSnow(13)).setColor(10526880).setBiomeName("Ice Mountains").setEnableSnow().setMinMaxHeight(0.3F, 1.3F).setTemperatureRainfall(0.0F, 0.5F);
public static final BiomeGenBase mushroomIsland = (new BiomeGenMushroomIsland(14)).setColor(16711935).setBiomeName("MushroomIsland").setTemperatureRainfall(0.9F, 1.0F).setMinMaxHeight(0.2F, 1.0F);
public static final BiomeGenBase mushroomIslandShore = (new BiomeGenMushroomIsland(15)).setColor(10486015).setBiomeName("MushroomIslandShore").setTemperatureRainfall(0.9F, 1.0F).setMinMaxHeight(-1.0F, 0.1F);
/** Beach biome. */
public static final BiomeGenBase beach = (new BiomeGenBeach(16)).setColor(16440917).setBiomeName("Beach").setTemperatureRainfall(0.8F, 0.4F).setMinMaxHeight(0.0F, 0.1F);
/** Desert Hills biome. */
public static final BiomeGenBase desertHills = (new BiomeGenDesert(17)).setColor(13786898).setBiomeName("DesertHills").setDisableRain().setTemperatureRainfall(2.0F, 0.0F).setMinMaxHeight(0.3F, 0.8F);
/** Forest Hills biome. */
public static final BiomeGenBase forestHills = (new BiomeGenForest(18)).setColor(2250012).setBiomeName("ForestHills").func_76733_a(5159473).setTemperatureRainfall(0.7F, 0.8F).setMinMaxHeight(0.3F, 0.7F);
/** Taiga Hills biome. */
public static final BiomeGenBase taigaHills = (new BiomeGenTaiga(19)).setColor(1456435).setBiomeName("TaigaHills").setEnableSnow().func_76733_a(5159473).setTemperatureRainfall(0.05F, 0.8F).setMinMaxHeight(0.3F, 0.8F);
/** Extreme Hills Edge biome. */
public static final BiomeGenBase extremeHillsEdge = (new BiomeGenHills(20)).setColor(7501978).setBiomeName("Extreme Hills Edge").setMinMaxHeight(0.2F, 0.8F).setTemperatureRainfall(0.2F, 0.3F);
/** Jungle biome identifier */
public static final BiomeGenBase jungle = (new BiomeGenJungle(21)).setColor(5470985).setBiomeName("Jungle").func_76733_a(5470985).setTemperatureRainfall(1.2F, 0.9F).setMinMaxHeight(0.2F, 0.4F);
public static final BiomeGenBase jungleHills = (new BiomeGenJungle(22)).setColor(2900485).setBiomeName("JungleHills").func_76733_a(5470985).setTemperatureRainfall(1.2F, 0.9F).setMinMaxHeight(1.8F, 0.5F);
public String biomeName;
public int color;
/** The block expected to be on the top of this biome */
public byte topBlock;
/** The block to fill spots in when not on the top */
public byte fillerBlock;
public int field_76754_C;
/** The minimum height of this biome. Default 0.1. */
public float minHeight;
/** The maximum height of this biome. Default 0.3. */
public float maxHeight;
/** The temperature of this biome. */
public float temperature;
/** The rainfall in this biome. */
public float rainfall;
/** Color tint applied to water depending on biome */
public int waterColorMultiplier;
/** The biome decorator. */
public BiomeDecorator theBiomeDecorator;
/**
* Holds the classes of IMobs (hostile mobs) that can be spawned in the biome.
*/
protected List spawnableMonsterList;
/**
* Holds the classes of any creature that can be spawned in the biome as friendly creature.
*/
protected List spawnableCreatureList;
/**
* Holds the classes of any aquatic creature that can be spawned in the water of the biome.
*/
protected List spawnableWaterCreatureList;
/** Set to true if snow is enabled for this biome. */
private boolean enableSnow;
/**
* Is true (default) if the biome support rain (desert and nether can't have rain)
*/
private boolean enableRain;
/** The id number to this biome, and its index in the biomeList array. */
public final int biomeID;
protected WorldGenTrees worldGeneratorTrees;
/** The big tree generator. */
protected WorldGenBigTree worldGeneratorBigTree;
protected WorldGenForest worldGeneratorForest;
protected WorldGenSwamp worldGeneratorSwamp;
protected BiomeGenBase(int par1)
{
this.topBlock = (byte)Block.grass.blockID;
this.fillerBlock = (byte)Block.dirt.blockID;
this.field_76754_C = 5169201;
this.minHeight = 0.1F;
this.maxHeight = 0.3F;
this.temperature = 0.5F;
this.rainfall = 0.5F;
this.waterColorMultiplier = 16777215;
this.spawnableMonsterList = new ArrayList();
this.spawnableCreatureList = new ArrayList();
this.spawnableWaterCreatureList = new ArrayList();
this.enableRain = true;
this.worldGeneratorTrees = new WorldGenTrees(false);
this.worldGeneratorBigTree = new WorldGenBigTree(false);
this.worldGeneratorForest = new WorldGenForest(false);
this.worldGeneratorSwamp = new WorldGenSwamp();
this.biomeID = par1;
biomeList[par1] = this;
this.theBiomeDecorator = this.createBiomeDecorator();
this.spawnableCreatureList.add(new SpawnListEntry(EntitySheep.class, 12, 4, 4));
this.spawnableCreatureList.add(new SpawnListEntry(EntityPig.class, 10, 4, 4));
this.spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 10, 4, 4));
this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 8, 4, 4));
this.spawnableMonsterList.add(new SpawnListEntry(EntitySpider.class, 10, 4, 4));
this.spawnableMonsterList.add(new SpawnListEntry(EntityZombie.class, 10, 4, 4));
this.spawnableMonsterList.add(new SpawnListEntry(EntitySkeleton.class, 10, 4, 4));
this.spawnableMonsterList.add(new SpawnListEntry(EntityCreeper.class, 10, 4, 4));
this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10, 4, 4));
this.spawnableMonsterList.add(new SpawnListEntry(EntityEnderman.class, 1, 1, 4));
this.spawnableWaterCreatureList.add(new SpawnListEntry(EntitySquid.class, 10, 4, 4));
}
/**
* Allocate a new BiomeDecorator for this BiomeGenBase
*/
protected BiomeDecorator createBiomeDecorator()
{
return new BiomeDecorator(this);
}
/**
* Sets the temperature and rainfall of this biome.
*/
private BiomeGenBase setTemperatureRainfall(float par1, float par2)
{
if (par1 > 0.1F && par1 < 0.2F)
{
throw new IllegalArgumentException("Please avoid temperatures in the range 0.1 - 0.2 because of snow");
}
else
{
this.temperature = par1;
this.rainfall = par2;
return this;
}
}
/**
* Sets the minimum and maximum height of this biome. Seems to go from -2.0 to 2.0.
*/
private BiomeGenBase setMinMaxHeight(float par1, float par2)
{
this.minHeight = par1;
this.maxHeight = par2;
return this;
}
/**
* Disable the rain for the biome.
*/
private BiomeGenBase setDisableRain()
{
this.enableRain = false;
return this;
}
/**
* Gets a WorldGen appropriate for this biome.
*/
public WorldGenerator getRandomWorldGenForTrees(Random par1Random)
{
return (WorldGenerator)(par1Random.nextInt(10) == 0 ? this.worldGeneratorBigTree : this.worldGeneratorTrees);
}
/**
* Gets a WorldGen appropriate for this biome.
*/
public WorldGenerator getRandomWorldGenForGrass(Random par1Random)
{
return new WorldGenTallGrass(Block.tallGrass.blockID, 1);
}
/**
* sets enableSnow to true during biome initialization. returns BiomeGenBase.
*/
protected BiomeGenBase setEnableSnow()
{
this.enableSnow = true;
return this;
}
protected BiomeGenBase setBiomeName(String par1Str)
{
this.biomeName = par1Str;
return this;
}
protected BiomeGenBase func_76733_a(int par1)
{
this.field_76754_C = par1;
return this;
}
protected BiomeGenBase setColor(int par1)
{
this.color = par1;
return this;
}
/**
* takes temperature, returns color
*/
public int getSkyColorByTemp(float par1)
{
par1 /= 3.0F;
if (par1 < -1.0F)
{
par1 = -1.0F;
}
if (par1 > 1.0F)
{
par1 = 1.0F;
}
return Color.getHSBColor(0.62222224F - par1 * 0.05F, 0.5F + par1 * 0.1F, 1.0F).getRGB();
}
/**
* Returns the correspondent list of the EnumCreatureType informed.
*/
public List getSpawnableList(EnumCreatureType par1EnumCreatureType)
{
return par1EnumCreatureType == EnumCreatureType.monster ? this.spawnableMonsterList : (par1EnumCreatureType == EnumCreatureType.creature ? this.spawnableCreatureList : (par1EnumCreatureType == EnumCreatureType.waterCreature ? this.spawnableWaterCreatureList : null));
}
/**
* Returns true if the biome have snowfall instead a normal rain.
*/
public boolean getEnableSnow()
{
return this.enableSnow;
}
/**
* Return true if the biome supports lightning bolt spawn, either by have the bolts enabled and have rain enabled.
*/
public boolean canSpawnLightningBolt()
{
return this.enableSnow ? false : this.enableRain;
}
/**
* Checks to see if the rainfall level of the biome is extremely high
*/
public boolean isHighHumidity()
{
return this.rainfall > 0.85F;
}
/**
* returns the chance a creature has to spawn.
*/
public float getSpawningChance()
{
return 0.1F;
}
/**
* Gets an integer representation of this biome's rainfall
*/
public final int getIntRainfall()
{
return (int)(this.rainfall * 65536.0F);
}
/**
* Gets an integer representation of this biome's temperature
*/
public final int getIntTemperature()
{
return (int)(this.temperature * 65536.0F);
}
/**
* Gets a floating point representation of this biome's rainfall
*/
public final float getFloatRainfall()
{
return this.rainfall;
}
/**
* Gets a floating point representation of this biome's temperature
*/
public final float getFloatTemperature()
{
return this.temperature;
}
public void decorate(World par1World, Random par2Random, int par3, int par4)
{
this.theBiomeDecorator.decorate(par1World, par2Random, par3, par4);
}
/**
* Provides the basic grass color based on the biome temperature and rainfall
*/
public int getBiomeGrassColor()
{
double var1 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F);
double var3 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F);
return ColorizerGrass.getGrassColor(var1, var3);
}
public float calculateCelestialAngle(long par1, float par3)
{
return 0.0F;
}
/**
* Provides the basic foliage color based on the biome temperature and rainfall
*/
public int getBiomeFoliageColor()
{
double var1 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F);
double var3 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F);
return ColorizerFoliage.getFoliageColor(var1, var3);
}
}[/code]
PLs help me asap!
He's not helping codes that doesn't use his tutorials. Post in Mod Development.
HEY GUYS! IF YOU STILL CANT WAIT FOR MOBS TO UPDATE, YOU CAN DO THIS.
Follow TechGuy's tutorial on mobs. Then, you have to find this line in your mod_ file.
[code]ModLoader.registerEntityID(EntityMyMob.class, "My Custom Mob", ModLoader.getUniqueEntityId());[/code]
And erase ModLoader.getUniqueEntityId() with any number, below 127, and must not share the same ID with existing mobs. To know what the ids of mobs are, go to EntityList.
So, it would be something like this.
[code]ModLoader.registerEntityID(PJModEntityRedHarpy.class, "Red Harpy", 72);[/code]
This is the 1st Modloader tutorial I've seen that hasn't made me feel dumber than when I started reading it. In fact, I actually feel smarter. Working on converting my working mcp mods to modloader/mcp mods. Thank you so much!
Adding blocks to creative is very easy in 1.3.1!
if you for example have your BlockExample.java;
package net.minecraft.src;
import java.util.Random;
public class BlockNamehere extends Block
{
public BlockNamehere(int i, int j)
{
super(i, j, Material.wood);
}
public int idDropped(int i, Random random, int j)
{
return mod_Block.nameHere.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
Then you add this to it;
this.setCreativeTab(CreativeTabs.tabBlock);
So that it looks like this;
package net.minecraft.src;
import java.util.Random;
public class BlockNamehere extends Block
{
public BlockNamehere(int i, int j)
{
super(i, j, Material.wood);
this.setCreativeTab(CreativeTabs.tabBlock);
}
public int idDropped(int i, Random random, int j)
{
return mod_Block.nameHere.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}
}
What the hell did techguy tell us all? If you don't remember I will burn like an ant under a magnifying glass.
As I suspected, I ran minecraft with my mod and it crashed.
The error:
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem; Exception occured in ModLoader
This error has been saved to /Users/raywendt/Library/Application Support/minecraft/crash-reports/crash-2012-08-11_14.18.51-client.txt for your convenience. Please include a copy of this file if you report this crash to anyone.
--- BEGIN ERROR REPORT 7a02804c --------
Generated 8/11/12 2:18 PM
- Minecraft Version: 1.3.1
- Operating System: Mac OS X (i386) version 10.7.4
- Java Version: 1.6.0_33, Apple Inc.
- Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Apple Inc.
- Memory: 501802632 bytes (478 MB) / 535232512 bytes (510 MB) up to 1070399488 bytes (1020 MB)
- JVM Flags: 3 total; -Xbootclasspath/a:/System/Library/PrivateFrameworks/JavaApplicationLauncher.framework/Resources/LauncherSupport.jar -Xms512M -Xmx1024M
- ModLoader: Mods loaded: 1
ModLoader 1.3.1
java.lang.ClassFormatError: Incompatible magic value 1885430635 in class file mod_Geology
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at ModLoader.addMod(ModLoader.java:319)
at ModLoader.readFromClassPath(ModLoader.java:1317)
at ModLoader.init(ModLoader.java:915)
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(Thread.java:680)
--- END ERROR REPORT 53c58ad6 ----------
The files:
BlockGranite
package net.minecraft.src;
import java.util.Random;
public class BlockGranite extends Block
{
public BlockGranite(int i, int j)
{
super(i,j,Material.wood);
}
public int idDropped(int i, Random random, int j)
{
return mod_Block.granite.blockID
}
public int quantityDropped(Random random)
{
return 1;
}
}
mod_Geology
package net.minecraft.src;
public class mod_Geology extends BaseMod
{
public static final Block granite = new BlockGranite(160,0).setBlockName("granite").setHardness(3F).setResistance(4F);
public void load()
{
granite.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/geology/granite.png");
ModLoader.registerBlock(granite);
ModLoader.addName(granite, "Granite");
ModLoader.addRecipe(new ItemStack(granite, 1), new Object [] {"#",Character.valueOf('#'),Block.dirt});
}
public String getVersion()
{
return "0.1";
}
}
Help! I need help with coding for the crop. I'm Getting the error as mod_DrugcraftBeta cannot be resolved to a variable in my Crop file. In my mod_ file the error im getting is: The method setBlockName(String) is undefined for the type TobbacoLeaf
my mod_ file (all the places that have errors are highlighted in red)
package net.minecraft.src;
public class mod_DrugcraftBeta extends BaseMod{
//Declarations
public static final Item Shrooms = new Shrooms(5001, 4, false).setItemName("Shrooms");
public static final Item Cocaine = new Cocaine(5002, 4, false).setItemName("Cocaine");
public static final Item Steriods = new Steriods(5003, 4, false).setItemName("Steriods");
public void load(){
//Recipes or Crafting
ModLoader.addRecipe(new ItemStack(Shrooms, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
ModLoader.addRecipe(new ItemStack(Cocaine, 1), new Object [] {"@@@", "#%#", "%*&", Character.valueOf('@'), Block.mushroomRed, Character.valueOf('#'),
//Entity(s)
//Achievements
//Crops
//Just a standard block.
public static final Block TobbacoLeaf = new TobbacoLeaf (165, 0).setBlockName("cropNameHere");
//This is a fairly standard item but it has two new arguments. The first is the block it plants, in this case is our new crop "cropNameHere".The second is the block that is required to be right clicked on to plant the seeds.
//We are using tilled field/dirt for this crop but you can change it to whatever you like. Remember to change it in the block class as well.
public static final Item TobbacoLeafSeeds = new TobbacoLeafSeeds(2500, TobbacoLeafSeeds.blockID, Block.tilledField.blockID).setItemName("Tobacco Seeds");
//These static ints are the textures of the crop in its various stages of growth.
public static int cropStageOne = ModLoader.addOverride("/terrain.png", "/stageOne.png");
public static int cropStageTwo = ModLoader.addOverride("/terrain.png", "/stageTwo.png");
public static int cropStageThree = ModLoader.addOverride("/terrain.png", "/stageThree.png");
public static int cropStageFour = ModLoader.addOverride("/terrain.png", "/stageFour.png");
public static int cropStageFive = ModLoader.addOverride("/terrain.png", "/stageFive.png");
public static int cropStageSix = ModLoader.addOverride("/terrain.png", "/stageSix.png");
public static int cropStageSeven = ModLoader.addOverride("/terrain.png", "/stageSeven.png");
public static int cropStageEight = ModLoader.addOverride("/terrain.png", "/stageEight.png");
}public String getVersion(){
return "1.3.1";}}
That was my mod_ file. now my Crop File. as the same, errors will be highlighted in red and the error im getting is : mod_DrugcraftBeta cannot be resolved to a variable
here the crop file:
package net.minecraft.src;
import java.util.Random;
public class TobbacoLeaf extends BlockFlower
{public TobbacoLeaf(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_DrugcraftBeta.TobbacoLeaf));
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_DrugcraftBeta.cropStageOne;
}if(j == 2){return mod_DrugcraftBeta.cropStageTwo;
}if(j == 3){return mod_DrugcraftBeta.cropStageThree;
}if(j == 4){return mod_DrugcraftBeta.cropStageFour;
}if(j == 5){return mod_DrugcraftBeta.cropStageFive;
}if(j == 6){return mod_DrugcraftBeta.cropStageSix;
}if(j == 7){return mod_DrugcraftBeta.cropStageSeven;
}if(j == 8){return mod_DrugcraftBeta.cropStageEight;}return j;}}
Help! I need help with coding for the crop. I'm Getting the error as mod_DrugcraftBeta cannot be resolved to a variable in my Crop file. In my mod_ file the error im getting is: The method setBlockName(String) is undefined for the type TobbacoLeaf
my mod_ file (all the places that have errors are highlighted in red)
package net.minecraft.src;
public class mod_DrugcraftBeta extends BaseMod{
//Declarations
public static final Item Shrooms = new Shrooms(5001, 4, false).setItemName("Shrooms");
public static final Item Cocaine = new Cocaine(5002, 4, false).setItemName("Cocaine");
public static final Item Steriods = new Steriods(5003, 4, false).setItemName("Steriods");
public void load(){
//Recipes or Crafting
ModLoader.addRecipe(new ItemStack(Shrooms, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
ModLoader.addRecipe(new ItemStack(Cocaine, 1), new Object [] {"@@@", "#%#", "%*&", Character.valueOf('@'), Block.mushroomRed, Character.valueOf('#'),
//Entity(s)
//Achievements
//Crops
//Just a standard block.
public static final Block TobbacoLeaf = new TobbacoLeaf (165, 0).setBlockName("cropNameHere");
//This is a fairly standard item but it has two new arguments. The first is the block it plants, in this case is our new crop "cropNameHere".The second is the block that is required to be right clicked on to plant the seeds.
//We are using tilled field/dirt for this crop but you can change it to whatever you like. Remember to change it in the block class as well.
public static final Item TobbacoLeafSeeds = new TobbacoLeafSeeds(2500, TobbacoLeafSeeds.blockID, Block.tilledField.blockID).setItemName("Tobacco Seeds");
//These static ints are the textures of the crop in its various stages of growth.
public static int cropStageOne = ModLoader.addOverride("/terrain.png", "/stageOne.png");
public static int cropStageTwo = ModLoader.addOverride("/terrain.png", "/stageTwo.png");
public static int cropStageThree = ModLoader.addOverride("/terrain.png", "/stageThree.png");
public static int cropStageFour = ModLoader.addOverride("/terrain.png", "/stageFour.png");
public static int cropStageFive = ModLoader.addOverride("/terrain.png", "/stageFive.png");
public static int cropStageSix = ModLoader.addOverride("/terrain.png", "/stageSix.png");
public static int cropStageSeven = ModLoader.addOverride("/terrain.png", "/stageSeven.png");
public static int cropStageEight = ModLoader.addOverride("/terrain.png", "/stageEight.png");
}public String getVersion(){
return "1.3.1";}}
That was my mod_ file. now my Crop File. as the same, errors will be highlighted in red and the error im getting is : mod_DrugcraftBeta cannot be resolved to a variable
here the crop file:
package net.minecraft.src;
import java.util.Random;
public class TobbacoLeaf extends BlockFlower
{public TobbacoLeaf(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_DrugcraftBeta.TobbacoLeaf));
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_DrugcraftBeta.cropStageOne;
}if(j == 2){return mod_DrugcraftBeta.cropStageTwo;
}if(j == 3){return mod_DrugcraftBeta.cropStageThree;
}if(j == 4){return mod_DrugcraftBeta.cropStageFour;
}if(j == 5){return mod_DrugcraftBeta.cropStageFive;
}if(j == 6){return mod_DrugcraftBeta.cropStageSix;
}if(j == 7){return mod_DrugcraftBeta.cropStageSeven;
}if(j == 8){return mod_DrugcraftBeta.cropStageEight;}return j;}}
Thanks and Please Reply!
Change
public static final Block TobbacoLeaf = new TobbacoLeaf (165, 0).setBlockName("cropNameHere");
to
public static final Block TobbacoLeaf = new TobbacoLeaf (165, 0).setBlockName("TobbacoLeaf").setRequiresSelfNotify();
Also I don't see where you registered your crop so add this (unless you have it and I didn't notice)
I get this same exact problem. I used some of the game's main code to make it work better, but mostly yours. That didn't make a difference tho, all I get is the block that doesn't grow, weird thing is, bonemeal does make it grow into the grown plant like it should. It won't grow naturally tho :/
ModLoader isn't fully updated, therefore mobs don't work yet.
I tried what code you gave me, Tech_warrior, but it's still not showing up in game. I put the dirt int eh crafting table and nothing happens.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffDon't name your mod item the same as the mod class.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumJust quoting myself...originally this was on page 196...but it got covered up and ignored.
Does not work the same error
I'm familiar to java and minecraft modding and this is confusing.
mod_Kill
package net.minecraft.src; import java.util.Random; public class mod_Kill extends BaseMod { public static final Block blueFlower= new BlueFlower(165, 0).setBlockName("blue flower"); public void load() { ModLoader.registerBlock(blueFlower); blueFlower.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Textures/BlueFlower.png"); ModLoader.addName(blueFlower, "Bluebell"); } public void generateSurface(World world, Random random, int i, int j) { for(int k = 0; k < 7; k++) { int randPosX = i + random.nextInt(16); int randPosY = random.nextInt(128); int randPosZ = j + random.nextInt(16); (new WorldGenFlowers(blueFlower.blockID)).generate(world, random, randPosX, randPosY, randPosZ); } } public String getVersion() { return "1.3.1"; } }BlueFlower
package net.minecraft.src; import java.util.Random; public class BlueFlower extends Block { protected BlueFlower(int i, int j) { super(i, Material.plants); blockIndexInTexture = j; setTickRandomly(true); float f = 0.2F; setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3F, 0.5F + f); } public boolean canPlaceBlockAt(World world, int i, int j, int k) { return super.canPlaceBlockAt(world, i, j, k) && canThisPlantGrowOnThisBlockID(world.getBlockId(i, j - 1, k)); } protected boolean canThisPlantGrowOnThisBlockID(int i) { return i == Block.grass.blockID || i == Block.dirt.blockID; } public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k) { return null; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return 1; } }Please help I created so many items and after this I getting error when launch MC
Console
== MCP 7.0 (data: 7.0a, client: 1.3.1, server: 1.3.1) ==
[01:47:38] 27 achievements
[01:47:38] 195 recipes
[01:47:38] Setting user: Player971, -
[01:47:38] Client asked for parameter: server
[01:47:38] LWJGL Version: 2.4.2
[01:47:39] ModLoader 1.3.1 Initializing...
[01:47:39] Mod Initialized: mod_litto 1.3.1
[01:47:39] Overriding /terrain.png with /textures/luriumore.png @ 26. 31 left.
[01:47:39] Overriding /terrain.png with /textures/luriumblock.png @ 27. 30 left.
[01:47:39] Overriding /gui/items.png with /textures/lurium.png @ 38. 80 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumhotiron.png @ 102. 79
left.
[01:47:39] Overriding /gui/items.png with /textures/luriumpickaxe.png @ 118. 78
left.
[01:47:39] Overriding /gui/items.png with /textures/luriumaxe.png @ 119. 77 left
.
[01:47:39] Overriding /gui/items.png with /textures/luriumshovel.png @ 120. 76 l
eft.
[01:47:39] Overriding /gui/items.png with /textures/luriumsword.png @ 134. 75 le
ft.
[01:47:39] Overriding /gui/items.png with /textures/luriumhoe.png @ 144. 74 left
.
[01:47:39] Overriding /gui/items.png with /textures/luriumhelmet.png @ 145. 73 l
eft.
[01:47:39] Overriding /gui/items.png with /textures/luriumchestplate.png @ 146.
72 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumleggins.png @ 147. 71
left.
[01:47:39] Overriding /gui/items.png with /textures/luriumboots.png @ 148. 70 le
ft.
[01:47:39] Overriding /gui/items.png with /textures/luriumiron.png @ 149. 69 lef
t.
[01:47:39] Overriding /gui/items.png with /textures/luriumaxebillet.png @ 150. 6
8 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumpickaxebillet.png @ 15
2. 67 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumhoebillet.png @ 160. 6
6 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumshovelbillet.png @ 161
. 65 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumswordbilletpartone.png
@ 162. 64 left.
[01:47:39] Overriding /gui/items.png with /textures/luriumswordbilletpartotwo.pn
g @ 163. 63 left.
[01:47:39] Overriding /gui/items.png with /textures/hiltofluriumsword.png @ 164.
62 left.
[01:47:49] Exception in thread "Minecraft main thread" java.lang.ExceptionInInit
ializerError
[01:47:49] at net.minecraft.client.Minecraft.startGame(Minecraft.java:404)
[01:47:49] at net.minecraft.client.Minecraft.run(Minecraft.java:724)
[01:47:49] at java.lang.Thread.run(Thread.java:722)
[01:47:49] Caused by: java.lang.RuntimeException: java.lang.StringIndexOutOfBoun
dsException: String index out of range: 10
[01:47:49] at net.minecraft.src.ModLoader.init(ModLoader.java:963)
[01:47:49] at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:16
1)
[01:47:49] at net.minecraft.src.RenderManager.<init>(RenderManager.java:86)
[01:47:49] at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:1
4)
[01:47:49] ... 3 more
[01:47:49] Caused by: java.lang.StringIndexOutOfBoundsException: String index ou
t of range: 10
[01:47:49] at java.lang.String.charAt(String.java:695)
[01:47:49] at net.minecraft.src.CraftingManager.addRecipe(CraftingManager.j
ava:185)
[01:47:49] at net.minecraft.src.ModLoader.addRecipe(ModLoader.java:482)
[01:47:49] at net.minecraft.src.mod_litto.load(mod_litto.java:112)
[01:47:49] at net.minecraft.src.ModLoader.init(ModLoader.java:927)
[01:47:49] ... 6 more
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem; ModLoader has failed to initialize.
This error has been saved to C:\Users\Litto\Desktop\Minecraft Coder Pack\jars\.\crash-reports\crash-2012-08-11_01.47.49-client.txt for your convenience. Please include a copy of this file if you report this crash to anyone.
--- BEGIN ERROR REPORT f49d38a --------
Generated 11.08.12 1:47
- Minecraft Version: 1.3.1
- Operating System: Windows 7 (amd64) version 6.1
- Java Version: 1.7.0_05, Oracle Corporation
- Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
- Memory: 997854656 bytes (951 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
- JVM Flags: 3 total; -Xincgc -Xms1024M -Xmx1024M
- ModLoader: Mods loaded: 2
ModLoader 1.3.1
mod_litto 1.3.1
java.lang.StringIndexOutOfBoundsException: String index out of range: 10
at java.lang.String.charAt(String.java:695)
at net.minecraft.src.CraftingManager.addRecipe(CraftingManager.java:185)
at net.minecraft.src.ModLoader.addRecipe(ModLoader.java:482)
at net.minecraft.src.mod_litto.load(mod_litto.java:112)
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)
--- END ERROR REPORT dee0d599 ----------
package net.minecraft.src; import java.util.Random; public class mod_litto extends BaseMod { public static final Block LuriumOre = new BlockLuriumOre(160, 0).setBlockName("LuriumOre").setHardness(3.0F).setResistance(5F).setLightValue(0F).setCreativeTab(CreativeTabs.tabBlock); public static final Block LuriumBlock = new BlockLuriumBlock(161, 0).setBlockName("LuriumBlock").setHardness(3F).setResistance(4F).setLightValue(0F).setCreativeTab(CreativeTabs.tabBlock); public static final Item Lurium = new ItemLurium(5000).setItemName("Lurium").setTabToDisplayOn(CreativeTabs.tabMaterials); public static final Item LuriumIron = new ItemLuriumIron(5001).setItemName("LuriumIron").setTabToDisplayOn(CreativeTabs.tabMaterials).setTabToDisplayOn(CreativeTabs.tabMaterials); public static final Item Pickaxe = new ItemLuriumPickaxe(5002, EnumToolMaterialLurium.MATERIALLurium).setItemName("Pickaxe").setTabToDisplayOn(CreativeTabs.tabTools); public static final Item Axe = new ItemLuriumAxe(5003, EnumToolMaterialLurium.MATERIALLurium).setItemName("Axe").setTabToDisplayOn(CreativeTabs.tabTools); public static final Item Shovel = new ItemLuriumShovel(5004, EnumToolMaterialLurium.MATERIALLurium).setItemName("Shovel").setTabToDisplayOn(CreativeTabs.tabTools); public static final Item Sword = new ItemLuriumSword(5005, EnumToolMaterialLurium.MATERIALLurium).setItemName("Sword").setTabToDisplayOn(CreativeTabs.tabTools); public static final Item Hoe = new ItemLuriumHoe(5006, EnumToolMaterialLurium.MATERIALLurium).setItemName("Hoe").setTabToDisplayOn(CreativeTabs.tabTools); public static Item LuriumHelmet=(new ItemArmor(5007, EnumArmorMaterial.Lurium, 5, 0)).setItemName("LuriumHelmet").setTabToDisplayOn(CreativeTabs.tabCombat); public static Item LuriumChestplate=(new ItemArmor(5008, EnumArmorMaterial.Lurium, 5, 1)).setItemName("LuriumChestplate").setTabToDisplayOn(CreativeTabs.tabCombat); public static Item LuriumLeggins=(new ItemArmor(5009, EnumArmorMaterial.Lurium, 5, 2)).setItemName("LuriumLeggins").setTabToDisplayOn(CreativeTabs.tabCombat); public static Item LuriumBoots=(new ItemArmor(5010, EnumArmorMaterial.Lurium, 5, 3)).setItemName("LuriumBoots").setTabToDisplayOn(CreativeTabs.tabCombat); public static final Item LuriumHotIron = new ItemLuriumHotIron(5011).setItemName("LuriumHotIron").setTabToDisplayOn(CreativeTabs.tabMaterials); public static final Item LuriumAxeBillet = new ItemLuriumAxeBillet(5012).setItemName("LuriumAxeBillet").setTabToDisplayOn(CreativeTabs.tabMaterials); public static final Item LuriumPickaxeBillet = new ItemLuriumPickaxeBillet(5013).setItemName("LuriumPickAxe").setTabToDisplayOn(CreativeTabs.tabMaterials); public static final Item LuriumHoeBillet = new ItemLuriumHoeBillet(5014).setItemName("LuriumHoeBillet").setTabToDisplayOn(CreativeTabs.tabMaterials); public static final Item LuriumShovelBillet = new ItemLuriumShovelBillet(5015).setItemName("LuriumShovelBillet").setTabToDisplayOn(CreativeTabs.tabMaterials); public static final Item LuriumSwordBilletPartOne = new ItemLuriumSwordBilletPartOne(5016).setItemName("LuriumSwordBilletPartOne").setTabToDisplayOn(CreativeTabs.tabMaterials); public static final Item LuriumSwordBilletPartTwo = new ItemLuriumSwordBilletPartTwo(5017).setItemName("SwordBilletPartTwo").setTabToDisplayOn(CreativeTabs.tabMaterials); public static final Item HiltOfLuriumSword = new ItemHiltOfLuriumSword(5018).setItemName("HiltOfLuriumSword").setTabToDisplayOn(CreativeTabs.tabMaterials); public void load() { LuriumOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/textures/luriumore.png"); ModLoader.registerBlock(LuriumOre); ModLoader.addName(LuriumOre, "Lurium Ore"); LuriumBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/textures/luriumblock.png"); ModLoader.registerBlock(LuriumBlock); ModLoader.addName(LuriumBlock, "LuriumBlock"); ModLoader.addRecipe(new ItemStack(LuriumBlock, 1), new Object [] {"###", "###", "###", Character.valueOf('#'), mod_litto.Lurium}); Lurium.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/lurium.png"); ModLoader.addName(Lurium, "Lurium"); ModLoader.addRecipe(new ItemStack(Lurium, 9), new Object [] {"#", Character.valueOf('#'), mod_litto.LuriumBlock}); LuriumHotIron.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumhotiron.png"); ModLoader.addName(LuriumHotIron, "Lurium Hot Iron"); ModLoader.addSmelting(mod_litto.LuriumIron.shiftedIndex, new ItemStack(mod_litto.LuriumHotIron, 1), 1.0F); Pickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumpickaxe.png"); ModLoader.addName(Pickaxe, "Lurium Pickaxe"); ModLoader.addRecipe(new ItemStack(Pickaxe, 1), new Object [] {" # ", " % ", " % ", '#', mod_litto.LuriumPickaxeBillet, '%', Item.stick}); Axe.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumaxe.png"); ModLoader.addName(Axe, "Lurium Axe"); ModLoader.addRecipe(new ItemStack(Axe, 1), new Object [] {"# ", " % ", " % ", '#', mod_litto.LuriumAxeBillet, '%', Item.stick}); Shovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumshovel.png"); ModLoader.addName(Shovel, "Lurium Shovel"); ModLoader.addRecipe(new ItemStack(Shovel, 1), new Object [] {"#", "%", "%", '#', mod_litto.LuriumShovelBillet, '%', Item.stick}); Sword.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumsword.png"); ModLoader.addName(Sword, "Lurium Sword"); ModLoader.addRecipe(new ItemStack(Sword, 1), new Object [] {" #", " X ", "% ", '#', mod_litto.LuriumSwordBilletPartOne, '%', mod_litto.HiltOfLuriumSword, 'X', mod_litto.LuriumSwordBilletPartTwo}); Hoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumhoe.png"); ModLoader.addName(Hoe, "Lurium Hoe"); ModLoader.addRecipe(new ItemStack(Hoe, 1), new Object [] {" # ", " % ", " % ", '#', mod_litto.LuriumHoeBillet, '%', Item.stick}); LuriumHelmet.iconIndex=ModLoader.addOverride("/gui/items.png", "/textures/luriumhelmet.png"); ModLoader.addName(LuriumHelmet, "Lurium Helmet"); ModLoader.addRecipe(new ItemStack(LuriumHelmet, 1), new Object[]{ "XXX", "X X", Character.valueOf('X'), mod_litto.LuriumHotIron}); LuriumChestplate.iconIndex=ModLoader.addOverride("/gui/items.png", "/textures/luriumchestplate.png"); ModLoader.addName(LuriumChestplate, "Lurium Chestplate"); ModLoader.addRecipe(new ItemStack(LuriumChestplate, 1), new Object[]{ "X X", "XXX","XXX", Character.valueOf('X'), mod_litto.LuriumHotIron}); LuriumLeggins.iconIndex=ModLoader.addOverride("/gui/items.png", "/textures/luriumleggins.png"); ModLoader.addName(LuriumLeggins, "Lurium Leggins"); ModLoader.addRecipe(new ItemStack(LuriumLeggins, 1), new Object[]{ "XXX", "X X","X X", Character.valueOf('X'), mod_litto.LuriumHotIron}); LuriumBoots.iconIndex=ModLoader.addOverride("/gui/items.png", "/textures/luriumboots.png"); ModLoader.addName(LuriumBoots, "Lurium Boots"); ModLoader.addRecipe(new ItemStack(LuriumBoots, 1), new Object[]{ "X X", "X X", Character.valueOf('X'), mod_litto.LuriumHotIron}); LuriumIron.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumiron.png"); ModLoader.addName(LuriumIron, "Lurium Iron"); ModLoader.addRecipe(new ItemStack(LuriumIron, 1), new Object [] {"#X#","X#X", "#X#", Character.valueOf('#'), mod_litto.Lurium, Character.valueOf('X'), Item.ingotIron}); LuriumAxeBillet.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumaxebillet.png"); ModLoader.addName(LuriumAxeBillet, "Lurium Axe Billet"); ModLoader.addRecipe(new ItemStack(LuriumAxeBillet, 1), new Object [] {"## ","# ", Character.valueOf('#'), mod_litto.LuriumHotIron}); LuriumPickaxeBillet.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumpickaxebillet.png"); ModLoader.addName(LuriumPickaxeBillet, "Lurium Pickaxe Billet"); ModLoader.addRecipe(new ItemStack(LuriumPickaxeBillet, 1), new Object [] {"###", Character.valueOf('#'), mod_litto.LuriumHotIron}); LuriumHoeBillet.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumhoebillet.png"); ModLoader.addName(LuriumHoeBillet, "Lurium Hoe Billet"); ModLoader.addRecipe(new ItemStack(LuriumHoeBillet, 1), new Object [] {"#", Character.valueOf('#'), mod_litto.LuriumHotIron}); LuriumShovelBillet.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumshovelbillet.png"); ModLoader.addName(LuriumShovelBillet, "Lurium Shovel Billet"); ModLoader.addRecipe(new ItemStack(LuriumShovelBillet, 1), new Object [] {" # ", " ", " ", Character.valueOf('#'), mod_litto.LuriumHotIron}); LuriumSwordBilletPartOne.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumswordbilletpartone.png"); ModLoader.addName(LuriumSwordBilletPartOne, "Lurium Sword Billet Part One"); ModLoader.addRecipe(new ItemStack(LuriumSwordBilletPartOne, 1), new Object [] {" #"," "," ", Character.valueOf('#'), mod_litto.LuriumIron}); LuriumSwordBilletPartTwo.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/luriumswordbilletpartotwo.png"); ModLoader.addName(LuriumSwordBilletPartTwo, "Lurium Sword Billet Part Two"); ModLoader.addRecipe(new ItemStack(LuriumSwordBilletPartTwo, 1), new Object [] {" "," # "," ", Character.valueOf('#'), mod_litto.LuriumIron}); HiltOfLuriumSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/textures/hiltofluriumsword.png"); ModLoader.addName(HiltOfLuriumSword, "Hilt Of Lurium Sword"); ModLoader.addRecipe(new ItemStack(HiltOfLuriumSword, 1), new Object [] {" "," # ","# ", Character.valueOf('#'), Item.stick}); } public void generateSurface(World world, Random random, int chunkX, int chunkZ) { for(int i = 0; i < 170; i++) { int randPosX = chunkX + random.nextInt(16); int randPosY = random.nextInt(128); int randPosZ = chunkZ + random.nextInt(16); (new WorldGenMinable(LuriumOre.blockID, 6)).generate(world, random, randPosX, randPosY, randPosZ); } } public String getVersion() { return "1.3.1"; } }Wait, do you mean I have to rename a file or replace all of the respectful names with soemthing else?
If you can give me an example, preferably telling me what I need to rename it, please use Core_Block. It's the original name I had for the block itself, as should be seen in game, but now I'm not even sure what to call it, or do.
though my one question is, how do I get the soldiers to be "binded" together and share all the same orders?
If you didn't see the massive red bold letters saying it wasn't updated, or you started before that was done. Mobs are not updated yet.
== MCP 7.0 (data: 7.0a, client: 1.3.1, server: 1.3.1) ==
# found jad, ff, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs, param csvs, renumber csv, astyle, astyle config
> Creating Retroguard config files
!! Missing client jar file. Aborting !!
!! Missing server jar file. Aborting !!
I copied the entire bin and resource folders into the jars folder...
oh btw I am on a mac.
EDIT: never mind I fixed it.
Yes, that's easy. Go to the part of your code where you declare your block, then add this on the end. .setStepSound(soundGrassFootstep)
So it looks like this.
public static final Block myBlock = new BlockMyblock(160, 0).setBlockName("blocky blocky").setStepSound(Block.grassStoneFootstep).setHardness(0.40F).setResistance(4F).setLightValue(1F);
And, in your Block file, you can change the material. Change it to Material.plants. Only if you didn't have that already.
You should understand the things you declare.
public static final Block celestialBronzeOre = new BlockCelestialBronze(160, 0).setBlockName("CelestialBronzeOre").setStepSound(Block.soundStoneFootstep).setHardness(0.40F).setResistance(4F).setLightValue(1F);for example, celestialBronzeOre just gives you code something that refers to your block. celestialBronze is just what you refer to your block inside your mod class. Naming you mod class should be easy, just put there anything that you think is good. It really depends to you. Now, the part where it says new BlockCelestialBronze just refers to the main class in which all the features of the block itself are found. To summarize it up,
mod_ = just the name of your mod. ex. mod_CarMod, mod_GunMod
celestialBronzeOre = the one you use to refer to your block inside the mod_ class
BlockCelestialBronze = where the features of the block itself are explained.
You see, naming isn't really a problem, but remember that no two class files can have the same name. It's all up to you.
He's not helping codes that doesn't use his tutorials. Post in Mod Development.
HEY GUYS! IF YOU STILL CANT WAIT FOR MOBS TO UPDATE, YOU CAN DO THIS.
Follow TechGuy's tutorial on mobs. Then, you have to find this line in your mod_ file.
[code]ModLoader.registerEntityID(EntityMyMob.class, "My Custom Mob", ModLoader.getUniqueEntityId());[/code]
And erase ModLoader.getUniqueEntityId() with any number, below 127, and must not share the same ID with existing mobs. To know what the ids of mobs are, go to EntityList.
So, it would be something like this.
[code]ModLoader.registerEntityID(PJModEntityRedHarpy.class, "Red Harpy", 72);[/code]
Thanks to my fellow friends at the IRC!
Thx for try help me but I alredy fix it
What the hell did techguy tell us all? If you don't remember I will burn like an ant under a magnifying glass.
The error:
BlockGranite
package net.minecraft.src; import java.util.Random; public class BlockGranite extends Block { public BlockGranite(int i, int j) { super(i,j,Material.wood); } public int idDropped(int i, Random random, int j) { return mod_Block.granite.blockID } public int quantityDropped(Random random) { return 1; } }package net.minecraft.src; public class mod_Geology extends BaseMod { public static final Block granite = new BlockGranite(160,0).setBlockName("granite").setHardness(3F).setResistance(4F); public void load() { granite.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/geology/granite.png"); ModLoader.registerBlock(granite); ModLoader.addName(granite, "Granite"); ModLoader.addRecipe(new ItemStack(granite, 1), new Object [] {"#",Character.valueOf('#'),Block.dirt}); } public String getVersion() { return "0.1"; } }http://www.minecraftforum.net/topic/1417041-mod-entity-problem/
my mod_ file (all the places that have errors are highlighted in red)
package net.minecraft.src;
public class mod_DrugcraftBeta extends BaseMod{
//Declarations
public static final Item Shrooms = new Shrooms(5001, 4, false).setItemName("Shrooms");
public static final Item Cocaine = new Cocaine(5002, 4, false).setItemName("Cocaine");
public static final Item Steriods = new Steriods(5003, 4, false).setItemName("Steriods");
public void load(){
//Overrides
Shrooms.iconIndex = ModLoader.addOverride("/gui/items.png", "/Shrooms.png");
Cocaine.iconIndex = ModLoader.addOverride("/gui/items.png", "/Drugs/Cocaine.png");
//Names
ModLoader.addName(Shrooms, "Shrooms");
ModLoader.addName(Cocaine, "Cocaine");
//Recipes or Crafting
ModLoader.addRecipe(new ItemStack(Shrooms, 1), new Object [] {"#", Character.valueOf('#'), Block.dirt});
ModLoader.addRecipe(new ItemStack(Cocaine, 1), new Object [] {"@@@", "#%#", "%*&", Character.valueOf('@'), Block.mushroomRed, Character.valueOf('#'),
//Entity(s)
//Achievements
//Crops
//Just a standard block.
public static final Block TobbacoLeaf = new TobbacoLeaf (165, 0).setBlockName("cropNameHere");
//This is a fairly standard item but it has two new arguments. The first is the block it plants, in this case is our new crop "cropNameHere".The second is the block that is required to be right clicked on to plant the seeds.
//We are using tilled field/dirt for this crop but you can change it to whatever you like. Remember to change it in the block class as well.
public static final Item TobbacoLeafSeeds = new TobbacoLeafSeeds(2500, TobbacoLeafSeeds.blockID, Block.tilledField.blockID).setItemName("Tobacco Seeds");
//These static ints are the textures of the crop in its various stages of growth.
public static int cropStageOne = ModLoader.addOverride("/terrain.png", "/stageOne.png");
public static int cropStageTwo = ModLoader.addOverride("/terrain.png", "/stageTwo.png");
public static int cropStageThree = ModLoader.addOverride("/terrain.png", "/stageThree.png");
public static int cropStageFour = ModLoader.addOverride("/terrain.png", "/stageFour.png");
public static int cropStageFive = ModLoader.addOverride("/terrain.png", "/stageFive.png");
public static int cropStageSix = ModLoader.addOverride("/terrain.png", "/stageSix.png");
public static int cropStageSeven = ModLoader.addOverride("/terrain.png", "/stageSeven.png");
public static int cropStageEight = ModLoader.addOverride("/terrain.png", "/stageEight.png");
}public String getVersion(){
return "1.3.1";}}
That was my mod_ file. now my Crop File. as the same, errors will be highlighted in red and the error im getting is : mod_DrugcraftBeta cannot be resolved to a variable
here the crop file:
package net.minecraft.src;
import java.util.Random;
public class TobbacoLeaf extends BlockFlower
{public TobbacoLeaf(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_DrugcraftBeta.TobbacoLeaf));
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_DrugcraftBeta.cropStageOne;
}if(j == 2){return mod_DrugcraftBeta.cropStageTwo;
}if(j == 3){return mod_DrugcraftBeta.cropStageThree;
}if(j == 4){return mod_DrugcraftBeta.cropStageFour;
}if(j == 5){return mod_DrugcraftBeta.cropStageFive;
}if(j == 6){return mod_DrugcraftBeta.cropStageSix;
}if(j == 7){return mod_DrugcraftBeta.cropStageSeven;
}if(j == 8){return mod_DrugcraftBeta.cropStageEight;}return j;}}
Change
public static final Block TobbacoLeaf = new TobbacoLeaf (165, 0).setBlockName("cropNameHere");to
public static final Block TobbacoLeaf = new TobbacoLeaf (165, 0).setBlockName("TobbacoLeaf").setRequiresSelfNotify();Also I don't see where you registered your crop so add this (unless you have it and I didn't notice)
TobbacoCrop.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Picturehere"); ModLoader.registerBlock(TobaccoCrop); ModLoader.addName(TobaccoCrop, "TobbaccoCrop");