Jump to content

Recommended Posts

Posted

This are my classes:

 

 

package source.items;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class Items {

 public static void init() { 
     EspadaDeObsidiana = new ItemSword(ItemInfo.WAND_ID, EnumToolMaterial.EMERALD).setUnlocalizedName("EspadaDeObsidiana");
     
}

public static Item EspadaDeObsidiana;
public static void addNames() { 
	LanguageRegistry.addName(new ItemStack(EspadaDeObsidiana, 1), ItemInfo.WAND_NAME); 
	}

@SideOnly(Side.CLIENT) 
public void registerIcons(IconRegister register) { 
   {
        register.registerIcon(ItemInfo.TEXTURE_LOCATION + ":" + ItemInfo.WAND_ICON);} 
   }

public static void registerRecipes() { 
	GameRegistry.addRecipe(new ItemStack (EspadaDeObsidiana, 1), 
	    new Object[] {  " O ", 
	                    " O ", 
	                    " / ", 


	                    'O', Block.obsidian, 
	                    '/', Item.stick, 

	             });
   }

}


	                    
		                    
package source.items; 

import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;


public class ItemWand extends Item {





public ItemWand(int id) { 
        super(9520); 
        setCreativeTab(CreativeTabs.tabCombat); 
        setMaxStackSize(1); 
        setUnlocalizedName(ItemInfo.WAND_UNLOCALIZED_NAME); 
        
    } 

public boolean func_111207_a(ItemStack itemstack, EntityPlayer player, EntityLivingBase target) { 
        if(!target.worldObj.isRemote) { 
            target.motionY = 2;  
            itemstack.setItemDamage(itemstack.getItemDamage() + 7);
          
        } 
     
     return false; 
    } 

@Override 
@SideOnly(Side.CLIENT) 
public void registerIcons(IconRegister register) { 
itemIcon = register.registerIcon(ItemInfo.TEXTURE_LOCATION + ":" + ItemInfo.WAND_ICON); }
}

     
     


package source;

import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import source.config.ConfigHandler;
import source.items.ItemInfo;
import source.items.ItemWand;
import source.items.Items;
import source.network.PacketHandler;
import source.proxies.CommonProxy;

@Mod(modid = ModInformation.ID, name = ModInformation.NAME, version = ModInformation.VERSION)
@NetworkMod(channels = {ModInformation.CHANNEL}, clientSideRequired = true, serverSideRequired = true, packetHandler = PacketHandler.class)
public class Itz {


@Instance(ModInformation.ID)
public static Itz instance;

@SidedProxy(clientSide = "example.proxies.ClientProxy", serverSide = "example.proxies.CommonProxy")
public static CommonProxy proxy;


@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	ConfigHandler.init(event.getSuggestedConfigurationFile());
	Items.init();

	proxy.initSounds();
	proxy.initRenderers();
}

@EventHandler
public void load(FMLInitializationEvent event) {
	Items.registerRecipes();
	Items.addNames();

	}



@EventHandler
public void modsLoaded(FMLPostInitializationEvent event) {

}

}

package source.items;

public class ItemInfo {

   public static final String TEXTURE_LOCATION = "example";

   public static int WAND_ID; 
   public static final String WAND_KEY = "EspadaDeObsidiana";
   public static final int WAND_DEFAULT = 9244;
   
   public static final String WAND_UNLOCALIZED_NAME = "EspadaDeObsidiana";
   public static final String WAND_NAME = "Espada de Obsidiana";
   public static final String WAND_ICON = "swordObsidian";


}

what's the problem? I can't give texture to my item, this is the code (I will show you again):

package source.items;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class Items {

 public static void init() { 
     EspadaDeObsidiana = new ItemSword(ItemInfo.WAND_ID, EnumToolMaterial.EMERALD).setUnlocalizedName("EspadaDeObsidiana");
     
}

public static Item EspadaDeObsidiana;
public static void addNames() { 
	LanguageRegistry.addName(new ItemStack(EspadaDeObsidiana, 1), ItemInfo.WAND_NAME); 
	}

@SideOnly(Side.CLIENT) 
public void registerIcons(IconRegister register) { 
   {
        register.registerIcon(ItemInfo.TEXTURE_LOCATION + ":" + ItemInfo.WAND_ICON);} 
   }

public static void registerRecipes() { 
	GameRegistry.addRecipe(new ItemStack (EspadaDeObsidiana, 1), 
	    new Object[] {  " O ", 
	                    " O ", 
	                    " / ", 


	                    'O', Block.obsidian, 
	                    '/', Item.stick, 

	             });
   }

}

 

