I'm making my mob type spawn in the jungle area only. In your tutorial, you didn't specify where you put the code. Could you please list where I put it?
I'm making my mob type spawn in the jungle area only. In your tutorial, you didn't specify where you put the code. Could you please list where I put it?
You're looking at the tutorial in the "Other NPC Information - Specific Biome Spawning" section, correct?
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Well you just replace the ModLoader.addSpawn line from the base tutorial with the one from the specific biome tutorial.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Spawning works, thank you so much! The only problem is the path file. I have both my mob texture in my the main folder and mob folder in my jar, however it still outputs with a white texture.
public class EntityMudTribe extends EntityCreature
{
public EntityMudTribe(World world)
{
super(world);
texture = "mob/MudTribe.png";
moveSpeed = 1.0F;
Spawning works, thank you so much! The only problem is the path file. I have both my mob texture in my the main folder and mob folder in my jar, however it still outputs with a white texture.
public class EntityMudTribe extends EntityCreature
{
public EntityMudTribe(World world)
{
super(world);
texture = "mob/MudTribe.png";
moveSpeed = 1.0F;
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Is it possible to make a npc drop 2 or 3 items, And if the answer is yes, how?
And can you adjust the droprate of the drops?
I'm not sure of how to actually implement it, but have a look in the Iron Golem's entity class. It has a method called dropFewItems or something like that. But I've not messed around with creating a mob yet, so I'm not 100% sure.
Rollback Post to RevisionRollBack
I used to maintain the Minecraft Forums Mod List. However, life has stepped in the way of that. Perhaps later...
Whenever I use ModLoader.addShapelessRecipe I get a crash saying invalid shapeless recipe. The mod works fine with ModLoader.addRecipe.
I'm just confused because it works great with .addRecipe
code:
package net.minecraft.src;
public class mod_newbricks extends BaseMod
{
public static final Block OrangeBrick = new Block(200,0,Material.rock).setBlockName("Orange Brick").setHardness(2F).setResistance(7F);
public void load()
{
OrangeBrick.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/bricks/orangebrick.png");
ModLoader.registerBlock(OrangeBrick);
ModLoader.addName(OrangeBrick,"Orange Brick");
ModLoader.addShapelessRecipe(new ItemStack(OrangeBrick,1), new Object[] {"#","*",Character.valueOf('#'),new ItemStack(Item.dyePowder,1,14),Character.valueOf('*'),Block.brick});
}
public String getVersion()
{
return "1.2.5";
}
}
After I run it I get this error:
Exception in thread "Minecraft main thread" java.lang.ExceptionInInitializerError
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Invalid shapeless recipy!
at net.minecraft.src.ModLoader.init(ModLoader.java:891)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:157)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:85)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:12)
... 3 more
Caused by: java.lang.RuntimeException: Invalid shapeless recipy!
at net.minecraft.src.CraftingManager.addShapelessRecipe(CraftingManager.java:437)
at net.minecraft.src.ModLoader.addShapelessRecipe(ModLoader.java:417)
at net.minecraft.src.mod_newbricks.load(mod_newbricks.java:10)
at net.minecraft.src.ModLoader.init(ModLoader.java:856)
... 6 more
Whenever I use ModLoader.addShapelessRecipe I get a crash saying invalid shapeless recipe. The mod works fine with ModLoader.addRecipe.
I'm just confused because it works great with .addRecipe
code:
package net.minecraft.src;
public class mod_newbricks extends BaseMod
{
public static final Block OrangeBrick = new Block(200,0,Material.rock).setBlockName("Orange Brick").setHardness(2F).setResistance(7F);
public void load()
{
OrangeBrick.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/bricks/orangebrick.png");
ModLoader.registerBlock(OrangeBrick);
ModLoader.addName(OrangeBrick,"Orange Brick");
ModLoader.addShapelessRecipe(new ItemStack(OrangeBrick,1), new Object[] {"#","*",Character.valueOf('#'),new ItemStack(Item.dyePowder,1,14),Character.valueOf('*'),Block.brick});
}
public String getVersion()
{
return "1.2.5";
}
}
After I run it I get this error:
Exception in thread "Minecraft main thread" java.lang.ExceptionInInitializerError
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Invalid shapeless recipy!
at net.minecraft.src.ModLoader.init(ModLoader.java:891)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:157)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:85)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:12)
... 3 more
Caused by: java.lang.RuntimeException: Invalid shapeless recipy!
at net.minecraft.src.CraftingManager.addShapelessRecipe(CraftingManager.java:437)
at net.minecraft.src.ModLoader.addShapelessRecipe(ModLoader.java:417)
at net.minecraft.src.mod_newbricks.load(mod_newbricks.java:10)
at net.minecraft.src.ModLoader.init(ModLoader.java:856)
... 6 more
Your shapeless recipe isn't shapeless at all. You're trying to add it in the same way a shaped recipe is added. A shapeless recipe should look something like this:
ModLoader.addShapelessRecipe(new ItemStack(blockExample, 2), new Object[] {new ItemStack(Block.dirt, 1), new ItemStack(Block.dirt, 1), new ItemStack(Block.stone, 1)});
The above shapeless recipe creates two "blockExample" from 2 dirt, and 1 stone no matter where they're placed in a crafting table.
Which means your code should look like this:
ModLoader.addShapelessRecipe(new ItemStack(OrangeBrick, 1), new Object[] {new ItemStack(Item.dyePowder,1,14), new ItemStack(Block.brick, 1)});
Does anyone knows how to make a NPC drop a block instead of a item?
Again, I don't know much about entities, but I'd imagine you'd change something in your entity class from this: (pig as an example)
protected int getDropItemId()
{
if (isBurning())
{
return Item.porkCooked.shiftedIndex;
}
else
{
return Item.porkRaw.shiftedIndex;
}
}
To this:
protected int getDropItemId()
{
if (isBurning())
{
return Item.charcoal.shiftedIndex;
}
else
{
return Block.wood.blockID;
}
}
Specifically, change the Item. to Block., and change the .shiftedIndex to blockID. Keep in mind that this is 100% a guess and that I don't know for sure. Couldn't hurt to try. You can always undo it later.
Rollback Post to RevisionRollBack
I used to maintain the Minecraft Forums Mod List. However, life has stepped in the way of that. Perhaps later...
When I try and place two generate methods in my mod_ class, it wants me to rename one, it says duplicate method.
Here is my mod_ class
package net.minecraft.src;
import java.util.Random;
public class mod_Punchwood extends BaseMod
{
//Items
public static final Item Xanahammah = new ItemXanahammah(1000).setFull3D().setItemName("Xanahammah");
public static final Item eggShard = new ItemTest(1200).setItemName("Shard");
public static final Item xanIngot = new ItemTest(1201).setItemName("Ingot");
public static final Item coin = new ItemCoin(1250).setItemName("Coin");
//Foods
public static final Item zacoTaco = new ItemFood(1500, 4, 2, false).setItemName("Taco");
//Blocks
public static final Block Kitten = new BlockKitten(130, 0).setBlockName("Kitten Block").setHardness(2F).setResistance(3F);
public static final Block xanOre = new BlockGlobal(131, 11).setBlockName("Xanatos Ore").setHardness(2F).setResistance(4F).setLightValue(0.25F);
ModLoader.addRecipe(new ItemStack(zacoTaco, 4), new Object[]{
"D", Character.valueOf('D'), Block.dirt,
});
//Generation
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
for(int i = 0; i < 20; i++)
{
int randPosX = chunkX + random.nextInt(16);
int randPosY = random.nextInt(128);
int randPosZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(Kitten.blockID, 30)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
public void load()
{
}
public String getVersion()
{
return "1.2.5";
}
}
When I try and add it right after the first one, it gives me that error.
PS when I did the code things it was all messed up...
When I try and place two generate methods in my mod_ class, it wants me to rename one, it says duplicate method.
Here is my mod_ class
package net.minecraft.src;
import java.util.Random;
public class mod_Punchwood extends BaseMod
{
//Items
public static final Item Xanahammah = new ItemXanahammah(1000).setFull3D().setItemName("Xanahammah");
public static final Item eggShard = new ItemTest(1200).setItemName("Shard");
public static final Item xanIngot = new ItemTest(1201).setItemName("Ingot");
public static final Item coin = new ItemCoin(1250).setItemName("Coin");
//Foods
public static final Item zacoTaco = new ItemFood(1500, 4, 2, false).setItemName("Taco");
//Blocks
public static final Block Kitten = new BlockKitten(130, 0).setBlockName("Kitten Block").setHardness(2F).setResistance(3F);
public static final Block xanOre = new BlockGlobal(131, 11).setBlockName("Xanatos Ore").setHardness(2F).setResistance(4F).setLightValue(0.25F);
ModLoader.addRecipe(new ItemStack(zacoTaco, 4), new Object[]{
"D", Character.valueOf('D'), Block.dirt,
});
//Generation
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
for(int i = 0; i < 20; i++)
{
int randPosX = chunkX + random.nextInt(16);
int randPosY = random.nextInt(128);
int randPosZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(Kitten.blockID, 30)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
public void load()
{
}
public String getVersion()
{
return "1.2.5";
}
}
When I try and add it right after the first one, it gives me that error.
PS when I did the code things it was all messed up...
You only add a new for loop with new variables in. Not an entirely new public void generateSurface.
So, here's how that should look:
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
//ExampleBlock1
for(int a = 0; a < 20; a++)
{
int randPosX = chunkX + random.nextInt(16);
int randPosY = random.nextInt(128);
int randPosZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(ExampleBlock1.blockID, 30)).generate(world, random, randPosX, randPosY, randPosZ);
}
//ExampleBlock2
for(int b = 0; b < 20; b++)
{
int randPosX1 = chunkX + random.nextInt(16);
int randPosY1 = random.nextInt(128);
int randPosZ1 = chunkZ + random.nextInt(16);
(new WorldGenMinable(ExampleBlock2.blockID, 30)).generate(world, random, randPosX1, randPosY1, randPosZ1);
}
}
Personal note:
The name of the variables can be whatever you want. It's not necessary but, personally, for easy identification as well as knowing that my variables will never be the same for different loops, I usually do something similar to this: (we'll say my ore is copper)
for(int copper = 0; copper < 20; copper++)
{
int copperX = chunkX + random.nextInt(16);
int copperY = random.nextInt(128);
int copperZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(oreCopper.blockID, 30)).generate(world, random, copperX, copperY, copperZ);
}
}
The Meaning of Life, the Universe, and Everything.
Location:
Join Date:
6/7/2012
Posts:
42
Minecraft:
lad1890
Member Details
Ok it happens with my ore(cant collect it)so it is in there as well plz help
mod_Creeper
package net.minecraft.src;
import java.util.Random;
public class mod_Creeper extends BaseMod {
public static final Block CreeperBlock = new BlockCreeperBlock(190, Material.rock).setBlockName("Creeper Block").setHardness(1);
public static final Block CreeperOre = new CreeperOre(191, Material.rock).setBlockName("Creeper Ore").setHardness(1);
public static final Item CreeperIngot = new Item(2000).setItemName("CreeperIngot");
public static final Item CreeperPickaxe = new CreeperPickaxe(2001, CreeperMaterial.CREEPER).setItemName("Creeper Pickaxe");
public static final Item CreeperSword = new CreeperSword(2002, CreeperMaterial.CREEPER).setItemName("Creeper Sword");
public static final Item CreeperHoe = new CreeperHoe(2003, CreeperMaterial.CREEPER).setItemName("Creeper Hoe");
public static final Item CreeperAxe = new CreeperAxe(2004, CreeperMaterial.CREEPER).setItemName("Creeper Axe");
public static final Item CreeperShovel = new CreeperShovel(2005, CreeperMaterial.CREEPER).setItemName("Creeper Shovel");
public static final Item CreeperHelmet = new ItemArmor(2006, EnumArmorMaterial.CREEPER, ModLoader.addArmor("Creeper"), 0).setItemName("Creeper Helmet");
public static final Item CreeperBreastPlate = new ItemArmor(2007, EnumArmorMaterial.CREEPER, ModLoader.addArmor("Creeper"), 1).setItemName("Creeper BreastPlate");
public static final Item CreeperLeggings = new ItemArmor(2008, EnumArmorMaterial.CREEPER, ModLoader.addArmor("Creeper"), 2).setItemName("Creeper Leggings");
public static final Item CreeperBoots = new ItemArmor(2009, EnumArmorMaterial.CREEPER, ModLoader.addArmor("Creeper"), 3).setItemName("Creeper Boots");
@Override
public String getVersion() {
return "Creeper Texture v1.2.5";
}
@Override
public void load() {
ModLoader.registerBlock(CreeperBlock);
ModLoader.addRecipe(new ItemStack(CreeperPickaxe, 1), new Object[]{
"CCC", " S ", " S ",
'C', CreeperIngot,
'S', Item.stick,
});
ModLoader.addRecipe(new ItemStack(CreeperSword, 1), new Object[]{
" C ", " C ", " S ",
'C', CreeperIngot,
'S', Item.stick,
});
ModLoader.addRecipe(new ItemStack(CreeperHoe, 1), new Object[]{
"CC ", " S ", " S ",
'C', CreeperIngot,
'S', Item.stick,
});
ModLoader.addRecipe(new ItemStack(CreeperAxe, 1), new Object[]{
"CC ", "CS ", " S ",
'C', CreeperIngot,
'S', Item.stick,
});
ModLoader.addRecipe(new ItemStack(CreeperShovel, 1), new Object[]{
" C ", " S ", " S ",
'C', CreeperIngot,
'S', Item.stick,
});
ModLoader.addRecipe(new ItemStack(CreeperHelmet, 1), new Object[]{
"CCC", "C C", " ",
'C', CreeperIngot,
});
ModLoader.addRecipe(new ItemStack(CreeperBreastPlate, 1), new Object[]{
"C C", "CCC", "CCC",
'C', CreeperIngot,
});
ModLoader.addRecipe(new ItemStack(CreeperLeggings, 1), new Object[]{
"CCC", "C C", "C C",
'C', CreeperIngot,
});
ModLoader.addRecipe(new ItemStack(CreeperBoots, 1), new Object[]{
" ", "C C", "C C",
'C', CreeperIngot,
});
ModLoader.addRecipe(new ItemStack(CreeperBlock, 10), new Object[]{
"CCC", "CCC", "CCC",
'C', CreeperIngot,
});
ModLoader.addSmelting(CreeperBlock.blockID, new ItemStack (CreeperIngot, 2));
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ){
//Coal is about 15
for(int i = 0; i < 100; i++){
int randPosX = chunkX + rand.nextInt(8);
int randPosY = rand.nextInt(128);
int randPosZ = chunkZ + rand.nextInt(8);
(new WorldGenMinable(CreeperOre.blockID, 10)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
}
CreeperOre
package net.minecraft.src;
import java.util.Random;
public class CreeperOre extends Block {
protected CreeperOre(int i, Material material) {
super(i, material);
}
public int idDropped(int i, Random random){
return mod_Creeper.CreeperOre.blockID;
}
public int quantityDropped(Random random)
{
int l = 1;
return l;
}
}
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
182 recipes
LWJGL Version: 2.4.2
ModLoader 1.2.5 Initializing...
CONFLICT @ 2000
CONFLICT @ 2001
CONFLICT @ 2002
CONFLICT @ 2003
CONFLICT @ 2004
CONFLICT @ 2005
CONFLICT @ 2006
CONFLICT @ 2007
CONFLICT @ 2008
CONFLICT @ 2009
Mod Initialized: mod_Creeper Creeper Texture v1.2.5
Overriding /terrain.png with CreeperBlock.png @ 168. 31 left.
Overriding /gui/items.png with CreeperIngot1.png @ 38. 84 left.
Overriding /gui/items.png with Creeper-Pickaxe.png @ 102. 83 left.
Overriding /gui/items.png with Creeper-Sword.png @ 118. 82 left.
Overriding /gui/items.png with Creeper-Hoe.png @ 119. 81 left.
Overriding /gui/items.png with Creeper-Axe.png @ 120. 80 left.
Overriding /gui/items.png with Creeper-Shovel.png @ 134. 79 left.
Overriding /gui/items.png with Creeper_Helmet.png @ 144. 78 left.
Overriding /gui/items.png with Creeper_Breast.png @ 145. 77 left.
Overriding /gui/items.png with Creeper_Legs.png @ 146. 76 left.
Overriding /gui/items.png with Creeper_Boots.png @ 147. 75 left.
Overriding /terrain.png with CreeperOre.png @ 169. 30 left.
Mod Loaded: mod_Creeper Creeper Texture v1.2.5
Done.
Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
Starting up SoundSystem...
Initializing LWJGL OpenAL
(The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
OpenAL initialized.
java.lang.NullPointerException
at net.minecraft.src.ItemStack.isItemStackDamageable(ItemStack.java:199)
at net.minecraft.src.ItemStack.isItemDamaged(ItemStack.java:212)
at net.minecraft.src.InventoryPlayer.addItemStackToInventory(InventoryPlayer.java:298)
at net.minecraft.src.EntityItem.onCollideWithPlayer(EntityItem.java:187)
at net.minecraft.src.EntityPlayer.collideWithPlayer(EntityPlayer.java:579)
at net.minecraft.src.EntityPlayer.onLivingUpdate(EntityPlayer.java:570)
at net.minecraft.src.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:259)
at net.minecraft.src.EntityLiving.onUpdate(EntityLiving.java:703)
at net.minecraft.src.EntityPlayer.onUpdate(EntityPlayer.java:281)
at net.minecraft.src.World.updateEntityWithOptionalForce(World.java:2196)
at net.minecraft.src.World.updateEntity(World.java:2164)
at net.minecraft.src.World.updateEntities(World.java:2038)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1897)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:870)
at net.minecraft.client.Minecraft.run(Minecraft.java:801)
at java.lang.Thread.run(Unknown Source)
Stopping!
SoundSystem shutting down...
Author: Paul Lamb, www.paulscode.com
-
View User Profile
-
View Posts
-
Send Message
Retired StaffI think we'd need to see your code to fully understand your error.
The spawn rate is set very low. Change the 0 and 1 to higher numbers.
You're looking at the tutorial in the "Other NPC Information - Specific Biome Spawning" section, correct?
Off-topic
2501 replies on this topic. Wow
together they are powerful beyond imagination."
Indeed, sir.
Well you just replace the ModLoader.addSpawn line from the base tutorial with the one from the specific biome tutorial.
together they are powerful beyond imagination."
What did you set the numbers to?
together they are powerful beyond imagination."
public class EntityMudTribe extends EntityCreature { public EntityMudTribe(World world) { super(world); texture = "mob/MudTribe.png"; moveSpeed = 1.0F;I have put my coding in for the mod_ file too.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffJust wait until someone makes something BIG and credits this thread for getting them started.
You need a / before mob.
The mod_ class needs to be lowercase.
instead of
together they are powerful beyond imagination."
Which ones?
-
View User Profile
-
View Posts
-
Send Message
Retired StaffWell, if you don't know where the problem is, then we don't either. So all of it, I'd say. Though, we could start with your entire mod_* class.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffI'm not sure of how to actually implement it, but have a look in the Iron Golem's entity class. It has a method called dropFewItems or something like that. But I've not messed around with creating a mob yet, so I'm not 100% sure.
I'm just confused because it works great with .addRecipe
code:
package net.minecraft.src; public class mod_newbricks extends BaseMod { public static final Block OrangeBrick = new Block(200,0,Material.rock).setBlockName("Orange Brick").setHardness(2F).setResistance(7F); public void load() { OrangeBrick.blockIndexInTexture = ModLoader.addOverride("/terrain.png","/bricks/orangebrick.png"); ModLoader.registerBlock(OrangeBrick); ModLoader.addName(OrangeBrick,"Orange Brick"); ModLoader.addShapelessRecipe(new ItemStack(OrangeBrick,1), new Object[] {"#","*",Character.valueOf('#'),new ItemStack(Item.dyePowder,1,14),Character.valueOf('*'),Block.brick}); } public String getVersion() { return "1.2.5"; } }After I run it I get this error:
-
View User Profile
-
View Posts
-
Send Message
Retired StaffYour shapeless recipe isn't shapeless at all. You're trying to add it in the same way a shaped recipe is added. A shapeless recipe should look something like this:
ModLoader.addShapelessRecipe(new ItemStack(blockExample, 2), new Object[] {new ItemStack(Block.dirt, 1), new ItemStack(Block.dirt, 1), new ItemStack(Block.stone, 1)});The above shapeless recipe creates two "blockExample" from 2 dirt, and 1 stone no matter where they're placed in a crafting table.
Which means your code should look like this:
ModLoader.addShapelessRecipe(new ItemStack(OrangeBrick, 1), new Object[] {new ItemStack(Item.dyePowder,1,14), new ItemStack(Block.brick, 1)});-
View User Profile
-
View Posts
-
Send Message
Retired StaffAgain, I don't know much about entities, but I'd imagine you'd change something in your entity class from this: (pig as an example)
protected int getDropItemId() { if (isBurning()) { return Item.porkCooked.shiftedIndex; } else { return Item.porkRaw.shiftedIndex; } }To this:
protected int getDropItemId() { if (isBurning()) { return Item.charcoal.shiftedIndex; } else { return Block.wood.blockID; } }Specifically, change the Item. to Block., and change the .shiftedIndex to blockID. Keep in mind that this is 100% a guess and that I don't know for sure. Couldn't hurt to try. You can always undo it later.
Sir, I finished my mod! Thank you very much for your help ( You've been credited majorly
http://www.minecraftforum.net/topic/1292553-125-tribes-mod-fight-tribes-for-territory-and-throw-tomahawks/
Here is my mod_ class
package net.minecraft.src;
import java.util.Random;
public class mod_Punchwood extends BaseMod
{
//Items
public static final Item Xanahammah = new ItemXanahammah(1000).setFull3D().setItemName("Xanahammah");
public static final Item eggShard = new ItemTest(1200).setItemName("Shard");
public static final Item xanIngot = new ItemTest(1201).setItemName("Ingot");
public static final Item coin = new ItemCoin(1250).setItemName("Coin");
//Foods
public static final Item zacoTaco = new ItemFood(1500, 4, 2, false).setItemName("Taco");
//Blocks
public static final Block Kitten = new BlockKitten(130, 0).setBlockName("Kitten Block").setHardness(2F).setResistance(3F);
public static final Block xanOre = new BlockGlobal(131, 11).setBlockName("Xanatos Ore").setHardness(2F).setResistance(4F).setLightValue(0.25F);
public mod_Punchwood()
{
//Items
Xanahammah.iconIndex = ModLoader.addOverride("/gui/items.png", "/Xanahammah.png");
eggShard.iconIndex = ModLoader.addOverride("/gui/items.png", "/KittenShard.png");
coin.iconIndex = ModLoader.addOverride("/gui/items.png", "/Coin.png");
zacoTaco.iconIndex = ModLoader.addOverride("/gui/items.png", "/Taco.png");
//xanIngot.iconIndex = ModLoader.addOverride("/gui/items.png", "/xanIngot.png");
ModLoader.addName(Xanahammah, "Xanahammah");
ModLoader.addName(eggShard, "Egg Shard");
ModLoader.addName(coin, "Coin");
ModLoader.addName(zacoTaco, "Zaco Taco");
ModLoader.addName(xanIngot, "Xanatos Ingot");
//Blocks
Kitten.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/KittenBlock.png");
xanOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/XanatosOre.png");
ModLoader.registerBlock(Kitten);
ModLoader.registerBlock(xanOre);
ModLoader.addName(Kitten, "Kitten Ore");
ModLoader.addName(xanOre, "Xanatos Ore");
//Items
ModLoader.addRecipe(new ItemStack(Xanahammah, 1), new Object[]{
"AAA","BEB","VEV", Character.valueOf('E'), Item.stick, Character.valueOf('B'), Item.diamond, Character.valueOf('A'), Item.ingotGold,
});
ModLoader.addRecipe(new ItemStack(Item.monsterPlacer, 1, 98), new Object[]{
"SSS","SES","SSS", Character.valueOf('S'), eggShard, Character.valueOf('E'), Item.egg,
});
ModLoader.addRecipe(new ItemStack(coin, 1), new Object[]{
"ASA","SAS","ASA", Character.valueOf('S'), Item.goldNugget, Character.valueOf('A'), Item.ingotGold,
});
ModLoader.addRecipe(new ItemStack(zacoTaco, 4), new Object[]{
"D", Character.valueOf('D'), Block.dirt,
});
//Generation
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
for(int i = 0; i < 20; i++)
{
int randPosX = chunkX + random.nextInt(16);
int randPosY = random.nextInt(128);
int randPosZ = chunkZ + random.nextInt(16);
(new WorldGenMinable(Kitten.blockID, 30)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
public void load()
{
}
public String getVersion()
{
return "1.2.5";
}
}
When I try and add it right after the first one, it gives me that error.
PS when I did the code things it was all messed up...
Also visit my youtube please! Youtube.com/legitzdestroy
-
View User Profile
-
View Posts
-
Send Message
Retired StaffYou only add a new for loop with new variables in. Not an entirely new public void generateSurface.
So, here's how that should look:
public void generateSurface(World world, Random random, int chunkX, int chunkZ) { //ExampleBlock1 for(int a = 0; a < 20; a++) { int randPosX = chunkX + random.nextInt(16); int randPosY = random.nextInt(128); int randPosZ = chunkZ + random.nextInt(16); (new WorldGenMinable(ExampleBlock1.blockID, 30)).generate(world, random, randPosX, randPosY, randPosZ); } //ExampleBlock2 for(int b = 0; b < 20; b++) { int randPosX1 = chunkX + random.nextInt(16); int randPosY1 = random.nextInt(128); int randPosZ1 = chunkZ + random.nextInt(16); (new WorldGenMinable(ExampleBlock2.blockID, 30)).generate(world, random, randPosX1, randPosY1, randPosZ1); } }Personal note:
The name of the variables can be whatever you want. It's not necessary but, personally, for easy identification as well as knowing that my variables will never be the same for different loops, I usually do something similar to this: (we'll say my ore is copper)
for(int copper = 0; copper < 20; copper++) { int copperX = chunkX + random.nextInt(16); int copperY = random.nextInt(128); int copperZ = chunkZ + random.nextInt(16); (new WorldGenMinable(oreCopper.blockID, 30)).generate(world, random, copperX, copperY, copperZ); } }package net.minecraft.src;
import java.util.Random;
public class mod_Creeper extends BaseMod {
public static final Block CreeperBlock = new BlockCreeperBlock(190, Material.rock).setBlockName("Creeper Block").setHardness(1);
public static final Block CreeperOre = new CreeperOre(191, Material.rock).setBlockName("Creeper Ore").setHardness(1);
public static final Item CreeperIngot = new Item(2000).setItemName("CreeperIngot");
public static final Item CreeperPickaxe = new CreeperPickaxe(2001, CreeperMaterial.CREEPER).setItemName("Creeper Pickaxe");
public static final Item CreeperSword = new CreeperSword(2002, CreeperMaterial.CREEPER).setItemName("Creeper Sword");
public static final Item CreeperHoe = new CreeperHoe(2003, CreeperMaterial.CREEPER).setItemName("Creeper Hoe");
public static final Item CreeperAxe = new CreeperAxe(2004, CreeperMaterial.CREEPER).setItemName("Creeper Axe");
public static final Item CreeperShovel = new CreeperShovel(2005, CreeperMaterial.CREEPER).setItemName("Creeper Shovel");
public static final Item CreeperHelmet = new ItemArmor(2006, EnumArmorMaterial.CREEPER, ModLoader.addArmor("Creeper"), 0).setItemName("Creeper Helmet");
public static final Item CreeperBreastPlate = new ItemArmor(2007, EnumArmorMaterial.CREEPER, ModLoader.addArmor("Creeper"), 1).setItemName("Creeper BreastPlate");
public static final Item CreeperLeggings = new ItemArmor(2008, EnumArmorMaterial.CREEPER, ModLoader.addArmor("Creeper"), 2).setItemName("Creeper Leggings");
public static final Item CreeperBoots = new ItemArmor(2009, EnumArmorMaterial.CREEPER, ModLoader.addArmor("Creeper"), 3).setItemName("Creeper Boots");
@Override
public String getVersion() {
return "Creeper Texture v1.2.5";
}
@Override
public void load() {
ModLoader.registerBlock(CreeperBlock);
ModLoader.addName(CreeperBlock, "Creeper Block");
ModLoader.addName(CreeperIngot, "CreeperIngot");
ModLoader.addName(CreeperPickaxe, "Creeper Pickaxe");
ModLoader.addName(CreeperSword, "Creeper Sword");
ModLoader.addName(CreeperHoe, "Creeper Hoe");
ModLoader.addName(CreeperAxe, "Creeper Axe");
ModLoader.addName(CreeperShovel, "Creeper Shovel");
ModLoader.addName(CreeperHelmet, "Creeper Helmet");
ModLoader.addName(CreeperBreastPlate, "Creeper BreastPlate");
ModLoader.addName(CreeperLeggings, "Creeper Leggings");
ModLoader.addName(CreeperBoots, "Creeper Boots");
ModLoader.addName(CreeperOre, "Creeper Ore");
CreeperBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "CreeperBlock.png");
CreeperOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "CreeperOre.png");
CreeperIngot.iconIndex = ModLoader.addOverride("/gui/items.png", "CreeperIngot1.png" );
CreeperPickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "Creeper-Pickaxe.png");
CreeperSword.iconIndex = ModLoader.addOverride("/gui/items.png", "Creeper-Sword.png");
CreeperHoe.iconIndex = ModLoader.addOverride("/gui/items.png", "Creeper-Hoe.png");
CreeperAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "Creeper-Axe.png");
CreeperShovel.iconIndex = ModLoader.addOverride("/gui/items.png", "Creeper-Shovel.png");
CreeperHelmet.iconIndex = ModLoader.addOverride("/gui/items.png", "Creeper_Helmet.png");
CreeperBreastPlate.iconIndex = ModLoader.addOverride("/gui/items.png", "Creeper_Breast.png");
CreeperLeggings.iconIndex = ModLoader.addOverride("/gui/items.png", "Creeper_Legs.png");
CreeperBoots.iconIndex = ModLoader.addOverride("/gui/items.png", "Creeper_Boots.png");
ModLoader.addRecipe(new ItemStack(CreeperBlock, 10), new Object[]{
"GGG", "GDG", "GGG",
'D', Block.dirt,
'G', Block.dirt,
});
ModLoader.addRecipe(new ItemStack(CreeperPickaxe, 1), new Object[]{
"CCC", " S ", " S ",
'C', CreeperIngot,
'S', Item.stick,
});
ModLoader.addRecipe(new ItemStack(CreeperSword, 1), new Object[]{
" C ", " C ", " S ",
'C', CreeperIngot,
'S', Item.stick,
});
ModLoader.addRecipe(new ItemStack(CreeperHoe, 1), new Object[]{
"CC ", " S ", " S ",
'C', CreeperIngot,
'S', Item.stick,
});
ModLoader.addRecipe(new ItemStack(CreeperAxe, 1), new Object[]{
"CC ", "CS ", " S ",
'C', CreeperIngot,
'S', Item.stick,
});
ModLoader.addRecipe(new ItemStack(CreeperShovel, 1), new Object[]{
" C ", " S ", " S ",
'C', CreeperIngot,
'S', Item.stick,
});
ModLoader.addRecipe(new ItemStack(CreeperHelmet, 1), new Object[]{
"CCC", "C C", " ",
'C', CreeperIngot,
});
ModLoader.addRecipe(new ItemStack(CreeperBreastPlate, 1), new Object[]{
"C C", "CCC", "CCC",
'C', CreeperIngot,
});
ModLoader.addRecipe(new ItemStack(CreeperLeggings, 1), new Object[]{
"CCC", "C C", "C C",
'C', CreeperIngot,
});
ModLoader.addRecipe(new ItemStack(CreeperBoots, 1), new Object[]{
" ", "C C", "C C",
'C', CreeperIngot,
});
ModLoader.addRecipe(new ItemStack(CreeperBlock, 10), new Object[]{
"CCC", "CCC", "CCC",
'C', CreeperIngot,
});
ModLoader.addSmelting(CreeperBlock.blockID, new ItemStack (CreeperIngot, 2));
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ){
//Coal is about 15
for(int i = 0; i < 100; i++){
int randPosX = chunkX + rand.nextInt(8);
int randPosY = rand.nextInt(128);
int randPosZ = chunkZ + rand.nextInt(8);
(new WorldGenMinable(CreeperOre.blockID, 10)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
}
CreeperOre
package net.minecraft.src;
import java.util.Random;
public class CreeperOre extends Block {
protected CreeperOre(int i, Material material) {
super(i, material);
}
public int idDropped(int i, Random random){
return mod_Creeper.CreeperOre.blockID;
}
public int quantityDropped(Random random)
{
int l = 1;
return l;
}
}