Jump to content

[Solved].....Crash creating items


Recommended Posts

...code?

Also, 1.8 is ancient. If you want to use 1.8, at least use 1.8.9

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

24 minutes ago, Draco18s said:

...code?

Also, 1.8 is ancient. If you want to use 1.8, at least use 1.8.9

ture but i want to make my mods available for many version plus people use 1.7.10 and 1.10 allot still so my plan was to update my mods from 1.7 to 1.8 to 1.9 ect. 

code(do you only need the item code?):

package mysticmyles.Anime_Dekokurafuto.init;

import mysticmyles.Anime_Dekokurafuto.Reference;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class AnimeItems {
	
	public static Item uchiha_logo_item;
	public static Item yugioh_cardback_item;
	public static Item dragon_ball_logo0_item;
	
	public static void init() {
		uchiha_logo_item = new Item().setUnlocalizedName("uchiha_logo_item");
		yugioh_cardback_item = new Item().setUnlocalizedName("yugioh_cardback_item");
		dragon_ball_logo0_item = new Item().setUnlocalizedName("dragon_ball_logo0_item");
	}
	
	public static void register()
	{
		GameRegistry.registerItem(uchiha_logo_item, uchiha_logo_item.getUnlocalizedName().substring(5));
		GameRegistry.registerItem(yugioh_cardback_item, yugioh_cardback_item.getUnlocalizedName().substring(5));
		GameRegistry.registerItem(yugioh_cardback_item, dragon_ball_logo0_item.getUnlocalizedName().substring(5));
	}
	public static void registerRenders()
	{
		registerRender(uchiha_logo_item);
		registerRender(yugioh_cardback_item);
		registerRender(dragon_ball_logo0_item);
	}
	
	public static void registerRender(Item item)
	{
		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
	}
}

 

Link to comment
Share on other sites

6 minutes ago, TheMysticMinecart Myles said:

GameRegistry.registerItem(yugioh_cardback_item, yugioh_cardback_item.getUnlocalizedName().substring(5)); GameRegistry.registerItem(yugioh_cardback_item, dragon_ball_logo0_item.getUnlocalizedName().substring(5));

Looks like you're registering yugioh_cardback_item twice.

 

I'm guessing copy & paste are to blame.

Link to comment
Share on other sites

Also, don't set the registry name to the unlocalized name. Set the unlocaled name to the registry name. Unlocalized names should be used for displaying the item's name only.

 

Problematic Code #7

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

18 minutes ago, Draco18s said:

Also, don't set the registry name to the unlocalized name. Set the unlocaled name to the registry name. Unlocalized names should be used for displaying the item's name only.

 

Problematic Code #7

so do i just do it like it's done in (1.7.10 the unlocalized name) and how different is 1.8.9 to 1.8

Link to comment
Share on other sites

item.setUnlocalizedName(item.getRegistryName().toString());

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

item is a local variable. So no, your code there won't work.

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