Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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!

  • Author

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!

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.

BEFORE ASKING FOR HELP READ THE EAQ!

 

I'll help if I can. Apologies if I do something obviously stupid. :D

 

If you don't know basic Java yet, go and follow these tutorials.

  • Author

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!

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)

  • Author

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!

  • Author

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!

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.

  • Author

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.