JakeT24 Posted December 22, 2014 Posted December 22, 2014 My sword texture isn't showing, all it is is a giant purple and black checkered block going through me(ow! )! SteelWeaponsMod.java <<< This is my main mod file. package JakeT24.SteelModPlus; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; @Mod(modid = "swm", name = "Steel Weapons Mod", version = "0.1") public class SteelWeaponsMod { public static ItemSword SteelSword; public static Block SteelOre; public static ToolMaterial SteelA = EnumHelper.addToolMaterial("Steel", 3, 999, 15.0F, 2.5F, 10); @EventHandler public void preInit(FMLPreInitializationEvent event){ SteelSword = (ItemSword) new SteelSword(SteelA).setUnlocalizedName("SteelSword"); SteelSword.setCreativeTab(CreativeTabs.tabCombat); SteelSword.setMaxStackSize(1); SteelOre = new SteelOre(Material.iron).setUnlocalizedName("SteelOre"); SteelOre.setCreativeTab(CreativeTabs.tabBlock); GameRegistry.registerItem(SteelSword, SteelSword.getUnlocalizedName().substring(5)); GameRegistry.registerBlock(SteelOre, SteelOre.getUnlocalizedName().substring(5)); } @EventHandler public void init(FMLInitializationEvent event){ Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(SteelSword, 8000, new ModelResourceLocation("swm:item_SteelSword", "inventory")); } @EventHandler public void postInit(FMLPostInitializationEvent event){ } } SteelSword.json <<< This is my rendering .json file I have in assets/swm/models/items along with my SteelSword.png! { "parent": "builtin/generated", "textures": { "layer0": "swm:items/SteelSword" }, "display": { "thirdperson": { "rotation": [ -90, 0, 0 ], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55 ] }, "firstperson": { "rotation": [ 0, -135, 25 ], "translation": [ 0, 4, 2 ], "scale": [ 1.7, 1.7, 1.7 ] } } } Quote Check out my mod- SteelMod++ and maybe we can support each other Help me learn and some day I will be able to help you learn!
JakeT24 Posted December 22, 2014 Author Posted December 22, 2014 Oh. and if you could tell me how to set it's tooltip that would be kool. And before you criticize me on how I'm not trying hard enough iv'e spent 8 hours of my day sitting hear with my laptop plugged into my TV trying to figure out Forge 1.8 and yes I did look for tutorials. Thats mostly how I got this far! Quote Check out my mod- SteelMod++ and maybe we can support each other Help me learn and some day I will be able to help you learn!
shieldbug1 Posted December 22, 2014 Posted December 22, 2014 Look at the addInformation method in the Item class for tooltips. If you don't know how to use it, see how vanilla items with tooltips implement it. Quote BEFORE ASKING FOR HELP READ THE EAQ! I'll help if I can. Apologies if I do something obviously stupid. If you don't know basic Java yet, go and follow these tutorials.
JakeT24 Posted December 22, 2014 Author Posted December 22, 2014 Cool, but can you tell me how to set my texture cause its not working Quote Check out my mod- SteelMod++ and maybe we can support each other Help me learn and some day I will be able to help you learn!
GiMoe Posted December 22, 2014 Posted December 22, 2014 you need to reference a variable How does: SteelSword = (ItemSword) new SteelSword(SteelA).setUnlocalizedName("SteelSword"); not give you an error? you need something like: SteelSword mySword = (ItemSword) new SteelSword(SteelA).setUnlocalizedName("SteelSword") and to add texture to your item you need something like this: mySword.setTextureName(modid + ":" + name_of_your_file); make sure you place your png file into the correct folder (assets/swm/textures/items) Quote
JakeT24 Posted December 22, 2014 Author Posted December 22, 2014 That I have tried, it only works 1.7.10 and down Quote Check out my mod- SteelMod++ and maybe we can support each other Help me learn and some day I will be able to help you learn!
md678685 Posted December 22, 2014 Posted December 22, 2014 See Eternaldoom's post on updating to 1.8(http://www.minecraftforge.net/forum/index.php/topic,24263.0.html). The section on Blocks and Items is especially helpful. Quote
JakeT24 Posted December 22, 2014 Author Posted December 22, 2014 Can I have some help understanding this? Quote Check out my mod- SteelMod++ and maybe we can support each other Help me learn and some day I will be able to help you learn!
md678685 Posted December 22, 2014 Posted December 22, 2014 Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(SteelSword, 8000, new ModelResourceLocation("swm:item_SteelSword", "inventory")); should be changed to Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(SteelSword, 0, new ModelResourceLocation("swm:SteelSword", "inventory")); Also, never capitalize the first letter of variables. Always capitalize the first letter of classes, though. Quote
JakeT24 Posted December 22, 2014 Author Posted December 22, 2014 Hey Thanks! This made my texture get flat and look like the normal non-textured item, which I was worried about. So now I have this problem, it still isn't showing the texture. But it is flat like it should be, just purple and black. Quote Check out my mod- SteelMod++ and maybe we can support each other Help me learn and some day I will be able to help you learn!
Recommended Posts
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.