Jump to content

Recommended Posts

Posted

is there a new way of doing a item axe? ill list my java files here for the axe.class and the other parts its been added in.

 

the axe.class

 

package com.DefineCraft.Items.Silver;

import com.DefineCraft.DefineCraftCore;
import com.DefineCraft.Reference;

import net.minecraft.item.ItemAxe;

public class SilverAxe extends ItemAxe 
{
public SilverAxe(ToolMaterial material, String itemName) {
	super(material);
	setUnlocalizedName(Reference.ModID + "_" + "itemName");
	setCreativeTab(DefineCraftCore.DefineCraft);
}
}

 

 

ModItems

 

public class DefineCraftModItems{
public static Item SilverAxe;
public static void pre_init() {
ToolMaterial Silver = EnumHelper.addToolMaterial("Silver", 2, 300, 8F, 3F, 20);
SilverAxe = new SilverAxe(Silver, "SilverAxe");
}public static void init()
    {
GameRegistry.registerItem(SilverAxe, "SilverAxe");
}
}

 

 

item render register

 

public class ItemRenderRegister {

public static void registerItemRenderer() {
	RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
    

    	renderItem.getItemModelMesher().register(DefineCraftModItems.SilverPickAxe, 0, new ModelResourceLocation(Reference.ModID + ":" + "SilverPickAxe", "inventory"));
}
}

 

 

i know my coding might not be set up the best but its what i know, everything else works but once i add the axe in the crash happens. here is the crash

 

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

-- System Details --
Details:
Minecraft Version: 1.9.4
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_91, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 789079064 bytes (752 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13399 Compatibility Profile Context 15.200.1062.1004' Renderer: 'AMD Radeon HD 6670'
[13:19:44] [Client thread/INFO]: MinecraftForge v12.17.0.1968 Initialized
[13:19:44] [Client thread/INFO]: Replaced 232 ore recipes
[13:19:44] [Client thread/INFO]: Found 0 mods from the command line. Injecting into mod discoverer
[13:19:44] [Client thread/INFO]: Searching C:\Users\j0nnay\Desktop\DefineCraft WorkSpaces\Forge DefineCraft 1.9\run\mods for mods
[13:19:44] [Client thread/INFO]: Mod examplemod is missing the required element 'name'. Substituting examplemod
[13:19:46] [Client thread/INFO]: Forge Mod Loader has identified 5 mods to load
[13:19:47] [Client thread/INFO]: Attempting connection with missing mods [mcp, FML, Forge, definecraft, examplemod] at CLIENT
[13:19:47] [Client thread/INFO]: Attempting connection with missing mods [mcp, FML, Forge, definecraft, examplemod] at SERVER
[13:19:47] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:DefineCraft, FMLFileResourcePack:examplemod
[13:19:48] [Client thread/INFO]: Processing ObjectHolder annotations
[13:19:48] [Client thread/INFO]: Found 418 ObjectHolder annotations
[13:19:48] [Client thread/INFO]: Identifying ItemStackHolder annotations
[13:19:48] [Client thread/INFO]: Found 0 ItemStackHolder annotations
[13:19:48] [Client thread/INFO]: Configured a dormant chunk cache size of 0
[13:19:48] [Client thread/INFO]: [com.DefineCraft.Core.Proxy.CommonProxy:pre_init:19]: Loading Definecraft Mod Thanks You
[13:19:48] [Forge Version Check/INFO]: [Forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[13:19:48] [Client thread/INFO]: Applying holder lookups
[13:19:48] [Client thread/INFO]: Holder lookups applied
[13:19:48] [Client thread/INFO]: Injecting itemstacks
[13:19:48] [Client thread/INFO]: Itemstack injection complete
[13:19:48] [Client thread/ERROR]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue
[13:19:48] [Client thread/ERROR]: 
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCH	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCH	FML{8.0.99.99} [Forge Mod Loader] (forgeBin-1.9.4-12.17.0.1968.jar) 
UCH	Forge{12.17.0.1968} [Minecraft Forge] (forgeBin-1.9.4-12.17.0.1968.jar) 
UCE	definecraft{1.9.4-0.0.1.Beta} [DefineCraft] (bin) 
UCH	examplemod{1.0} [examplemod] (bin) 
[13:19:48] [Client thread/ERROR]: The following problems were captured during this phase
[13:19:48] [Client thread/ERROR]: Caught exception from definecraft
java.lang.ArrayIndexOutOfBoundsException: 5
at net.minecraft.item.ItemAxe.<init>(ItemAxe.java:19) ~[forgeBin-1.9.4-12.17.0.1968.jar:?]
at com.DefineCraft.Items.Silver.SilverAxe.<init>(SilverAxe.java:11) ~[bin/:?]
at com.DefineCraft.Core.DefineCraftModItems.pre_init(DefineCraftModItems.java:153) ~[bin/:?]
at com.DefineCraft.Core.Proxy.CommonProxy.pre_init(CommonProxy.java:20) ~[bin/:?]
at com.DefineCraft.Core.Proxy.ClientProxy.pre_init(ClientProxy.java:17) ~[bin/:?]
at com.DefineCraft.DefineCraftCore.pre_init(DefineCraftCore.java:34) ~[bin/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:566) ~[forgeBin-1.9.4-12.17.0.1968.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228) ~[forgeBin-1.9.4-12.17.0.1968.jar:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206) ~[forgeBin-1.9.4-12.17.0.1968.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135) [LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:586) [Loader.class:?]
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:249) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:437) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:349) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(SourceFile:124) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
at GradleStart.main(GradleStart.java:26) [start/:?]
[13:19:48] [Client thread/INFO]: [net.minecraft.init.Bootstrap:printToSYSOUT:560]: ---- Minecraft Crash Report ----
// This doesn't make any sense!