Posted

Whats the crash report? You say it crashes but give us no information about the crash. What is suppose to happen when the crash happens? Just giving the code tells us nothing about your crash. We could sit here all day telling whats wrong with your code but still not fix the crash.

Posted

yes, sorry, I forget the crash report, this is: 

 

---- Minecraft Crash Report ----

// Hey, that tickles! Hehehe!

 

Time: 16/11/13 01:00 PM

Description: Initializing game

 

java.lang.NullPointerException

at net.minecraft.item.ItemStack.<init>(ItemStack.java:82)

at example.items.Items.registerRecipes(Items.java:21)

at example.Itz.load(Itz.java:42)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:698)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:509)

at net.minecraft.client.Minecraft.run(Minecraft.java:808)

at net.minecraft.client.main.Main.main(Main.java:93)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)

at net.minecraft.launchwrapper.Launch.main(Launch.java:27)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at net.minecraft.item.ItemStack.<init>(ItemStack.java:82)

at example.items.Items.registerRecipes(Items.java:21)

at example.Itz.load(Itz.java:42)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:698)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:509)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:808)

at net.minecraft.client.main.Main.main(Main.java:93)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)

at net.minecraft.launchwrapper.Launch.main(Launch.java:27)

 

-- System Details --

Details:

Minecraft Version: 1.6.4

Operating System: Windows 7 (x86) version 6.1

Java Version: 1.7.0_40, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation

Memory: 991219872 bytes (945 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Suspicious classes: FML and Forge are installed

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v8.11 FML v6.4.38.942 Minecraft Forge 9.11.1.942 4 mods loaded, 4 mods active

mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized

FML{6.4.38.942} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized

Forge{9.11.1.942} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized

Obsidiana{1.6.4.1.0.1} [itz] (bin) Unloaded->Constructed->Pre-initialized->Errored

Launched Version: 1.6

LWJGL: 2.9.0

OpenGL: AMD Radeon HD 6310M    GL version 4.0.10318 Compatibility Profile Context, ATI Technologies Inc.

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Pack: Default

Current Language: Español (México)

Profiler Position: N/A (disabled)

Vec3 Pool Size: ~~ERROR~~ NullPointerException: null

Posted

1) Check to make sure that the block / item is not null when you pass it to the itemstack constructor.

2) Look at the ItemStack constructor at the line the crash report indicates to figure out what object might be null.

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.

Posted

I finded two code lines that make mention to the ItemStack in the crash report:

at net.minecraft.item.ItemStack.<init>(ItemStack.java:82)

both says the same thing but I don't find the object that's null

Posted

What is the code at that line?

 

That's why I said "Look at the ItemStack constructor"

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.

Posted

Hmmm. If I were a betting person, I'd bet you don't program in java much.

 

Why? Oh, Why did you put your mod in package source? And then put your Items and such in different packages? None of that is proper java.

 

Use a package such as com.eaglenator.itz, or something similar and put all your classes in the package.

 

Also, why do you create and pass an Object Array to addRecipe. The signature expects multiple parameters, starting with an ItemStack instance and including the 3 Strings, and repeated Chars, and Item/Block/ItemStack instances in the proper order.

Try something like this:

GameRegistry.addShapedRecipe(new ItemStack(anItem), new String[]{"ABC", "CBA", " B "}, 'A', Items.arrow, 'B', Items.boat, 'C', Items.bone);

or

GameRegistry.addShapedRecipe(new ItemStack(anItem), "ABC", "CBA", " B ", 'A', Items.arrow, 'B', Items.boat, 'C', Items.bone);

 

It's not rocket science, but is precise.

Posted

ItemStack constructor? you mean to ItemStack.java or to the codes with "ItemStack".

 

Fox man.

 

at net.minecraft.item.ItemStack.<init>(ItemStack.java:82)

 

Go learn Java.

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.

Posted

Your package structure once i looked at it was enough to show you dont really know java. I suggest you learn java enough that you can make sence of the minecraft code even if you dont fully understand it that way you can also figure things like this out.

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.