Posted October 12, 201311 yr Hey, I'm having a lot of problems with textures right now, so lets get right into it. I made a block called textureTestBlock. I used the registerIcon method. The missing texture appears. Here is where I put my texture:- C:/Users/*****/Desktop/forge/mcp/src/minecraft/assets/ablazethebest_tutorialmod/textures/blocks/textureTestBlock.png In the log, here is what appears pertaining to that block and its texture 2013-10-12 10:17:44 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_503_textureTestBlock.png Here is the necessary code:- My main file (Tutorial.java, as I'm still learning ):- package tutorial; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import tutorial.blocks.BlockChainTnt; import tutorial.blocks.BlockFallBright; import tutorial.blocks.BlockObsidianDoor; import tutorial.blocks.BlockTextureTest; import tutorial.blocks.BlockUnknownTnt; import tutorial.crafting.TutorialCrafter; import tutorial.items.DiamondMagicalDiamond; import tutorial.items.WandMagicTnt; import tutorial.weapons.WeaponDeadBow; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid = Tutorial.modid, name = "Tutorial Mod", version = "1.0") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class Tutorial { public static final String modid = "AblazeTheBest_TutorialMod"; //public static Block fallBright; public static Block chainTnt; public static Block unknownTnt; public static Block textureTestBlock; //public static Item deadBow; public static Item magicTntWand; public static Item magicalDiamond; @EventHandler public void load(FMLInitializationEvent event){ //fallBright = new BlockFallBright(500, Material.sand).setUnlocalizedName("fallBright"); chainTnt = new BlockChainTnt(501).setUnlocalizedName("chainTnt"); unknownTnt = new BlockUnknownTnt(502).setUnlocalizedName("unknownTnt"); textureTestBlock = new BlockTextureTest(503, Material.rock).setUnlocalizedName("textureTestBlock"); //deadBow = new WeaponDeadBow(5001).setUnlocalizedName("deadBow"); magicTntWand = new WandMagicTnt(5002).setUnlocalizedName("magicTntWand"); magicalDiamond = new DiamondMagicalDiamond(5003).setUnlocalizedName("magicalDiamond"); //GameRegistry.registerBlock(fallBright, "fallBright"); GameRegistry.registerBlock(chainTnt, Tutorial.modid + (chainTnt.getUnlocalizedName().substring(5))); GameRegistry.registerBlock(unknownTnt, Tutorial.modid + (unknownTnt.getUnlocalizedName().substring(5))); GameRegistry.registerBlock(textureTestBlock, Tutorial.modid + (textureTestBlock.getUnlocalizedName().substring(5))); //GameRegistry.registerItem(deadBow, Tutorial.modid + (deadBow.getUnlocalizedName().substring(5))); GameRegistry.registerItem(magicTntWand, Tutorial.modid + (magicTntWand.getUnlocalizedName().substring(5))); GameRegistry.registerItem(magicalDiamond, Tutorial.modid + (magicalDiamond.getUnlocalizedName().substring(5))); //LanguageRegistry.addName(fallBright, "Fall Bright"); LanguageRegistry.addName(chainTnt, "Chain TNT"); LanguageRegistry.addName(unknownTnt, "Unknown TNT"); LanguageRegistry.addName(textureTestBlock, "Texture Test Block"); //LanguageRegistry.addName(deadBow, "Dead Bow"); LanguageRegistry.addName(magicTntWand, "Magical TNT Wand"); LanguageRegistry.addName(magicalDiamond, "Magical Diamond"); TutorialCrafter.loadRecipies(); } } BlockTextureTest.java:- package tutorial.blocks; import tutorial.Tutorial; 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; public class BlockTextureTest extends Block{ public BlockTextureTest(int par1, Material par2Material) { super(par1, par2Material); this.setCreativeTab(CreativeTabs.tabBlock); } @SideOnly(Side.CLIENT) public void registerIcon(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon(Tutorial.modid + ":" + (this.getUnlocalizedName().substring(5))); } } Problem 2: I don't know how to put this, but try to understand. If you saw in Tutorial.java, there is a block called chainTnt. Wait, wait don't start scrolling up. Listen. As you guys know, there are three textures required for that, because it extends BlockTNT. Now have a look at the BlockChainTnt.java code:- package tutorial.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import tutorial.Tutorial; import net.minecraft.block.BlockTNT; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.util.Icon; import net.minecraft.world.World; public class BlockChainTnt extends BlockTNT{ @SideOnly(Side.CLIENT) private Icon field_94393_a; @SideOnly(Side.CLIENT) private Icon field_94392_b; //Constructor public BlockChainTnt(int par1) { super(par1); this.setCreativeTab(CreativeTabs.tabBlock); } //Handles all right click events public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { int nextTo1 = par1World.getBlockId(par2 + 1, par3, par4); int nextTo2 = par1World.getBlockId(par2 + 2, par3, par4); int nextTo3 = par1World.getBlockId(par2 - 1, par3, par4); int nextTo4 = par1World.getBlockId(par2, par3 - 1, par4); int nextTo5 = par1World.getBlockId(par2, par3, par4 + 1); int nextTo6 = par1World.getBlockId(par2, par3, par4 - 1); if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().itemID == Item.flintAndSteel.itemID) { this.func_94391_a(par1World, par2, par3, par4, 1, par5EntityPlayer); par1World.setBlockToAir(par2, par3, par4); par5EntityPlayer.getCurrentEquippedItem().damageItem(1, par5EntityPlayer); return true; } else if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().itemID == Tutorial.magicTntWand.itemID) { this.func_94391_a(par1World, par2, par3, par4, 1, par5EntityPlayer); if (nextTo1 == this.blockID && nextTo2 == this.blockID && nextTo3 == this.blockID && nextTo4 == this.blockID && nextTo5 == this.blockID && nextTo6 == this.blockID){ this.func_94391_a(par1World, par2 + 1, par3, par4, 1, par5EntityPlayer); this.func_94391_a(par1World, par2 + 2, par3, par4, 1, par5EntityPlayer); this.func_94391_a(par1World, par2 - 1, par3, par4, 1, par5EntityPlayer); this.func_94391_a(par1World, par2, par3 - 1, par4, 1, par5EntityPlayer); this.func_94391_a(par1World, par2, par3, par4 + 1, 1, par5EntityPlayer); this.func_94391_a(par1World, par2, par3, par4 - 1, 1, par5EntityPlayer); } par1World.setBlockToAir(par2, par3, par4); par1World.setBlockToAir(par2 + 1, par3, par4); par1World.setBlockToAir(par2 + 2, par3, par4); par1World.setBlockToAir(par2 - 1, par3, par4); par1World.setBlockToAir(par2, par3 - 1, par4); par1World.setBlockToAir(par2, par3, par4 + 1); par1World.setBlockToAir(par2, par3, par4 - 1); par5EntityPlayer.getCurrentEquippedItem().damageItem(2, par5EntityPlayer); return true; } //If no item in hand, do nothing else { return super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9); } } public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon(Tutorial.modid + ":" + "chainTnt" + "_side"); this.field_94393_a = par1IconRegister.registerIcon(Tutorial.modid + ":" + "chainTnt" + "_top"); this.field_94392_b = par1IconRegister.registerIcon(Tutorial.modid + ":" + "chainTnt" + "_bottom"); } } The registerIcon code is in bold. Now do you see that underlined part? It wasn't originally Tutorial.modid. It was originally this.func_111023_E(). I changed that. Now, the side texture loads, but not the top or bottom. Here is the texture location:- C:/Users/*****/Desktop/forge/mcp/src/minecraft/assets/ablazethebest_tutorialmod/textures/blocks/chainTnt_bottom(or)_side(or)top.png Have a look at this pic:- I'm not sure about which build I'm using, I think it is 9.10.0.842. It is 1.6.2 I know, I plan to move my mod to 1.6.4 soon as they are nearly the same. Please help if you can. Thanks, Ablaze. Add me on Skype: AblazeTheBest. Send a message saying "#HeyAblaze" Currently: Making a mod!
October 12, 201311 yr Hi Your second problem appears to be because you have put private Icon field_94393_a and private Icon field_94392_b into your BlockChainTNT class. But the rendering code for TNT will use those fields in the BlockTNT class, it will never see the ones in your BlockChainTNT class. The first problem appears to be because it's looking for a file called MISSING_ICON_TILE_503_textureTestBlock.png instead of textureTestBlock.png -? I'm not sure offhand why (perhaps you have forgotten to register something?), but with a bit of breakpoint (at your registerIcon method) and code tracing you should be able to find out. -TGG
October 12, 201311 yr Author Hi Your second problem appears to be because you have put private Icon field_94393_a and private Icon field_94392_b into your BlockChainTNT class. But the rendering code for TNT will use those fields in the BlockTNT class, it will never see the ones in your BlockChainTNT class. The first problem appears to be because it's looking for a file called MISSING_ICON_TILE_503_textureTestBlock.png instead of textureTestBlock.png -? I'm not sure offhand why (perhaps you have forgotten to register something?), but with a bit of breakpoint (at your registerIcon method) and code tracing you should be able to find out. -TGG Hey! Okay, as for the first problem I'll do a breakpoint check. About the second problem, how do I fix it? EDIT: I fixed the second problem. I did this by copying the following code from BlockTNT:- public Icon getIcon(int par1, int par2) { return par1 == 0 ? this.field_94392_b : (par1 == 1 ? this.field_94393_a : this.blockIcon); } Doing breakpoint checks now. Thanks, Ablaze. Add me on Skype: AblazeTheBest. Send a message saying "#HeyAblaze" Currently: Making a mod!
October 12, 201311 yr Hi You can fix the second problem by overriding getIcon. I would also suggest renaming your field_94392_b and field_94393_a to something meaningful, eg @SideOnly(Side.CLIENT) private Icon chainTnt_top; @SideOnly(Side.CLIENT) private Icon chainTnt_bottom; @Override public Icon getIcon(int side, int metaData) { return side == 0 ? this.chainTnt_bottom : (side == 1 ? this.chainTnt_top : this.blockIcon); } @Override public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon(Tutorial.modid + ":" + "chainTnt" + "_side"); this.chainTnt_top = par1IconRegister.registerIcon(Tutorial.modid + ":" + "chainTnt" + "_top"); this.chainTnt_bottom = par1IconRegister.registerIcon(Tutorial.modid + ":" + "chainTnt" + "_bottom"); } -TGG
October 12, 201311 yr Author Hi You can fix the second problem by overriding getIcon. I would also suggest renaming your field_94392_b and field_94393_a to something meaningful, eg @SideOnly(Side.CLIENT) private Icon chainTnt_top; @SideOnly(Side.CLIENT) private Icon chainTnt_bottom; @Override public Icon getIcon(int side, int metaData) { return side == 0 ? this.chainTnt_bottom : (side == 1 ? this.chainTnt_top : this.blockIcon); } @Override public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon(Tutorial.modid + ":" + "chainTnt" + "_side"); this.chainTnt_top = par1IconRegister.registerIcon(Tutorial.modid + ":" + "chainTnt" + "_top"); this.chainTnt_bottom = par1IconRegister.registerIcon(Tutorial.modid + ":" + "chainTnt" + "_bottom"); } -TGG I'm sorry, but I don't know anything about debugging or breakpoints or things like that. In short, I've never debugged, not even in ordinary Java programs like JFrames and other things. Can you teach me how to do this debugging and breakpoint stuff? Thanks, Ablaze. Add me on Skype: AblazeTheBest. Send a message saying "#HeyAblaze" Currently: Making a mod!
October 12, 201311 yr Hi To be honest there's quite a bit to learn about debugging and I doubt I'm the best person to teach it to you. I'd suggest looking for a decent textbook or online tutorial or youtube series to show you what's possible with an Integrated Development Environment. It'll be well worth your investment of time- being able to stop the code, see what's doing, where it has come, watch it go step by step through each instruction, read the values of your variables and see whether they match what you expected. Stops a lot of fumbling in the dark. -TGG
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.