Time: 6/21/16 1:19 PM
Description: Initializing game

java.lang.ArrayIndexOutOfBoundsException: 5
at net.minecraft.item.ItemAxe.<init>(ItemAxe.java:19)
at com.DefineCraft.Items.Silver.SilverAxe.<init>(SilverAxe.java:11)
at com.DefineCraft.Core.DefineCraftModItems.pre_init(DefineCraftModItems.java:153)
at com.DefineCraft.Core.Proxy.CommonProxy.pre_init(CommonProxy.java:20)
at com.DefineCraft.Core.Proxy.ClientProxy.pre_init(ClientProxy.java:17)
at com.DefineCraft.DefineCraftCore.pre_init(DefineCraftCore.java:34)
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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:566)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:586)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:249)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:437)
at net.minecraft.client.Minecraft.run(Minecraft.java:349)
at net.minecraft.client.main.Main.main(SourceFile:124)
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:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)


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

-- Head --
Thread: Client thread
Stacktrace:
at net.minecraft.item.ItemAxe.<init>(ItemAxe.java:19)
at com.DefineCraft.Items.Silver.SilverAxe.<init>(SilverAxe.java:11)
at com.DefineCraft.Core.DefineCraftModItems.pre_init(DefineCraftModItems.java:153)
at com.DefineCraft.Core.Proxy.CommonProxy.pre_init(CommonProxy.java:20)
at com.DefineCraft.Core.Proxy.ClientProxy.pre_init(ClientProxy.java:17)
at com.DefineCraft.DefineCraftCore.pre_init(DefineCraftCore.java:34)
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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:566)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206)
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.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:586)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:249)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:437)

-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:349)
at net.minecraft.client.main.Main.main(SourceFile:124)
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:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)

-- System Details --
Details:
Minecraft Version: 1.9.4
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_91, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 837666344 bytes (798 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP 9.28 Powered by Forge 12.17.0.1968 5 mods loaded, 5 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCH	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCH	FML{8.0.99.99} [Forge Mod Loader] (forgeBin-1.9.4-12.17.0.1968.jar) 
UCH	Forge{12.17.0.1968} [Minecraft Forge] (forgeBin-1.9.4-12.17.0.1968.jar) 
UCE	definecraft{1.9.4-0.0.1.Beta} [DefineCraft] (bin) 
UCH	examplemod{1.0} [examplemod] (bin) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13399 Compatibility Profile Context 15.200.1062.1004' Renderer: 'AMD Radeon HD 6670'
Launched Version: 1.9.4
LWJGL: 2.9.4
OpenGL: AMD Radeon HD 6670 GL version 4.5.13399 Compatibility Profile Context 15.200.1062.1004, ATI Technologies Inc.
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: No
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: 
Current Language: English (US)
Profiler Position: N/A (disabled)
CPU: net.minecraft.client.Minecraft$15@55e073c8
[13:19:48] [Client thread/INFO]: [net.minecraft.init.Bootstrap:printToSYSOUT:560]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\j0nnay\Desktop\DefineCraft WorkSpaces\Forge DefineCraft 1.9\run\.\crash-reports\crash-2016-06-21_13.19.48-client.txt
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

Posted

In order to get the axe working, you need to use the secondary constructor in ItemAxe, which is ItemAxe(ToolMaterial material, float damage, float speed).  The reason the ItemAxe(ToolMaterial material) constructor crashes is because it grabs the damage and attack speed from an array of floats relative to the index of the toolmaterial passed.  Since the array has only four elements, it crashes since you're passing a toolmaterial of index five (which you can't do anything about).

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.