hi! First of all, i'm from spain, so sorry about my english :{ I have a problem with generate my ores... if i use the code that you put, when i recompile told me that need int, int, and not block, int (new WorldGenMinable), and when I use the code below, no erros, but not generate the ores... (i found diamond but not my ores :/ )
public void GenerateSurface(World worldMod, Random rand, int i, int j)
{
for(int asdfghj = 0; asdfghj < 128; asdfghj++)
{
int j6 = i + rand.nextInt(16) + 8;
int k9 = rand.nextInt(128);
int j12 = j + rand.nextInt(16) + 8;
new WorldGenFlowers(m_MetPlant.blockID).generate(worldMod, rand, j6, k9, j12);
}
for(int uybymqr = 0; uybymqr < 128; uybymqr++)
{
int j6 = i + rand.nextInt(2);
int k9 = rand.nextInt(16);
int j12 = j + rand.nextInt(2);
new WorldGenMinable(m_GemBlueOre.blockID, 3).generate(worldMod, rand, j6, k9, j12);
}
for(int dvqtpz = 0; dvqtpz < 128; dvqtpz++)
{
int j6 = i + rand.nextInt(2);
int k9 = rand.nextInt(16);
int j12 = j + rand.nextInt(2);
new WorldGenMinable(m_GemRedOre.blockID, 3).generate(worldMod, rand, j6, k9, j12);
}
for(int bpmdop = 0; bpmdop < 128; bpmdop++)
{
int j6 = i + rand.nextInt(2);
int k9 = rand.nextInt(16);
int j12 = j + rand.nextInt(2);
new WorldGenMinable(m_GemGreenOre.blockID, 3).generate(worldMod, rand, j6, k9, j12);
}
for(int byavg = 0; byavg < 128; byavg++)
{
int j6 = i + rand.nextInt(8);
int k9 = rand.nextInt(64);
int j12 = j + rand.nextInt(8);
new WorldGenMinable(m_InfRockOre.blockID, 6).generate(worldMod, rand, j6, k9, j12);
}
}
Hi. I think your problem is that the variables for each different block you're trying to spawn is exactly the same. So, try something similar to this:
public void GenerateSurface(World worldMod, Random rand, int i, int j)
{
for(int MetPlant = 0; MetPlant < 128; MetPlant++)
{
int MetPlantX = i + rand.nextInt(16) + 8;
int MetPlantY = rand.nextInt(128);
int MetPlantZ = j + rand.nextInt(16) + 8;
new WorldGenFlowers(m_MetPlant.blockID, 4).generate(worldMod, rand, MetPlantX, MetPlantY, MetPlantZ);
}
for(int GemBlueOre = 0; GemBlueOre < 128; GemBlueOre++)
{
int GemBlueOreX = i + rand.nextInt(2);
int GemBlueOreY = rand.nextInt(16);
int GemBlueOreZ = j + rand.nextInt(2);
new WorldGenMinable(m_GemBlueOre.blockID, 3).generate(worldMod, rand, GemBlueOreX, GemBlueOreY, GemBlueOreZ);
}
}
ZeroLevels, remember you said I can make more tools without making the extra class files, that I can just put them in the already existing ones? Im kinda confused on how to do that, Do I just make a comment and put it under it or something?
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;
}
}
I'll start off with this... No offense, but your code is a disaster area. In fact, I'm not sure you even glanced at TechGuy's tutorials! o.O Anyways, lets get started.
Change the .setBlockName in your CreeperOre declaration so that it doesn't have a space in it. Same with your CreeperBlock. (I'd also suggest it for all of your other items)
Like this:
public static final Block CreeperBlock = new BlockCreeperBlock(190, Material.rock).setBlockName("CreeperBlock").setHardness(1);
public static final Block CreeperOre = new CreeperOre(191, Material.rock).setBlockName("CreeperOre").setHardness(1);
Next, your ore doesn't have any special properties, and therefor, it doesn't need its own class. By default, it will only drop 1 when mined. And since it'll drop itself by default as well, we can delete the class. So, delete your CreeperOre class, and change your ore declaration to this:
public static final Block CreeperOre = new Block(191, Material.rock).setBlockName("CreeperOre").setHardness(1);
Next, all of your textures need a / in front of their .png filename. An example:
You'll need to do something similar to all of your recipes.
Another thing, your armour seems to be added right into the EnumArmorMaterial class. That means it's referencing, and probably editing, a base class. We don't cover editing base classes here. Armour also hasn't been covered in tutorials here, so I really don't know how to help you there. Please locate a different tutorial on the armour and follow it closely.
I'll start off with this... No offense, but your code is a disaster area. In fact, I'm not sure you even glanced at TechGuy's tutorials! o.O Anyways, lets get started.
Okay my code doesnt look like that normally, when i copied and pasted it went all retarted, but i did everything else and it still doesnt work im just gonna rewrite the entire code unless u have more ideas..and by the way the error only happens when i try to pick up my ore after i have mined it
ZeroLevels, remember you said I can make more tools without making the extra class files, that I can just put them in the already existing ones? Im kinda confused on how to do that, Do I just make a comment and put it under it or something?
Yes, I remember.
No, all you really must do is in declaring your new material, reference each new tool to the tool classes you made before. This was why I previously suggested naming your new tools with a more general name, as you might want to reference them later with something other than lead.
Basically, there's only two things you need to do.
Firstly, you need to go into the EnumToolMaterialLead you made, and add your new material in there. In your code, it'll look something like this:
Note that after the closing parenthesis for the first material, it has a comma instead of a semicolon. The semicolon must always be placed at the end of the LAST material declared.
Secondly, you'll need to reference the tool you want to make to the respective class. Here's an example of using a previous class with the new material:
public static final Item NewPickaxe = new ItemLeadPickaxe(402, EnumToolMaterialLead.NEWMATERIAL).setItemName("NewPickaxe");
Notice how it still says = new ItemLeadPickaxe andEnumToolMaterialLead. That's because it's the name of your custom pickaxe class. The class itself makes no reference to the LEAD material type, so it's safe to reference it again with your new pickaxe. Same will go for your other new tools. And obviously, you still need to reference your custom EnumToolMaterialLead class, because it doesn't only contain lead.
Okay my code doesnt look like that normally, when i copied and pasted it went all retarted, but i did everything else and it still doesnt work im just gonna rewrite the entire code unless u have more ideas..and by the way the error only happens when i try to pick up my ore after i have mined it
It's okay. If it messed up during copy, then there's nothing you can do about that. Thanks for not taking offense though.
Sadly, I have no idea what could be causing it to not work when attempting to pick it up. I'm very sorry.
I have this and no ores generate in the world! :{ whats wrong?? (and no flowers xD)
public void GenerateSurface(World worldMod, Random rand, int i, int j)
{
for(int MetPlant = 0; MetPlant < 128; MetPlant++)
{
int MetPlantX = i + rand.nextInt(16) + 8;
int MetPlantY = rand.nextInt(128);
int MetPlantZ = j + rand.nextInt(16) + 8;
new WorldGenFlowers(m_MetPlant.blockID).generate(worldMod, rand, MetPlantX, MetPlantY, MetPlantZ);
}
for(int GemBlueOre = 0; GemBlueOre < 128; GemBlueOre++)
{
int GemBlueOreX = i + rand.nextInt(2);
int GemBlueOreY = rand.nextInt(128);
int GemBlueOreZ = j + rand.nextInt(2);
new WorldGenMinable(m_GemBlueOre.blockID, 3).generate(worldMod, rand, GemBlueOreX, GemBlueOreY, GemBlueOreZ);
}
for(int GemRedOre = 0; GemRedOre < 128; GemRedOre++)
{
int GemRedOreX = i + rand.nextInt(2);
int GemRedOreY = rand.nextInt(128);
int GemRedOreZ = j + rand.nextInt(2);
new WorldGenMinable(m_GemRedOre.blockID, 3).generate(worldMod, rand, GemRedOreX, GemRedOreY, GemRedOreZ);
}
for(int GemGreenOre = 0; GemGreenOre < 128; GemGreenOre++)
{
int GemGreenOreX = i + rand.nextInt(2);
int GemGreenOreY = rand.nextInt(128);
int GemGreenOreZ = j + rand.nextInt(2);
new WorldGenMinable(m_GemGreenOre.blockID, 3).generate(worldMod, rand, GemGreenOreX, GemGreenOreY, GemGreenOreZ);
}
for(int InfRockOre = 0; InfRockOre < 128; InfRockOre++)
{
int InfRockOreX = i + rand.nextInt(8);
int InfRockOreY = rand.nextInt(128);
int InfRockOreZ = j + rand.nextInt(8);
new WorldGenMinable(m_InfRockOre.blockID, 6).generate(worldMod, rand, InfRockOreX, InfRockOreY, InfRockOreZ);
}
}
Hmm. Well, there are a few things that could be changed... I'll explain some. I've posted comments in the code.
for(int MetPlant = 0; MetPlant < 128; MetPlant++) /*The 128 here represents how rare your ore is. The higher the number, the less rare.*/
{
int MetPlantX = i + rand.nextInt(16); /*the 16 in this line (X) as well as 2 lines down (Z) regard placement in chunks.*/
int MetPlantY = rand.nextInt(128); /*The 128 here represents how high up from the bedrock it can spawn*/
int MetPlantZ = j + rand.nextInt(16);
new WorldGenFlowers(m_MetPlant.blockID, 5).generate(worldMod, rand, MetPlantX, MetPlantY, MetPlantZ); /*the 5 in this line represents up to how many you'll find per vein*/
}
Anyways, I'd suggest making all of the numbers in parenthesis within lines X and Z 16. The size of a full chunk is 16x16, so if they're all set to 16, it means it can spawn in any X and Z coordinates. Also, make sure you have a number after your .blockID, because if you don't, you won't find any at all. These go for ores and flowers I believe.
EDIT: I also believe that the 'g' in public void GenerateSurface needs to be lower-case. So change it to
public void generateSurface(World worldMod, Random rand, int i, int j)
Well i guess thats now no recompile errors, because I got an error while starting the client:
java.lang.ArrayIndexOutOfBoundsException: 1030
at net.minecraft.src.ModLoader.initStats(ModLoader.java:905)
at net.minecraft.src.ModLoader.init(ModLoader.java:878)
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)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Thread.java:722)
--- END ERROR REPORT 88314099 ----------
Code:
package
net.minecraft.src;
import
java.util.Random;
public
class mod_tutorials extends BaseMod{
publicstaticfinal Block Lead = new Block(200, Material.rock).setBlockName("Lead").setHardness(1F).setResistance(2F).setStepSound(Block.soundStoneFootstep);
publicstaticfinal Item LeadIngot = new Item(401).setItemName("LeadIngot");
publicstaticfinal Block Marble = new Block(3002, Material.rock).setBlockName("Marble").setHardness(2F).setResistance(3F).setStepSound(Block.soundStoneFootstep);
publicstaticfinal Item MarbleIngot = new Item(3001).setItemName("MarbleIngot");
//tools Lead
publicstaticfinal Item LeadPickaxe = new ItemLeadPickaxe(402, EnumToolMaterialLead.LEAD).setItemName("LeadPickaxe");
publicstaticfinal Item LeadAxe = new ItemLeadAxe(403, EnumToolMaterialLead.LEAD).setItemName("LeadAxe");
publicstaticfinal Item LeadSpade = new ItemLeadSpade(404, EnumToolMaterialLead.LEAD).setItemName("LeadSpade");
publicstaticfinal Item LeadHoe = new ItemLeadHoe(405, EnumToolMaterialLead.LEAD).setItemName("LeadHoe");
publicstaticfinal Item LeadSword = new ItemLeadSword(406, EnumToolMaterialLead.LEAD).setItemName("LeadSword");
//tools marble
publicstaticfinal Item MarblePickaxe = new ItemLeadPickaxe(3010, EnumToolMaterialLead.MARBLE).setItemName("MarblePickaxe");
publicstaticfinal Item MarbleAxe = new ItemLeadAxe(3011, EnumToolMaterialLead.MARBLE).setItemName("MarbleAxe");
publicstaticfinal Item MarbleSpade = new ItemLeadSpade(3012, EnumToolMaterialLead.MARBLE).setItemName("MarbleSpade");
publicstaticfinal Item MarbleHoe = new ItemLeadHoe(3013, EnumToolMaterialLead.MARBLE).setItemName("MarbleHoe");
publicstaticfinal Item MarbleSword = new ItemLeadSword(3014, EnumToolMaterialLead.MARBLE).setItemName("MarbleSword");
//food
publicstaticfinal Item CookedFlesh = new ItemFood(5001, 5, 1F, true).setItemName("CookedFlesh");
publicstaticfinal Item BoiledEgg = new ItemFood(5002, 2, 1F, false).setItemName("BoiledEgg");
//fuels
publicstaticfinal Item FireWood = new Item(1050).setItemName("FireWood");
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import java.util.List;
import org.lwjgl.input.Keyboard;
public class mod_hardwood extends BaseMod
{
public static final Block Hardwood = new BlockHardwood(160, 0).setBlockName("Hardwood").setHardness(3F).setResistance(15F).setLightValue(4F);
public static final Block Hardlog = new BlockHardlog(161, 0).setBlockName("Hardlog").setHardness(3F).setResistance(15F).setLightValue(4F);
public static int HardlogBottom = ModLoader.addOverride("/terrain.png", "/mods/hardlogtop.png");
public static int HardlogTop = ModLoader.addOverride("/terrain.png", "/mods/hardlogbottom.png");
public static int HardlogSides = ModLoader.addOverride("/terrain.png", "/mods/hardlogside.png");
public static final Block BrightTorch = new BlockBrightTorch(162,0).setBlockName("Bright Torch").setHardness(0F).setLightValue(1F).setRequiresSelfNotify();
public static final Block Rug = new BlockRugSlab(163,64).setBlockName("Rug").setHardness(3F).setResistance(3f).setLightOpacity(1);
public static final Block BlackRug = new BlockRugSlab(164,113).setBlockName("Black Rug").setHardness(3f).setResistance(3f).setLightOpacity(1);
public static final Block RedRug = new BlockRugSlab(165,129).setBlockName("Red Rug").setHardness(3F).setResistance(3f).setLightOpacity(1);
public static final Block GreenRug = new BlockRugSlab(166,145).setBlockName("Green Rug").setHardness(3f).setResistance(3f).setLightOpacity(1);
public static final Block BrownRug = new BlockRugSlab(167,161).setBlockName("Brown Rug").setHardness(3f).setResistance(3f).setLightOpacity(1);
public static final Block BlueRug = new BlockRugSlab(168,177).setBlockName("Blue Rug").setHardness(3f).setResistance(3f).setLightOpacity(1);
public static final Block PurpleRug = new BlockRugSlab(169,193).setBlockName("Purple Rug").setHardness(3f).setResistance(3f).setLightOpacity(1);
public static final Block CyanRug = new BlockRugSlab(170,209).setBlockName("Cyan Rug").setHardness(3f).setResistance(3f).setLightOpacity(1);
public static final Block LightGrayRug = new BlockRugSlab(171,225).setBlockName("Light Gray Rug").setHardness(3f).setResistance(3f).setLightOpacity(1);
public static final Block GrayRug = new BlockRugSlab(172,114).setBlockName("Gray Rug").setHardness(3f).setResistance(3f).setLightOpacity(1);
public static final Block Siding = new BlockSidingSlab(180,1).setBlockName("Siding").setHardness(3F).setResistance(3f).setLightOpacity(1);
public static final Block SidingTest = new BlockSidingTestSlab(181,1).setBlockName("SidingTest").setHardness(3F).setResistance(3f).setLightOpacity(1);
public static final Item HardwoodSword = new ItemHardwoodSword(2037, HW.HW).setItemName("sword");
public static final Item HardwoodPickaxe = new ItemHardwoodPickaxe(2038, HW.HW).setItemName("pickaxe");
public void load()
{
Hardwood.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/hardwood.png");
ModLoader.registerBlock(Hardwood);
ModLoader.addName(Hardwood, "Hardwood");
ModLoader.addSmelting(Block.planks.blockID, new ItemStack(Hardwood, 1));
ModLoader.registerBlock(Rug);
ModLoader.addName(Rug, "Rug");
ModLoader.addRecipe(new ItemStack(Rug, 16), new Object [] {"X&X","&X&","X&X", Character.valueOf('X'), Block.cloth, Character.valueOf('&'), Item.silk});
ModLoader.registerBlock(RedRug);
ModLoader.addName(RedRug, "Red Rug");
ModLoader.addRecipe(new ItemStack(RedRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,1)});
ModLoader.registerBlock(BlackRug);
ModLoader.addName(BlackRug, "Black Rug");
ModLoader.addRecipe(new ItemStack(BlackRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,0)});
ModLoader.registerBlock(GreenRug);
ModLoader.addName(GreenRug, "Green Rug");
ModLoader.addRecipe(new ItemStack(GreenRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,2)});
ModLoader.registerBlock(BrownRug);
ModLoader.addName(BrownRug, "Brown Rug");
ModLoader.addRecipe(new ItemStack(BrownRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,3)});
ModLoader.registerBlock(BlueRug);
ModLoader.addName(BlueRug, "Blue Rug");
ModLoader.addRecipe(new ItemStack(BlueRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,4)});
ModLoader.registerBlock(PurpleRug);
ModLoader.addName(PurpleRug, "Purple Rug");
ModLoader.addRecipe(new ItemStack(PurpleRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,5)});
ModLoader.registerBlock(CyanRug);
ModLoader.addName(CyanRug, "Cyan Rug");
ModLoader.addRecipe(new ItemStack(CyanRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,6)});
ModLoader.registerBlock(LightGrayRug);
ModLoader.addName(LightGrayRug, "Light Gray Rug");
ModLoader.addRecipe(new ItemStack(LightGrayRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,7)});
ModLoader.registerBlock(GrayRug);
ModLoader.addName(GrayRug, "Gray Rug");
ModLoader.addRecipe(new ItemStack(GrayRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,8)});
BrightTorch.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/brighttorch.png");
ModLoader.registerBlock(BrightTorch);
ModLoader.addName(BrightTorch, "Bright Torch");
ModLoader.addRecipe(new ItemStack(BrightTorch, 4), new Object [] {"#","@","&", Character.valueOf('#'), new ItemStack(Item.coal,1,1), Character.valueOf('@'), Item.coal, Character.valueOf('&'), Item.stick});
ModLoader.addRecipe(new ItemStack(BrightTorch, 4), new Object [] {"#","@","&", Character.valueOf('@'), new ItemStack(Item.coal,1,1), Character.valueOf('#'), Item.coal, Character.valueOf('&'), Item.stick});
ModLoader.registerBlock(Hardlog);
ModLoader.addName(Hardlog, "Hardlog");
ModLoader.addRecipe(new ItemStack(Hardwood, 4), new Object [] {"#", Character.valueOf('#'), Hardlog});
ModLoader.addRecipe(new ItemStack(Hardlog, 1), new Object [] {"##","##", Character.valueOf('#'), Hardwood});
HardwoodSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/hardwoodsword.png");
ModLoader.addName(HardwoodSword, "Hardwood Sword");
ModLoader.addRecipe(new ItemStack(HardwoodSword, 1), new Object [] {"#","#","X", Character.valueOf('#'), Hardwood, Character.valueOf('X'), Item.stick});
HardwoodPickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/hardwoodpickaxe.png");
ModLoader.addName(HardwoodPickaxe, "Hardwood Pickaxe");
ModLoader.addRecipe(new ItemStack(HardwoodPickaxe, 1), new Object [] {"###","X","X", Character.valueOf('#'), Hardwood, Character.valueOf('X'), Item.stick});
ModLoader.registerBlock(Siding);
ModLoader.addName(Siding, "Siding");
ModLoader.addRecipe(new ItemStack(Siding, 4), new Object [] {"###","###", Character.valueOf('#'), Block.stone});
ModLoader.registerBlock(SidingTest);
ModLoader.addName(SidingTest, "SidingTest");
ModLoader.addRecipe(new ItemStack(SidingTest, 4), new Object [] {"###","###", Character.valueOf('#'), Block.grass});
ModLoader.setInGameHook(this, true, false);
ModLoader.setInGUIHook(this, true, false);
}
public boolean onTickInGame(float f, Minecraft minecraft)
{
if(minecraft.currentScreen == null)
{
creativeInventory = null;
}
return true;
}
public boolean onTickInGUI(float f, Minecraft minecraft, GuiScreen guiscreen)
{
if((guiscreen instanceof GuiContainerCreative) && !(creativeInventory instanceof GuiContainerCreative) && !minecraft.theWorld.isRemote)
{
Container container = ((GuiContainer)guiscreen).inventorySlots;
List list = ((ContainerCreative)container).itemList;
int i = 0;
list.add(new ItemStack(Hardwood, 1, i));
list.add(new ItemStack(Hardlog, 1, i));
list.add(new ItemStack(BrightTorch, 1, i));
list.add(new ItemStack(Rug, 1, i));
list.add(new ItemStack(RedRug, 1, i));
}
creativeInventory = guiscreen;
return true;
}
private static GuiScreen creativeInventory;
public String getVersion()
{
return "1.2.5";
}
}
Here is my ItemHardwoodPickaxe:
package net.minecraft.src;
public class ItemHardwoodPickaxe extends ItemPickaxe
{
private static Block blocksEffectiveAgainst[];
protected ItemHardwoodPickaxe(int par1, HW par2HW)
{
super(par1, 2, par2HW, blocksEffectiveAgainst);
}
/**
* Returns if the item (tool) can harvest results from the block type.
*/
public boolean canHarvestBlock(Block par1Block)
{
if (par1Block == Block.obsidian)
{
return toolMaterial.getHarvestLevel() == 3;
}
if (par1Block == Block.blockDiamond || par1Block == Block.oreDiamond)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if (par1Block == Block.blockGold || par1Block == Block.oreGold)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if (par1Block == Block.blockSteel || par1Block == Block.oreIron)
{
return toolMaterial.getHarvestLevel() >= 1;
}
if (par1Block == Block.blockLapis || par1Block == Block.oreLapis)
{
return toolMaterial.getHarvestLevel() >= 1;
}
if (par1Block == Block.oreRedstone || par1Block == Block.oreRedstoneGlowing)
{
return toolMaterial.getHarvestLevel() >= 2;
}
if (par1Block.blockMaterial == Material.rock)
{
return true;
}
return par1Block.blockMaterial == Material.iron;
}
/**
* Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
* sword
*/
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
if (par2Block != null && (par2Block.blockMaterial == Material.iron || par2Block.blockMaterial == Material.rock))
{
return efficiencyOnProperMaterial;
}
else
{
return super.getStrVsBlock(par1ItemStack, par2Block);
}
}
static
{
blocksEffectiveAgainst = (new Block[]
{
Block.cobblestone, Block.stairDouble, Block.stairSingle, Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockSteel, Block.oreCoal, Block.blockGold,
Block.oreGold, Block.oreDiamond, Block.blockDiamond, Block.ice, Block.netherrack, Block.oreLapis, Block.blockLapis, Block.oreRedstone, Block.oreRedstoneGlowing, Block.rail,
Block.railDetector, Block.railPowered
});
}
}
And here is my enumtoolmaterial:
package net.minecraft.src;
public enum HW
{
HW(0, 600, 3F, 2, 15);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private HW(int par3, int par4, float par5, int par6, int par7)
{
harvestLevel = par3;
maxUses = par4;
efficiencyOnProperMaterial = par5;
damageVsEntity = par6;
enchantability = par7;
}
public int getMaxUses()
{
return maxUses;
}
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
public int getDamageVsEntity()
{
return damageVsEntity;
}
public int getHarvestLevel()
{
return harvestLevel;
}
public int getEnchantability()
{
return enchantability;
}
}
idk if anybody has asked this before but do you know how to animate the custom NPC models. I created a model using Techne and I want to make it so that my Hippo moves his legs like a pig does. Here's my code:
Main Mod File
package net.minecraft.src;
import java.util.Map;
public class mod_nightsmod extends BaseMod{
public void load(){
ModLoader.registerEntityID(EntityHippo.class, "Hippo", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityHippo.class, 15, 7, 12, EnumCreatureType.creature);
}
public void addRenderer(Map map){
map.put(EntityHippo.class, new RenderHippo(new ModelHippo(), 0.5F));
}
public String getVersion(){
return "1.2.5";
}
}
EntityHippo
package net.minecraft.src;
public class EntityHippo extends EntityCreature{
public EntityHippo(World world){
super(world);
texture = "/nightsmod/Mob/hippo.png";
moveSpeed = 0.2F;
isImmuneToFire = false;
}
public int getMaxHealth(){
return 80;
}
protected String getLivingSound(){
return "mob.villager.default";
}
protected String getHurtSound(){
return "mob.villager.defaulthurt";
}
protected String getDeathSound(){
return "mob.villager.defaultdeath";
}
protected int getDroppedItemId(){
return Item.leather.shiftedIndex;
}
protected boolean canDespawn(){
return false;
}
}
Also could you add/link me to a place where I can learn advanced things like how to add multiple item drops, how to make a mob spawn only in certain biomes, how to make mobs spawn only in water but move around like a land creature (good for the hippos), and finally, how to make it so that mobs spawn in day as peaceful creatures, but attack you if you attack them. (like wolves and spiders do--except I can't just use their code because they are different)
Thanks in Advance! (Great Tutorials BTW, Best I've Seen on the whole Forums/Youtube!)
idk if anybody has asked this before but do you know how to animate the custom NPC models. I created a model using Techne and I want to make it so that my Hippo moves his legs like a pig does. Here's my code:
Main Mod File
package net.minecraft.src;
import java.util.Map;
public class mod_nightsmod extends BaseMod{
public void load(){
ModLoader.registerEntityID(EntityHippo.class, "Hippo", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityHippo.class, 15, 7, 12, EnumCreatureType.creature);
}
public void addRenderer(Map map){
map.put(EntityHippo.class, new RenderHippo(new ModelHippo(), 0.5F));
}
public String getVersion(){
return "1.2.5";
}
}
EntityHippo
package net.minecraft.src;
public class EntityHippo extends EntityCreature{
public EntityHippo(World world){
super(world);
texture = "/nightsmod/Mob/hippo.png";
moveSpeed = 0.2F;
isImmuneToFire = false;
}
public int getMaxHealth(){
return 80;
}
protected String getLivingSound(){
return "mob.villager.default";
}
protected String getHurtSound(){
return "mob.villager.defaulthurt";
}
protected String getDeathSound(){
return "mob.villager.defaultdeath";
}
protected int getDroppedItemId(){
return Item.leather.shiftedIndex;
}
protected boolean canDespawn(){
return false;
}
}
Also could you add/link me to a place where I can learn advanced things like how to add multiple item drops, how to make a mob spawn only in certain biomes, how to make mobs spawn only in water but move around like a land creature (good for the hippos), and finally, how to make it so that mobs spawn in day as peaceful creatures, but attack you if you attack them. (like wolves and spiders do--except I can't just use their code because they are different)
Thanks in Advance! (Great Tutorials BTW, Best I've Seen on the whole Forums/Youtube!)
With the sudden flow of people asking for entity help, I think it wise that I learn how to make a mob soon so that I can help people in this matter. As for now, I can only guess.
My guess would be to go into a pre-existing entity class and copy some of the code. Perhaps the code about tasks. (task.addTask)
Rollback Post to RevisionRollBack
I used to maintain the Minecraft Forums Mod List. However, life has stepped in the way of that. Perhaps later...
idk if anybody has asked this before but do you know how to animate the custom NPC models. I created a model using Techne and I want to make it so that my Hippo moves his legs like a pig does. Here's my code:
Main Mod File
package net.minecraft.src;
import java.util.Map;
public class mod_nightsmod extends BaseMod{
public void load(){
ModLoader.registerEntityID(EntityHippo.class, "Hippo", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityHippo.class, 15, 7, 12, EnumCreatureType.creature);
}
public void addRenderer(Map map){
map.put(EntityHippo.class, new RenderHippo(new ModelHippo(), 0.5F));
}
public String getVersion(){
return "1.2.5";
}
}
EntityHippo
package net.minecraft.src;
public class EntityHippo extends EntityCreature{
public EntityHippo(World world){
super(world);
texture = "/nightsmod/Mob/hippo.png";
moveSpeed = 0.2F;
isImmuneToFire = false;
}
public int getMaxHealth(){
return 80;
}
protected String getLivingSound(){
return "mob.villager.default";
}
protected String getHurtSound(){
return "mob.villager.defaulthurt";
}
protected String getDeathSound(){
return "mob.villager.defaultdeath";
}
protected int getDroppedItemId(){
return Item.leather.shiftedIndex;
}
protected boolean canDespawn(){
return false;
}
}
Also could you add/link me to a place where I can learn advanced things like how to add multiple item drops, how to make a mob spawn only in certain biomes, how to make mobs spawn only in water but move around like a land creature (good for the hippos), and finally, how to make it so that mobs spawn in day as peaceful creatures, but attack you if you attack them. (like wolves and spiders do--except I can't just use their code because they are different)
Thanks in Advance! (Great Tutorials BTW, Best I've Seen on the whole Forums/Youtube!)
You need to use the setRotationAngles code.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Retired StaffHi. I think your problem is that the variables for each different block you're trying to spawn is exactly the same. So, try something similar to this:
public void GenerateSurface(World worldMod, Random rand, int i, int j) { for(int MetPlant = 0; MetPlant < 128; MetPlant++) { int MetPlantX = i + rand.nextInt(16) + 8; int MetPlantY = rand.nextInt(128); int MetPlantZ = j + rand.nextInt(16) + 8; new WorldGenFlowers(m_MetPlant.blockID, 4).generate(worldMod, rand, MetPlantX, MetPlantY, MetPlantZ); } for(int GemBlueOre = 0; GemBlueOre < 128; GemBlueOre++) { int GemBlueOreX = i + rand.nextInt(2); int GemBlueOreY = rand.nextInt(16); int GemBlueOreZ = j + rand.nextInt(2); new WorldGenMinable(m_GemBlueOre.blockID, 3).generate(worldMod, rand, GemBlueOreX, GemBlueOreY, GemBlueOreZ); } }-
View User Profile
-
View Posts
-
Send Message
Retired StaffI'll start off with this... No offense, but your code is a disaster area. In fact, I'm not sure you even glanced at TechGuy's tutorials! o.O Anyways, lets get started.
Change the .setBlockName in your CreeperOre declaration so that it doesn't have a space in it. Same with your CreeperBlock. (I'd also suggest it for all of your other items)
Like this:
public static final Block CreeperBlock = new BlockCreeperBlock(190, Material.rock).setBlockName("CreeperBlock").setHardness(1); public static final Block CreeperOre = new CreeperOre(191, Material.rock).setBlockName("CreeperOre").setHardness(1);Next, your ore doesn't have any special properties, and therefor, it doesn't need its own class. By default, it will only drop 1 when mined. And since it'll drop itself by default as well, we can delete the class. So, delete your CreeperOre class, and change your ore declaration to this:
public static final Block CreeperOre = new Block(191, Material.rock).setBlockName("CreeperOre").setHardness(1);Next, all of your textures need a / in front of their .png filename. An example:
CreeperOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/CreeperOre.png"); CreeperIngot.iconIndex = ModLoader.addOverride("/gui/items.png", "/CreeperIngot1.png" );Your recipes are not set up in the correct format, and they all seem to have an extra comma on the ends. Here's yours:
ModLoader.addRecipe(new ItemStack(CreeperBlock, 10), new Object[]{ "GGG", "GDG", "GGG", 'D', Block.dirt, 'G', Block.dirt, });Here's what it should look like:
ModLoader.addRecipe(new ItemStack(CreeperBlock, 10), new Object[]{ "GGG", "GDG", "GGG", Character.valueOf('D'), Block.dirt, Character.valueOf('G'), Block.stone });You'll need to do something similar to all of your recipes.
Another thing, your armour seems to be added right into the EnumArmorMaterial class. That means it's referencing, and probably editing, a base class. We don't cover editing base classes here. Armour also hasn't been covered in tutorials here, so I really don't know how to help you there. Please locate a different tutorial on the armour and follow it closely.
I hope I didn't miss anything. >.<
Okay my code doesnt look like that normally, when i copied and pasted it went all retarted, but i did everything else and it still doesnt work
-
View User Profile
-
View Posts
-
Send Message
Retired StaffYes, I remember.
No, all you really must do is in declaring your new material, reference each new tool to the tool classes you made before. This was why I previously suggested naming your new tools with a more general name, as you might want to reference them later with something other than lead.
Basically, there's only two things you need to do.
Firstly, you need to go into the EnumToolMaterialLead you made, and add your new material in there. In your code, it'll look something like this:
Note that after the closing parenthesis for the first material, it has a comma instead of a semicolon. The semicolon must always be placed at the end of the LAST material declared.
Secondly, you'll need to reference the tool you want to make to the respective class. Here's an example of using a previous class with the new material:
public static final Item NewPickaxe = new ItemLeadPickaxe(402, EnumToolMaterialLead.NEWMATERIAL).setItemName("NewPickaxe");Notice how it still says = new ItemLeadPickaxe andEnumToolMaterialLead. That's because it's the name of your custom pickaxe class. The class itself makes no reference to the LEAD material type, so it's safe to reference it again with your new pickaxe. Same will go for your other new tools. And obviously, you still need to reference your custom EnumToolMaterialLead class, because it doesn't only contain lead.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffNo problem at all.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffIt's okay. If it messed up during copy, then there's nothing you can do about that. Thanks for not taking offense though.
Sadly, I have no idea what could be causing it to not work when attempting to pick it up. I'm very sorry.
-
View User Profile
-
View Posts
-
Send Message
Retired StaffGood job!
-
View User Profile
-
View Posts
-
Send Message
Retired StaffHmm. Well, there are a few things that could be changed... I'll explain some. I've posted comments in the code.
for(int MetPlant = 0; MetPlant < 128; MetPlant++) /*The 128 here represents how rare your ore is. The higher the number, the less rare.*/ { int MetPlantX = i + rand.nextInt(16); /*the 16 in this line (X) as well as 2 lines down (Z) regard placement in chunks.*/ int MetPlantY = rand.nextInt(128); /*The 128 here represents how high up from the bedrock it can spawn*/ int MetPlantZ = j + rand.nextInt(16); new WorldGenFlowers(m_MetPlant.blockID, 5).generate(worldMod, rand, MetPlantX, MetPlantY, MetPlantZ); /*the 5 in this line represents up to how many you'll find per vein*/ }Anyways, I'd suggest making all of the numbers in parenthesis within lines X and Z 16. The size of a full chunk is 16x16, so if they're all set to 16, it means it can spawn in any X and Z coordinates. Also, make sure you have a number after your .blockID, because if you don't, you won't find any at all. These go for ores and flowers I believe.
EDIT: I also believe that the 'g' in public void GenerateSurface needs to be lower-case. So change it to
java.lang.ArrayIndexOutOfBoundsException: 1030
at net.minecraft.src.ModLoader.initStats(ModLoader.java:905)
at net.minecraft.src.ModLoader.init(ModLoader.java:878)
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)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:424)
at net.minecraft.client.Minecraft.run(Minecraft.java:786)
at java.lang.Thread.run(Thread.java:722)
--- END ERROR REPORT 88314099 ----------
Code:
package
net.minecraft.src;
import
java.util.Random;
public
class mod_tutorials extends BaseMod{
public static final Block Lead = new Block(200, Material.rock).setBlockName("Lead").setHardness(1F).setResistance(2F).setStepSound(Block.soundStoneFootstep);
public static final Item LeadIngot = new Item(401).setItemName("LeadIngot");
public static final Block Marble = new Block(3002, Material.rock).setBlockName("Marble").setHardness(2F).setResistance(3F).setStepSound(Block.soundStoneFootstep);
public static final Item MarbleIngot = new Item(3001).setItemName("MarbleIngot");
//tools Lead
public static final Item LeadPickaxe = new ItemLeadPickaxe(402, EnumToolMaterialLead.LEAD).setItemName("LeadPickaxe");
public static final Item LeadAxe = new ItemLeadAxe(403, EnumToolMaterialLead.LEAD).setItemName("LeadAxe");
public static final Item LeadSpade = new ItemLeadSpade(404, EnumToolMaterialLead.LEAD).setItemName("LeadSpade");
public static final Item LeadHoe = new ItemLeadHoe(405, EnumToolMaterialLead.LEAD).setItemName("LeadHoe");
public static final Item LeadSword = new ItemLeadSword(406, EnumToolMaterialLead.LEAD).setItemName("LeadSword");
//tools marble
public static final Item MarblePickaxe = new ItemLeadPickaxe(3010, EnumToolMaterialLead.MARBLE).setItemName("MarblePickaxe");
public static final Item MarbleAxe = new ItemLeadAxe(3011, EnumToolMaterialLead.MARBLE).setItemName("MarbleAxe");
public static final Item MarbleSpade = new ItemLeadSpade(3012, EnumToolMaterialLead.MARBLE).setItemName("MarbleSpade");
public static final Item MarbleHoe = new ItemLeadHoe(3013, EnumToolMaterialLead.MARBLE).setItemName("MarbleHoe");
public static final Item MarbleSword = new ItemLeadSword(3014, EnumToolMaterialLead.MARBLE).setItemName("MarbleSword");
//food
public static final Item CookedFlesh = new ItemFood(5001, 5, 1F, true).setItemName("CookedFlesh");
public static final Item BoiledEgg = new ItemFood(5002, 2, 1F, false).setItemName("BoiledEgg");
//fuels
public static final Item FireWood = new Item(1050).setItemName("FireWood");
public void load(){
//Block Lead
Lead.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/LeadOre.png");
ModLoader.registerBlock(
Lead);
ModLoader.addName(
Lead, "Lead Ore");
//Item LeadIngot
LeadIngot.iconIndex = ModLoader.addOverride("/gui/items.png", "/LeadIngot.png");
ModLoader.addName(
LeadIngot, "Lead Ingot");
ModLoader.addSmelting(
Lead.blockID, new ItemStack(LeadIngot, 1));
//Block Marble
Marble.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MarbleOre.png");
ModLoader.registerBlock(
Marble);
ModLoader.addName(
Marble, "Marble Ore");
// Item Marble Ingot
MarbleIngot.iconIndex = ModLoader.addOverride("/gui/items.png", "/MarbleIngot.png");
ModLoader.addName(
MarbleIngot, "Marble Ingot");
ModLoader.addSmelting(
Marble.blockID, new ItemStack(MarbleIngot, 1));
//food
CookedFlesh.iconIndex = ModLoader.addOverride("/gui/items.png", "/CookedFlesh.png");
ModLoader.addName(
CookedFlesh, "Cooked Flesh");
ModLoader.addSmelting(Item.rottenFlesh.shiftedIndex,
new ItemStack(CookedFlesh, 1));
BoiledEgg.iconIndex = ModLoader.addOverride("/gui/items.png", "/BoiledEgg.png");
ModLoader.addName(
BoiledEgg, "Boiled Egg");
ModLoader.addSmelting(Item.egg.shiftedIndex,
new ItemStack(BoiledEgg, 1));
//fuels
FireWood.iconIndex = ModLoader.addOverride("/gui/items.png", "/FireWood.png");
ModLoader.addName(
FireWood, "Fire Wood");
ModLoader.addRecipe(
new ItemStack(FireWood, 2), new Object[]{
" @ ", " # ", " ", Character.valueOf('@'), Block.wood, Character.valueOf('#'), Item.coal
});
//tools Lead
LeadPickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/PbPickaxe.png");
ModLoader.addName(
LeadPickaxe, "Lead Pick");
ModLoader.addRecipe(
new ItemStack(LeadPickaxe, 1), new Object[]{
"###", " @ ", " @ ", Character.valueOf('#'), LeadIngot, Character.valueOf('@'), Item.stick
});
LeadAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/PbAxe.png");
ModLoader.addName(
LeadAxe, "Lead Axe");
ModLoader.addRecipe(
new ItemStack(LeadAxe, 1), new Object[]{
"## ", "#@ ", " @ ", Character.valueOf('#'), LeadIngot, Character.valueOf('@'), Item.stick
});
LeadSpade.iconIndex = ModLoader.addOverride("/gui/items.png", "/PbSpade.png");
ModLoader.addName(
LeadSpade, "Lead Spade");
ModLoader.addRecipe(
new ItemStack(LeadSpade, 1), new Object[]{
" # ", " @ ", " @ ", Character.valueOf('#'), LeadIngot, Character.valueOf('@'), Item.stick
});
LeadHoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/PbHoe.png");
ModLoader.addName(
LeadHoe, "Lead Hoe");
ModLoader.addRecipe(
new ItemStack(LeadHoe, 1), new Object[]{
"## ", " @ ", " @ ", Character.valueOf('#'), LeadIngot, Character.valueOf('@'), Item.stick
});
LeadSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/PbSword.png");
ModLoader.addName(
LeadSword, "Lead Sword");
ModLoader.addRecipe(
new ItemStack(LeadSword, 1), new Object[]{
" # ", " # ", " @ ", Character.valueOf('#'), LeadIngot, Character.valueOf('@'), Item.stick
});
//tools marble
MarblePickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/MarblePickaxe.png");
ModLoader.addName(
MarblePickaxe, "Marble Pick");
ModLoader.addRecipe(
new ItemStack(MarblePickaxe, 1), new Object[]{
"###", " @ ", " @ ", Character.valueOf('#'), MarbleIngot, Character.valueOf('@'), Item.stick
});
MarbleAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/MarbleAxe.png");
ModLoader.addName(
MarbleAxe, "Marble Axe");
ModLoader.addRecipe(
new ItemStack(MarbleAxe, 1), new Object[]{
"## ", "#@ ", " @ ", Character.valueOf('#'), MarbleIngot, Character.valueOf('@'), Item.stick
});
MarbleSpade.iconIndex = ModLoader.addOverride("/gui/items.png", "/MarbleSpade.png");
ModLoader.addName(
MarbleSpade, "Marble Spade");
ModLoader.addRecipe(
new ItemStack(MarbleSpade, 1), new Object[]{
" # ", " @ ", " @ ", Character.valueOf('#'), MarbleIngot, Character.valueOf('@'), Item.stick
});
MarbleHoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/MarbleHoe.png");
ModLoader.addName(
MarbleHoe, "Marble Hoe");
ModLoader.addRecipe(
new ItemStack(MarbleHoe, 1), new Object[]{
"## ", " @ ", " @ ", Character.valueOf('#'), MarbleIngot, Character.valueOf('@'), Item.stick
});
MarbleSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/MarbleSword.png");
ModLoader.addName(
MarbleSword, "Marble Sword");
ModLoader.addRecipe(
new ItemStack(MarbleSword, 1), new Object[]{
" # ", " # ", " @ ", Character.valueOf('#'), MarbleIngot, Character.valueOf('@'), Item.stick
});
}
public int addFuel (int k, int l)
{
if(k == FireWood.shiftedIndex)
return 1000;
return 0;
}
public void generateSurface(World world, Random random, int i, int j){
for(int rarity = 0; rarity < 6; rarity++){
int X = i + random.nextInt(16);
int Y = random.nextInt(64);
int Z = j + random.nextInt(16);
(
new WorldGenMinable(Lead.blockID, 12)).generate(world, random, X, Y, Z);
(
new WorldGenMinable(Marble.blockID, 12)).generate(world, random, X, Y, Z);
}
}
public String getVersion(){
return "this is an awesome mod v1.1";
}
}
I tried messing with the ID's but it didnt work, so what is causing this problem?
Alright I understand.
I'm having an issue on the pickaxe on this part:
protected ItemHardwoodPickaxe(int par1, HW par2HW) { super(par1, 2, par2HW, blocksEffectiveAgainst); }Here is my code:
mod_hardwood
package net.minecraft.src; import net.minecraft.client.Minecraft; import java.util.List; import org.lwjgl.input.Keyboard; public class mod_hardwood extends BaseMod { public static final Block Hardwood = new BlockHardwood(160, 0).setBlockName("Hardwood").setHardness(3F).setResistance(15F).setLightValue(4F); public static final Block Hardlog = new BlockHardlog(161, 0).setBlockName("Hardlog").setHardness(3F).setResistance(15F).setLightValue(4F); public static int HardlogBottom = ModLoader.addOverride("/terrain.png", "/mods/hardlogtop.png"); public static int HardlogTop = ModLoader.addOverride("/terrain.png", "/mods/hardlogbottom.png"); public static int HardlogSides = ModLoader.addOverride("/terrain.png", "/mods/hardlogside.png"); public static final Block BrightTorch = new BlockBrightTorch(162,0).setBlockName("Bright Torch").setHardness(0F).setLightValue(1F).setRequiresSelfNotify(); public static final Block Rug = new BlockRugSlab(163,64).setBlockName("Rug").setHardness(3F).setResistance(3f).setLightOpacity(1); public static final Block BlackRug = new BlockRugSlab(164,113).setBlockName("Black Rug").setHardness(3f).setResistance(3f).setLightOpacity(1); public static final Block RedRug = new BlockRugSlab(165,129).setBlockName("Red Rug").setHardness(3F).setResistance(3f).setLightOpacity(1); public static final Block GreenRug = new BlockRugSlab(166,145).setBlockName("Green Rug").setHardness(3f).setResistance(3f).setLightOpacity(1); public static final Block BrownRug = new BlockRugSlab(167,161).setBlockName("Brown Rug").setHardness(3f).setResistance(3f).setLightOpacity(1); public static final Block BlueRug = new BlockRugSlab(168,177).setBlockName("Blue Rug").setHardness(3f).setResistance(3f).setLightOpacity(1); public static final Block PurpleRug = new BlockRugSlab(169,193).setBlockName("Purple Rug").setHardness(3f).setResistance(3f).setLightOpacity(1); public static final Block CyanRug = new BlockRugSlab(170,209).setBlockName("Cyan Rug").setHardness(3f).setResistance(3f).setLightOpacity(1); public static final Block LightGrayRug = new BlockRugSlab(171,225).setBlockName("Light Gray Rug").setHardness(3f).setResistance(3f).setLightOpacity(1); public static final Block GrayRug = new BlockRugSlab(172,114).setBlockName("Gray Rug").setHardness(3f).setResistance(3f).setLightOpacity(1); public static final Block Siding = new BlockSidingSlab(180,1).setBlockName("Siding").setHardness(3F).setResistance(3f).setLightOpacity(1); public static final Block SidingTest = new BlockSidingTestSlab(181,1).setBlockName("SidingTest").setHardness(3F).setResistance(3f).setLightOpacity(1); public static final Item HardwoodSword = new ItemHardwoodSword(2037, HW.HW).setItemName("sword"); public static final Item HardwoodPickaxe = new ItemHardwoodPickaxe(2038, HW.HW).setItemName("pickaxe"); public void load() { Hardwood.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/hardwood.png"); ModLoader.registerBlock(Hardwood); ModLoader.addName(Hardwood, "Hardwood"); ModLoader.addSmelting(Block.planks.blockID, new ItemStack(Hardwood, 1)); ModLoader.registerBlock(Rug); ModLoader.addName(Rug, "Rug"); ModLoader.addRecipe(new ItemStack(Rug, 16), new Object [] {"X&X","&X&","X&X", Character.valueOf('X'), Block.cloth, Character.valueOf('&'), Item.silk}); ModLoader.registerBlock(RedRug); ModLoader.addName(RedRug, "Red Rug"); ModLoader.addRecipe(new ItemStack(RedRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,1)}); ModLoader.registerBlock(BlackRug); ModLoader.addName(BlackRug, "Black Rug"); ModLoader.addRecipe(new ItemStack(BlackRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,0)}); ModLoader.registerBlock(GreenRug); ModLoader.addName(GreenRug, "Green Rug"); ModLoader.addRecipe(new ItemStack(GreenRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,2)}); ModLoader.registerBlock(BrownRug); ModLoader.addName(BrownRug, "Brown Rug"); ModLoader.addRecipe(new ItemStack(BrownRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,3)}); ModLoader.registerBlock(BlueRug); ModLoader.addName(BlueRug, "Blue Rug"); ModLoader.addRecipe(new ItemStack(BlueRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,4)}); ModLoader.registerBlock(PurpleRug); ModLoader.addName(PurpleRug, "Purple Rug"); ModLoader.addRecipe(new ItemStack(PurpleRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,5)}); ModLoader.registerBlock(CyanRug); ModLoader.addName(CyanRug, "Cyan Rug"); ModLoader.addRecipe(new ItemStack(CyanRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,6)}); ModLoader.registerBlock(LightGrayRug); ModLoader.addName(LightGrayRug, "Light Gray Rug"); ModLoader.addRecipe(new ItemStack(LightGrayRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,7)}); ModLoader.registerBlock(GrayRug); ModLoader.addName(GrayRug, "Gray Rug"); ModLoader.addRecipe(new ItemStack(GrayRug, 16), new Object [] {"&","X", Character.valueOf('X'), Rug, Character.valueOf('&'), new ItemStack(Item.dyePowder,1,8)}); BrightTorch.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/mods/brighttorch.png"); ModLoader.registerBlock(BrightTorch); ModLoader.addName(BrightTorch, "Bright Torch"); ModLoader.addRecipe(new ItemStack(BrightTorch, 4), new Object [] {"#","@","&", Character.valueOf('#'), new ItemStack(Item.coal,1,1), Character.valueOf('@'), Item.coal, Character.valueOf('&'), Item.stick}); ModLoader.addRecipe(new ItemStack(BrightTorch, 4), new Object [] {"#","@","&", Character.valueOf('@'), new ItemStack(Item.coal,1,1), Character.valueOf('#'), Item.coal, Character.valueOf('&'), Item.stick}); ModLoader.registerBlock(Hardlog); ModLoader.addName(Hardlog, "Hardlog"); ModLoader.addRecipe(new ItemStack(Hardwood, 4), new Object [] {"#", Character.valueOf('#'), Hardlog}); ModLoader.addRecipe(new ItemStack(Hardlog, 1), new Object [] {"##","##", Character.valueOf('#'), Hardwood}); HardwoodSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/hardwoodsword.png"); ModLoader.addName(HardwoodSword, "Hardwood Sword"); ModLoader.addRecipe(new ItemStack(HardwoodSword, 1), new Object [] {"#","#","X", Character.valueOf('#'), Hardwood, Character.valueOf('X'), Item.stick}); HardwoodPickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/mods/hardwoodpickaxe.png"); ModLoader.addName(HardwoodPickaxe, "Hardwood Pickaxe"); ModLoader.addRecipe(new ItemStack(HardwoodPickaxe, 1), new Object [] {"###","X","X", Character.valueOf('#'), Hardwood, Character.valueOf('X'), Item.stick}); ModLoader.registerBlock(Siding); ModLoader.addName(Siding, "Siding"); ModLoader.addRecipe(new ItemStack(Siding, 4), new Object [] {"###","###", Character.valueOf('#'), Block.stone}); ModLoader.registerBlock(SidingTest); ModLoader.addName(SidingTest, "SidingTest"); ModLoader.addRecipe(new ItemStack(SidingTest, 4), new Object [] {"###","###", Character.valueOf('#'), Block.grass}); ModLoader.setInGameHook(this, true, false); ModLoader.setInGUIHook(this, true, false); } public boolean onTickInGame(float f, Minecraft minecraft) { if(minecraft.currentScreen == null) { creativeInventory = null; } return true; } public boolean onTickInGUI(float f, Minecraft minecraft, GuiScreen guiscreen) { if((guiscreen instanceof GuiContainerCreative) && !(creativeInventory instanceof GuiContainerCreative) && !minecraft.theWorld.isRemote) { Container container = ((GuiContainer)guiscreen).inventorySlots; List list = ((ContainerCreative)container).itemList; int i = 0; list.add(new ItemStack(Hardwood, 1, i)); list.add(new ItemStack(Hardlog, 1, i)); list.add(new ItemStack(BrightTorch, 1, i)); list.add(new ItemStack(Rug, 1, i)); list.add(new ItemStack(RedRug, 1, i)); } creativeInventory = guiscreen; return true; } private static GuiScreen creativeInventory; public String getVersion() { return "1.2.5"; } }package net.minecraft.src; public class ItemHardwoodPickaxe extends ItemPickaxe { private static Block blocksEffectiveAgainst[]; protected ItemHardwoodPickaxe(int par1, HW par2HW) { super(par1, 2, par2HW, blocksEffectiveAgainst); } /** * Returns if the item (tool) can harvest results from the block type. */ public boolean canHarvestBlock(Block par1Block) { if (par1Block == Block.obsidian) { return toolMaterial.getHarvestLevel() == 3; } if (par1Block == Block.blockDiamond || par1Block == Block.oreDiamond) { return toolMaterial.getHarvestLevel() >= 2; } if (par1Block == Block.blockGold || par1Block == Block.oreGold) { return toolMaterial.getHarvestLevel() >= 2; } if (par1Block == Block.blockSteel || par1Block == Block.oreIron) { return toolMaterial.getHarvestLevel() >= 1; } if (par1Block == Block.blockLapis || par1Block == Block.oreLapis) { return toolMaterial.getHarvestLevel() >= 1; } if (par1Block == Block.oreRedstone || par1Block == Block.oreRedstoneGlowing) { return toolMaterial.getHarvestLevel() >= 2; } if (par1Block.blockMaterial == Material.rock) { return true; } return par1Block.blockMaterial == Material.iron; } /** * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if * sword */ public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) { if (par2Block != null && (par2Block.blockMaterial == Material.iron || par2Block.blockMaterial == Material.rock)) { return efficiencyOnProperMaterial; } else { return super.getStrVsBlock(par1ItemStack, par2Block); } } static { blocksEffectiveAgainst = (new Block[] { Block.cobblestone, Block.stairDouble, Block.stairSingle, Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockSteel, Block.oreCoal, Block.blockGold, Block.oreGold, Block.oreDiamond, Block.blockDiamond, Block.ice, Block.netherrack, Block.oreLapis, Block.blockLapis, Block.oreRedstone, Block.oreRedstoneGlowing, Block.rail, Block.railDetector, Block.railPowered }); } }package net.minecraft.src; public enum HW { HW(0, 600, 3F, 2, 15); private final int harvestLevel; private final int maxUses; private final float efficiencyOnProperMaterial; private final int damageVsEntity; private final int enchantability; private HW(int par3, int par4, float par5, int par6, int par7) { harvestLevel = par3; maxUses = par4; efficiencyOnProperMaterial = par5; damageVsEntity = par6; enchantability = par7; } public int getMaxUses() { return maxUses; } public float getEfficiencyOnProperMaterial() { return efficiencyOnProperMaterial; } public int getDamageVsEntity() { return damageVsEntity; } public int getHarvestLevel() { return harvestLevel; } public int getEnchantability() { return enchantability; } }Main Mod File
package net.minecraft.src; import java.util.Map; public class mod_nightsmod extends BaseMod{ public void load(){ ModLoader.registerEntityID(EntityHippo.class, "Hippo", ModLoader.getUniqueEntityId()); ModLoader.addSpawn(EntityHippo.class, 15, 7, 12, EnumCreatureType.creature); } public void addRenderer(Map map){ map.put(EntityHippo.class, new RenderHippo(new ModelHippo(), 0.5F)); } public String getVersion(){ return "1.2.5"; } }EntityHippo
package net.minecraft.src; public class EntityHippo extends EntityCreature{ public EntityHippo(World world){ super(world); texture = "/nightsmod/Mob/hippo.png"; moveSpeed = 0.2F; isImmuneToFire = false; } public int getMaxHealth(){ return 80; } protected String getLivingSound(){ return "mob.villager.default"; } protected String getHurtSound(){ return "mob.villager.defaulthurt"; } protected String getDeathSound(){ return "mob.villager.defaultdeath"; } protected int getDroppedItemId(){ return Item.leather.shiftedIndex; } protected boolean canDespawn(){ return false; } }Model Hippo
package net.minecraft.src; public class ModelHippo extends ModelBase{ ModelRenderer Head; ModelRenderer Leg; ModelRenderer Body; ModelRenderer Leg2; ModelRenderer Leg4; ModelRenderer Leg3; public ModelHippo(){ textureWidth = 128; textureHeight = 64; Head = new ModelRenderer(this, 84, 20); Head.addBox(0F, 0F, 0F, 11, 10, 10); Head.setRotationPoint(-5F, 2F, -23F); Head.setTextureSize(128, 64); Head.mirror = true; setRotation(Head, 0F, 0F, 0F); Leg = new ModelRenderer(this, 56, 40); Leg.addBox(0F, 0F, 0F, 7, 9, 7); Leg.setRotationPoint(2F, 15F, 4F); Leg.setTextureSize(128, 64); Leg.mirror = true; setRotation(Leg, 0F, 0F, 0F); Body = new ModelRenderer(this, 0, 0); Body.addBox(0F, 0F, 0F, 17, 15, 25); Body.setRotationPoint(-8F, 0F, -13F); Body.setTextureSize(128, 64); Body.mirror = true; setRotation(Body, 0F, 0F, 0F); Leg2 = new ModelRenderer(this, 28, 40); Leg2.addBox(0F, 0F, 0F, 7, 9, 7); Leg2.setRotationPoint(-8F, 15F, 4F); Leg2.setTextureSize(128, 64); Leg2.mirror = true; setRotation(Leg2, 0F, 0F, 0F); Leg4 = new ModelRenderer(this, 0, 40); Leg4.addBox(0F, 0F, 0F, 7, 9, 7); Leg4.setRotationPoint(-8F, 15F, -12F); Leg4.setTextureSize(128, 64); Leg4.mirror = true; setRotation(Leg4, 0F, 0F, 0F); Leg3 = new ModelRenderer(this, 84, 40); Leg3.addBox(0F, 0F, 0F, 7, 9, 7); Leg3.setRotationPoint(2F, 15F, -12F); Leg3.setTextureSize(128, 64); Leg3.mirror = true; setRotation(Leg3, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5){ super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5); Head.render(f5); Leg.render(f5); Body.render(f5); Leg2.render(f5); Leg4.render(f5); Leg3.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z){ model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5){ super.setRotationAngles(f, f1, f2, f3, f4, f5); } }RenderHippo
package net.minecraft.src; public class RenderHippo extends RenderLiving{ protected ModelHippo modelHippoMain; protected float field_40296_d; public RenderHippo(ModelHippo par1ModelHippo, float par2){ this(par1ModelHippo, par2, 1.0F); modelHippoMain = par1ModelHippo; } public RenderHippo(ModelHippo par1ModelHippo, float par2, float par3){ super(par1ModelHippo, par2); modelHippoMain = par1ModelHippo; field_40296_d = par3; } }Also could you add/link me to a place where I can learn advanced things like how to add multiple item drops, how to make a mob spawn only in certain biomes, how to make mobs spawn only in water but move around like a land creature (good for the hippos), and finally, how to make it so that mobs spawn in day as peaceful creatures, but attack you if you attack them. (like wolves and spiders do--except I can't just use their code because they are different)
Thanks in Advance! (Great Tutorials BTW, Best I've Seen on the whole Forums/Youtube!)
-
View User Profile
-
View Posts
-
Send Message
Retired StaffWith the sudden flow of people asking for entity help, I think it wise that I learn how to make a mob soon so that I can help people in this matter. As for now, I can only guess.
My guess would be to go into a pre-existing entity class and copy some of the code. Perhaps the code about tasks. (task.addTask)
You need to use the setRotationAngles code.
together they are powerful beyond imagination."