Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.12] Help Making an Item?


Big_Bad_E
 Share

Recommended Posts

So, with this new weird 1.12 API, I can't manage to get items to work.

I have been messing around but can't seem to find my problem.

Item Class:

package MoBuildingBlocks.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSword;
import net.minecraftforge.event.RegistryEvent;

public class ItemSaw extends ItemSword {
	public static Item ItemSaw;
	public static void registerItems(RegistryEvent.Register<Item> event) {
        event.getRegistry().register(ItemSaw=new ItemSword(Item.ToolMaterial.IRON).setUnlocalizedName("saw").setRegistryName("mobuildingblocks","saw"));
	}
        public ItemSaw(ToolMaterial material) {
		super(material);
	}
}

Common Proxy:

package MoBuildingBlocks.Proxy;

import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.event.RegistryEvent;
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.eventhandler.SubscribeEvent;
import MoBuildingBlocks.Items.ItemSaw;
import MoBuildingBlocks.Registrys.RegistryHandler;

public class CommonProxy {

	public void preInit(FMLPreInitializationEvent event) {
		RegistryHandler.Common();
	}
	public void Init(FMLInitializationEvent event) {
		
	}
	public void postInit(FMLPostInitializationEvent event) {
		
	}
	@SubscribeEvent
    public static void registerItems(RegistryEvent.Register<Item> event, ToolMaterial material) {
        event.getRegistry().register(new ItemSaw(material));
	}
}

Item Registry:

package MoBuildingBlocks.Registrys;

import net.minecraftforge.fml.common.registry.GameRegistry;
import MoBuildingBlocks.Items.ItemSaw;

public class ItemRegistry {
    @GameRegistry.ObjectHolder("mbb:saw")
    public static ItemSaw saw;
}

That's all the classes I have to do with the item, nothing in my main class except the PreInit, Init, and PostInit, and my ClientProxy is the same.

The mod name is Mo' Building Blocks, the mod ID is mbb, the item is called Saw, the texture is in a folder called Items and it is called Saw.

Link to comment
Share on other sites

event.getRegistry().register(ItemSaw=new ItemSword(...
event.getRegistry().register(new ItemSaw(...

Wot. Why do you have two different RegistryEvent handlers? Not that either one of them is actually subscribed to the event bus.

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.

Link to comment
Share on other sites

Still not working...

Item Class:

package MoBuildingBlocks.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSword;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber
public class ItemSaw extends Item {
	public static Item ItemSaw;
	public static void registerItems(RegistryEvent.Register<Item> event) {
        event.getRegistry().register(ItemSaw=new Item().setUnlocalizedName("saw").setRegistryName("mobuildingblocks","saw"));
	}
        public ItemSaw(ToolMaterial material) {
		super();
	}
}

I removed the register thing from my proxy

Item Registry:

package MoBuildingBlocks.Registrys;

import net.minecraftforge.fml.common.registry.GameRegistry;
import MoBuildingBlocks.Items.ItemSaw;

public class ItemRegistry {
    @GameRegistry.ObjectHolder("mbb:saw")
    public static ItemSaw saw;
}

I have no other things related to the item in my other classes, which I may need it in one .-.

Also if anyone knows what to do in my event.getRegistry to put it in a creative tab

Link to comment
Share on other sites

If you're using @GameRegistry.ObjectHolder then you don't need to do this: ItemSaw=

The whole point of ObjectHolder annotations is to set the field for you.

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.

Link to comment
Share on other sites

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.