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

Hello,

I am very new to modding with forge. I was reading many different tutorials and they describe really dífferently. Some codes are not working and some are and its not same

 

However. I try to understand the documentation of forge but its really hard. Anyways. I finally have my item in minecraft. It is working like a Iron PickAxe. Only the rendering do problems. I see this

RHgvGBC.png

 

So I think I missing something  but what.

 

So how my eclipse looks

 

r2aZL5v.png

 

 

package mazmod.hammertoolmod.item.tools;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemPickaxe;

public class ItemSuperPickAxe extends ItemPickaxe {

	public ItemSuperPickAxe(ToolMaterial material, final String itemName) {
		super(material);
		// TODO Auto-generated constructor stub
		
		setUnlocalizedName(itemName);
		setRegistryName(itemName);
		setCreativeTab(CreativeTabs.DECORATIONS);
	}

	@Override
	public ItemSuperPickAxe setCreativeTab(CreativeTabs tab) {
		super.setCreativeTab(tab);
		return this;
	}

}

 

package mazmod.hammertoolmod;

import java.util.ArrayList;
import java.util.List;

import net.minecraft.item.Item;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.registries.IForgeRegistry;

@Mod.EventBusSubscriber(modid = TutorialMod.MODID)
public class RegisterHandler {
	static List<Item> items = new ArrayList<Item>();
	
	public static void AddRegisterItemQueue(Item item)
	{
		items.add(item);
	}
	
	@SubscribeEvent
	protected static void registerItems(final RegistryEvent.Register<Item> event) {
		
		IForgeRegistry<Item> reg = event.getRegistry();
		for (int i = 0; i < items.size(); i++) {
			reg.register(items.get(i));
		}
		
	}
	
}

 

This above was even hard. registerItems itself do not call if EventBusSubscriber is not defined above class. There is more like NewRegistry but I didn't understand it.

 

package mazmod.hammertoolmod;

import mazmod.hammertoolmod.item.tools.ItemSuperPickAxe;
import net.minecraft.item.Item.ToolMaterial;
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;

@Mod(modid = TutorialMod.MODID, version = TutorialMod.VERSION, name = TutorialMod.NAME)
public class TutorialMod {
        
        public static final String MODID = "tut";
        public static final String NAME = "tutorialmod";
        public static final String VERSION = "0.1";
        
        @Mod.Instance(TutorialMod.MODID)
    	public static TutorialMod instance;
        
        
        @EventHandler
        public void preInit(FMLPreInitializationEvent event){
        	RegisterHandler.AddRegisterItemQueue(new ItemSuperPickAxe(ToolMaterial.IRON, "superPickAxe"));
        }
        
        @EventHandler
        public void init(FMLInitializationEvent event){
        	
        }
        
        @EventHandler
        public void postInit(FMLPostInitializationEvent event){
                
        }
       
}

 

 

Another question. After I learned it little bit I want to make a Hammer which can be used for every type of blocks. How could I do it. I mean if I use example For digging it should be strong like shovel. If I use it for blocks like stone, iron ore etc it should be like pickaxe.

 

Edited by MaZy
Title has more sense now.

You aren't telling the game about the model.

You need to call ModelLoader.setCustomModelResourceLocation during the ModelRegistryEvent event.

 

Also, stop using builtin/generated as your model's parent. item/generated and item/handheld both exist and means you don't need to supply display tags.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.