Posted May 21, 201411 yr Hello, I need help with my texturing, when test run it just shows the untextured texture. Here is my main file's code: package k3.moreMetals; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; 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.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = moreMetalsMod.MODID, version = moreMetalsMod.VERSION) public class moreMetalsMod { public static final String MODID = "moreMetals"; public static final String VERSION = "1.0"; public static Block orePlatinum; public static Item chunkPlatinum; public static CreativeTabs moreMetalsTab = new CreativeTabs("moreMetalsStuff"){ @Override public Item getTabIconItem() { return Items.emerald; } }; @EventHandler public void preInit(FMLPreInitializationEvent preevent){ chunkPlatinum = new Item().setUnlocalizedName("chunkPlatinum").setCreativeTab(moreMetalsTab).setTextureName(MODID + ":" + "chunkPlatinum"); GameRegistry.registerItem(chunkPlatinum, "chunkPlatinum"); orePlatinum = new BlockPlatOre().setBlockName("orePlatinum").setCreativeTab(moreMetalsTab).setBlockTextureName(MODID + ":" + "orePlatinum"); GameRegistry.registerBlock(orePlatinum, "orePlatinum"); } @EventHandler public void init(FMLInitializationEvent event){ } } here's the BlockPlatOre code: package k3.moreMetals; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class BlockPlatOre extends Block { public BlockPlatOre() { super(Material.iron); } } the orePlatinum texture is in assets.moreMetals.textures.blocks and the chunkPlatinum is in assets.moreMetals.textures.items. Also, the images are png files. Currently developing the More Metals Mod.
May 21, 201411 yr Try setting the texutre name under the 'super' constructor, and not in the preInit. It would also be nice to do the same thing with your creative tab... Your block class should look like this: package k3.moreMetals; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class BlockPlatOre extends Block { public BlockPlatOre() { super(Material.iron); this.setBlockTextureName(MODID + ":" + "orePlatinum"); this.setCreativeTab(moreMetalsTab); } } If i helped you, please click the "thank you" button
May 21, 201411 yr Author Try setting the texutre name under the 'super' constructor, and not in the preInit. It would also be nice to do the same thing with your creative tab... Your block class should look like this: package k3.moreMetals; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class BlockPlatOre extends Block { public BlockPlatOre() { super(Material.iron); this.setBlockTextureName(MODID + ":" + "orePlatinum"); this.setCreativeTab(moreMetalsTab); } } Okay, now it's giving me the errors "MODID cannot be resolved to a variable" and "moreMetalsTab cannot be resolved to a variable" Do you know how to fix that? Currently developing the More Metals Mod.
May 21, 201411 yr You need to import the class moreMetalsMod! Then you do this: package k3.moreMetals; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import blablabla.moreMetalsMod; //Please do ask why blablabla.moreMetalsMod doens't work! public class BlockPlatOre extends Block { public BlockPlatOre() { super(Material.iron); this.setBlockTextureName(moreMetalsMod.MODID + ":" + "orePlatinum"); } } And leave the Creative tab in the preInit... Thanks João Fernandes
May 21, 201411 yr Author You need to import the class moreMetalsMod! Then you do this: package k3.moreMetals; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import blablabla.moreMetalsMod; //Please do ask why blablabla.moreMetalsMod doens't work! public class BlockPlatOre extends Block { public BlockPlatOre() { super(Material.iron); this.setBlockTextureName(moreMetalsMod.MODID + ":" + "orePlatinum"); } } And leave the Creative tab in the preInit... Well now the block isn't showing up in the creative tab when I test it, do you know why? Currently developing the More Metals Mod.
May 21, 201411 yr By MODID i meant your actual mod id, which i think is moremetals, idk... but, if can also do as jtmnf said, to prevent typing erros... As for the creative tab, thats because you have to take it off of the preInit and put it in the 'super' constructor, as i said... If i helped you, please click the "thank you" button
May 21, 201411 yr Rokuw, do you mean: (...) orePlatinum = new BlockPlatOre().setBlockName("orePlatinum").setBlockTextureName(MODID + ":" + "orePlatinum"); GameRegistry.registerBlock(orePlatinum, "orePlatinum"); (...) and public class BlockPlatOre extends Block { public BlockPlatOre() { super(Material.iron); this.setBlockTextureName(moreMetalsMod.MODID + ":" + "orePlatinum"); this.setCreativeTab(moreMetalsMod.moreMetalsTab); } } This? Thanks João Fernandes
May 21, 201411 yr The second one is right, but the first one is supposed to be like this: (...) orePlatinum = new BlockPlatOre().setBlockName("orePlatinum"); GameRegistry.registerBlock(orePlatinum, "orePlatinum"); (...) (no set block texture name) I hope it works this way If i helped you, please click the "thank you" button
May 21, 201411 yr Yeah, forget... I copy/paste that and forgot to take the Texture Thanks João Fernandes
May 21, 201411 yr Rsrsrs, thats fine, i always make something like that too So anyways, Kennybenny, your block class should look like this: package k3.moreMetals; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class BlockPlatOre extends Block { public BlockPlatOre() { super(Material.iron); this.setBlockTextureName(moreMetalsMod.MODID + ":" + "orePlatinum"); this.setCreativeTab(moreMetalsMod.moreMetalsTab); } } And your main class should look like this: package k3.moreMetals; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; 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.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = moreMetalsMod.MODID, version = moreMetalsMod.VERSION) public class moreMetalsMod { public static final String MODID = "moreMetals"; public static final String VERSION = "1.0"; public static Block orePlatinum; public static Item chunkPlatinum; public static CreativeTabs moreMetalsTab = new CreativeTabs("moreMetalsStuff"){ @Override public Item getTabIconItem() { return Items.emerald; } }; @EventHandler public void preInit(FMLPreInitializationEvent preevent){ chunkPlatinum = new Item().setUnlocalizedName("chunkPlatinum") GameRegistry.registerItem(chunkPlatinum, "chunkPlatinum"); orePlatinum = new BlockPlatOre().setBlockName("orePlatinum"); GameRegistry.registerBlock(orePlatinum, "orePlatinum"); } @EventHandler public void init(FMLInitializationEvent event){ } } Also, as you're not using fml init, you can just delete it, but that's up to you, since it makes no difference... I also noticed that you have an item called 'chunkPlatinum' and i bet that its texture isn't working aswell (i think you mentioned it, i don't remember)... I already fixed it in the preInit, just don't forget to set the texture name and creative tab in the 'super' method.... If i helped you, please click the "thank you" button
May 21, 201411 yr Author The second one is right, but the first one is supposed to be like this: (...) orePlatinum = new BlockPlatOre().setBlockName("orePlatinum"); GameRegistry.registerBlock(orePlatinum, "orePlatinum"); (...) (no set block texture name) I hope it works this way Nope, still not working, just a checkered purple and black block, the images are 16x16, just saying, it might help. Currently developing the More Metals Mod.
May 21, 201411 yr Did you set the texture name in your block class as it is in my spoiler tag? (if you don't know, just click the 'hidden' button and you'll see the code that works) If i helped you, please click the "thank you" button
May 22, 201411 yr Author Did you set the texture name in your block class as it is in my spoiler tag? (if you don't know, just click the 'hidden' button and you'll see the code that works) Yeah, I copy-pasted it all. I'll take some screenshots and if somebody can tell me how to use the insert image thing on the forum (I'm a big noob on the forum) then I can post them. Currently developing the More Metals Mod.
May 22, 201411 yr You might have this setup wrong (this is how I did to texture a block and it worked fine)! Thanks João Fernandes
May 22, 201411 yr Author I think I have the same setup, there it is Currently developing the More Metals Mod.
May 22, 201411 yr I could post my code, but i use internal classes, and you're using public ones, and that would confuse you, i think.... If you want so, just say... As for your problem, could you post your "new" classes, please? If i helped you, please click the "thank you" button
May 22, 201411 yr Can I see a printscreen of your package explorer, please? I cannot see the end of the assets.mod.textures... Thanks João Fernandes
May 22, 201411 yr Author Here you go: http://i.imgur.com/00zvEF3.png Currently developing the More Metals Mod.
May 22, 201411 yr I'm not tracking the error there :\ Tomorrow I'll see with other eyes if the error wasn't founded yet! I'll check during the day what kind of problems might cause that... For now I'm not really seeing what's wrong :\ Thanks João Fernandes
May 22, 201411 yr Author Well, thanks, hope you can look tomorrow. Currently developing the More Metals Mod.
May 22, 201411 yr This is my code (I'll only paste the important ones): MainClass public class MainClass { public static final String MODID = "techmodcraft"; public static final String VERSION = "1.0"; public static CreativeTabs testTab = new CreativeTabs("techmodcraft") { @Override public Item getTabIconItem() { return Items.diamond; } }; public static Block blockTest; @EventHandler public void preInit(FMLPreInitializationEvent event){ blockTest = new BlockTech().setBlockName("blockTest").setCreativeTab(testTab); GameRegistry.registerBlock(blockTest, "blockTest"); } BlockTech public class BlockTech extends Block{ public BlockTech() { super(Material.rock); this.setBlockTextureName(MainClass.MODID + ":" + "blockTest"); } } In the Package Explorer I have: - Forge > src/TechModCraft: > assets.techmodcraft.textures.blocks > (this has the images of blocks) > net.techmodcraft.mod.block > (this has the .java classes) If you don't find any error by comparing with my setup, try to re-create the project... That might help! I'll continue to see this... Thanks João Fernandes
May 22, 201411 yr Author This is my code (I'll only paste the important ones): MainClass public class MainClass { public static final String MODID = "techmodcraft"; public static final String VERSION = "1.0"; public static CreativeTabs testTab = new CreativeTabs("techmodcraft") { @Override public Item getTabIconItem() { return Items.diamond; } }; public static Block blockTest; @EventHandler public void preInit(FMLPreInitializationEvent event){ blockTest = new BlockTech().setBlockName("blockTest").setCreativeTab(testTab); GameRegistry.registerBlock(blockTest, "blockTest"); } BlockTech public class BlockTech extends Block{ public BlockTech() { super(Material.rock); this.setBlockTextureName(MainClass.MODID + ":" + "blockTest"); } } In the Package Explorer I have: - Forge > src/TechModCraft: > assets.techmodcraft.textures.blocks > (this has the images of blocks) > net.techmodcraft.mod.block > (this has the .java classes) If you don't find any error by comparing with my setup, try to re-create the project... That might help! I'll continue to see this... It's still not working, do you have any tutorials that are any different from what I was already doing? Currently developing the More Metals Mod.
May 22, 201411 yr No :\I have made exactly like you... Video: I picked up parts of the video and they worked well... Thanks João Fernandes
May 22, 201411 yr Author Hmmmmm... When you said net.techmodcraft.mod.block, what did the "mod" and "block" mean? Currently developing the More Metals Mod.
May 22, 201411 yr Nothing at all... .mod says that this is the mod, .block says that this is the package of blocks... Thanks João Fernandes
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.