June 10, 201312 yr Hello, I've been working on my mod and ran into some problems. Anything that is glowing in red shows an error in the code. package SoldierW518.Soldiers_Mod; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockOre; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class IridiumOre extends BlockOre { public IridiumOre (int id, int texture, Material material) { [glow=red,2,300]super(id, texture, material);[/glow] setHardness(5.0F); setStepSound(Block.soundStoneFootstep); [glow=red,2,300]setBlockName[/glow]("iridiumOre"); setCreativeTab(CreativeTabs.tabBlock); } @Override public String [glow=red,2,300]getTextureFile()[/glow] { return CommonProxy.BLOCK_PNG; } public int idDropped(int par1, Random random, int par2) { return Soldiers_Mod.iridiumOre.blockID; } } Any suggestions would be very helpful and feel free to leave them down below! Thanks for any help and for reading, - Justin (SoldierW518)
June 10, 201312 yr BlockOre doesn't have such a constructor, and furthermore, that texture system is horribly outdated. http://www.minecraftforge.net/wiki/Tutorials BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 10, 201312 yr Use this one... (please read, not copy) package MyMod.blocks; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Icon; import net.minecraft.world.World; import MyMod.Main; public class BlockOre extends Block { public BlockOre (int id, Material material, String Unlocalized) { super(id, material); setCreativeTab(CreativeTabs.tabBlock); setStepSound(Block.soundMetalFootstep); setUnlocalizedName(Unlocalized); } public int idDropped (int par1, Random random, int par2) { return this.blockID; } @SideOnly(Side.CLIENT) public Icon getIcon(int par1, int par2) { return this.blockIcon; } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { blockIcon = iconRegister.registerIcon("MyMod:" + getUnlocalizedName().replace("tile.", "")); } } This one: blockIcon = iconRegister.registerIcon("MyMod:" + getUnlocalizedName().replace("tile.", "")); Will call for /minecarft.jar/mods/MyMod/textures/blocks/Unlocalized.png Where unlocalized is your String. .replace("tile.", "") - and yes, this is needed. 1.7.10 is no longer supported by forge, you are on your own.
June 10, 201312 yr Author So I was looking through your code and I came up with this. public IridiumOre (int id, Material material, String IridiumOre) { super(id, material); setCreativeTab(CreativeTabs.tabBlock); setStepSound(Block.soundStoneFootstep); setUnlocalizedName("IridiumOre"); } Because by the looks of it I could just change the String Variable and that would allow me to use a IridiumOre.png
June 10, 201312 yr Use this one... (please read, not copy) package MyMod.blocks; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Icon; import net.minecraft.world.World; import MyMod.Main; public class BlockOre extends Block { public BlockOre (int id, Material material, String Unlocalized) { super(id, material); setCreativeTab(CreativeTabs.tabBlock); setStepSound(Block.soundMetalFootstep); setUnlocalizedName(Unlocalized); } public int idDropped (int par1, Random random, int par2) { return this.blockID; } @SideOnly(Side.CLIENT) public Icon getIcon(int par1, int par2) { return this.blockIcon; } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { blockIcon = iconRegister.registerIcon("MyMod:" + getUnlocalizedName().replace("tile.", "")); } } This one: blockIcon = iconRegister.registerIcon("MyMod:" + getUnlocalizedName().replace("tile.", "")); Will call for /minecarft.jar/mods/MyMod/textures/blocks/Unlocalized.png Where unlocalized is your String. .replace("tile.", "") - and yes, this is needed. It's easier if you use getUnlocalizedName2(); that doesn't have the "tile." BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 10, 201312 yr as far as i know you need to delete the material constructor for ores http://i.imgur.com/sKDS7bj.png[/img] http://www.minecraftforum.net/topic/1877292-15x-forge-smp-nightmarecraft-alpha-10-it-started-with-a-dream-new/
June 10, 201312 yr As far as i know, no you don't public Block(int par1, Material par2Material) { } Or maybe there has been changes on 1.5.2? because i am using 1.5.1 (No need to update, will when I'm finished or if I would really need something). As to you Soldier - do you even know how constructors work? Ok man, look: You got my code, so you just leave it. Copy to BlockOre.class (or something) Next go to the MainMod.class and write this: public static final Block IridiumOre = new BlockOre(1000, Material.rock, "IridiumOre"); //1 - ID, 2 - Material, 3 - Unlocalized name Now you just need to register block and add IngameName (which you can also do in BlockOre.class by adding more code of course). ObsequiousNewt - thanks pal, didn't noticed that, but in BlockOre I personally wont use it (but in other yes) 1.7.10 is no longer supported by forge, you are on your own.
June 10, 201312 yr As far as i know, no you don't public Block(int par1, Material par2Material) { } Or maybe there has been changes on 1.5.2? because i am using 1.5.1 (No need to update, will when I'm finished or if I would really need something). Block takes a Material argument. BlockOre doesn't—it's preset to Material.rock. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.