Jump to content

[1.8] My sword texture isn't showing up! (Solved!)


Recommended Posts

Posted

:( 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 ]
        }
    }
}

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!

Posted

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!

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!

Posted

Cool, but can you tell me how to set my texture cause its not working >:(

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!

Posted

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)

Posted

That I have tried, it only works 1.7.10 and down :(

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!

Posted

Can I have some help understanding this?

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!

Posted

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.

Posted

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.

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!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.