Jump to content

Test Run on Eclipse wont launch


2FastAssassin

Recommended Posts

all my code is correct and it launches test fine untill I add a recipe for my weapons, and I followed the video exact but launch still fails

 

Crash Report: [net.minecraft.client.Minecraft:displayCrashReport:398]

 

Full Report:---- Minecraft Crash Report ----

// Hi. I'm Minecraft, and I'm a crashaholic.

 

Time: 22/03/15 3:01 PM

Description: Initializing game

 

java.lang.ClassCastException: wearethewarriorsmod.Itemcorruptedsoulgem cannot be cast to java.lang.Character

at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:209)

at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:244)

at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:239)

at wearethewarriorsmod.WeAreTheWarriorsMod.init(WeAreTheWarriorsMod.java:57)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

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 cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

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 cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

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

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

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

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

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

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

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

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

 

 

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

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

 

-- Head --

Stacktrace:

at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:209)

at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:244)

at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:239)

at wearethewarriorsmod.WeAreTheWarriorsMod.init(WeAreTheWarriorsMod.java:57)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

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 cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

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 cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

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

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

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

 

-- Initialization --

Details:

Stacktrace:

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

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

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

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

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (x86) version 6.1

Java Version: 1.8.0_25, Oracle Corporation

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

Memory: 759340312 bytes (724 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB)

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

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

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

FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active

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

FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized

Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized

watwm{1.0} [We Are The Warriors Mod] (bin) Unloaded->Constructed->Pre-initialized->Errored

Launched Version: 1.7.10

LWJGL: 2.9.1

OpenGL: ATI Radeon 3000 Graphics GL version 3.3.10750 Compatibility Profile Context, ATI Technologies Inc.

GL Caps: Using GL 1.3 multitexturing.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Anisotropic filtering is supported and maximum anisotropy is 16.

Shaders are available because OpenGL 2.1 is supported.

 

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)

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

Anisotropic Filtering: Off (1)

 

My Main Code:

 

package wearethewarriorsmod;

 

import wearethewarriorsmod.item.ItemAncientsword;

import wearethewarriorsmod.item.ItemDragonsword;

import wearethewarriorsmod.item.ItemSwordofcorruptedsouls;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraftforge.common.util.EnumHelper;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

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.registry.GameRegistry;

 

@Mod(modid = "watwm", name = "We Are The Warriors Mod", version = "1.0")

public class WeAreTheWarriorsMod {

 

//items

public static Item itemsoulshard;

public static Item itemcorruptedsoulgem;

public static Item itemdragonrod;

 

//swords

public static Item swordofcorruptedsouls;

public static Item dragonsword;

public static Item ancientsword;

 

public static final Item.ToolMaterial corruptedToolMaterial = EnumHelper.addToolMaterial("corruptedToolMaterial", 0, 200000, 1.0F, 45.0F, 100);

public static final Item.ToolMaterial dragonToolMaterial = EnumHelper.addToolMaterial("dragonToolMaterial", 0, 20000, 1.0F, 20.0F, 100);

public static final Item.ToolMaterial ancientToolMaterial = EnumHelper.addToolMaterial("ancientToolMaterial", 0, 100, 0.0F, 1.0F, 0);

 

    @EventHandler

    public void preInit(FMLPreInitializationEvent event) {

   

itemsoulshard = new Itemsoulshard().setUnlocalizedName("Itemsoulshard").setTextureName("watwm:soul_shard").setCreativeTab(tabWeAreTheWarriorsMod);

    itemcorruptedsoulgem = new Itemcorruptedsoulgem().setUnlocalizedName("Itemcorruptedsoulgem").setTextureName("watwm:corrupted_soul_gem").setCreativeTab(tabWeAreTheWarriorsMod);

    itemdragonrod = new Itemdragonrod().setUnlocalizedName("Itemdragonrod").setTextureName("watwm:dragon_rod").setCreativeTab(tabWeAreTheWarriorsMod);

   

    GameRegistry.registerItem(itemsoulshard, itemsoulshard.getUnlocalizedName().substring(5));

    GameRegistry.registerItem(itemcorruptedsoulgem, itemcorruptedsoulgem.getUnlocalizedName().substring(5));

    GameRegistry.registerItem(itemdragonrod, itemdragonrod.getUnlocalizedName().substring(5));

   

    swordofcorruptedsouls = new ItemSwordofcorruptedsouls(corruptedToolMaterial).setUnlocalizedName("ItemSwordofcorruptedsouls").setTextureName("watwm:sword_of_corrupted_souls").setCreativeTab(tabWeAreTheWarriorsMod);

    dragonsword = new ItemDragonsword(dragonToolMaterial).setUnlocalizedName("ItemDragonsword").setTextureName("watwm:dragon_sword").setCreativeTab(tabWeAreTheWarriorsMod);

    ancientsword = new ItemAncientsword(ancientToolMaterial).setUnlocalizedName("ItemAncientsword").setTextureName("watwm:ancient_sword").setCreativeTab(tabWeAreTheWarriorsMod);

   

    GameRegistry.registerItem(swordofcorruptedsouls, swordofcorruptedsouls.getUnlocalizedName().substring(5));

    GameRegistry.registerItem(dragonsword, dragonsword.getUnlocalizedName().substring(5));

    GameRegistry.registerItem(ancientsword, ancientsword.getUnlocalizedName().substring(5));

   

    }

    @EventHandler

    public void init(FMLInitializationEvent event) {

    GameRegistry.addRecipe(new ItemStack(swordofcorruptedsouls), new Object[]{"a", "a", "b", "a", itemcorruptedsoulgem, "b", Items.stick});

    GameRegistry.addRecipe(new ItemStack(dragonsword), new Object[]{"a", "a", "b", "a", itemdragonrod, "b", Items.blaze_rod});

   

    }

    @EventHandler

    public void postInit(FMLPostInitializationEvent event) {

    }

    public static CreativeTabs tabWeAreTheWarriorsMod = new CreativeTabs("tabWeAreTheWarriorsMod"){

    @Override

    public Item getTabIconItem(){

    return new ItemStack(itemcorruptedsoulgem).getItem();

    }

    };

    }

 

 

Link to comment
Share on other sites

Flaws of your code:

public static CreativeTabs tabWeAreTheWarriorsMod = new CreativeTabs("tabWeAreTheWarriorsMod"){
           @Override
           public Item getTabIconItem(){
              return new ItemStack(itemcorruptedsoulgem).getItem();
           }
        };

THIS IS BAD.

getTabIconItem() should return Item, you don't need to make new ItemStack and then pull Item out of it.

return itemcorruptedsoulgem;

 

 

As to main problem - do you even recipe, bro?

GameRegistry.addRecipe(new ItemStack(someItem, meta, quantity), new Object[] {"XXX", 'X', ITEMX});

 

"XXX" pattern

'X' - symbol definition start

ITEMX - actual definition of X

 

GO LEARN JAVA This is not modding if you can't solve simple stuff.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

I fixed that stuff but it still crashes

 

Code Now:

 

package wearethewarriorsmod;

 

import wearethewarriorsmod.item.ItemAncientsword;

import wearethewarriorsmod.item.ItemDragonsword;

import wearethewarriorsmod.item.ItemSwordofcorruptedsouls;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraftforge.common.util.EnumHelper;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

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.registry.GameRegistry;

 

@Mod(modid = "watwm", name = "We Are The Warriors Mod", version = "1.0")

public class WeAreTheWarriorsMod {

 

//items

public static Item itemsoulshard;

public static Item itemcorruptedsoulgem;

public static Item itemdragonrod;

 

//swords

public static Item swordofcorruptedsouls;

public static Item dragonsword;

public static Item ancientsword;

 

public static final Item.ToolMaterial corruptedToolMaterial = EnumHelper.addToolMaterial("corruptedToolMaterial", 0, 200000, 1.0F, 45.0F, 100);

public static final Item.ToolMaterial dragonToolMaterial = EnumHelper.addToolMaterial("dragonToolMaterial", 0, 20000, 1.0F, 20.0F, 100);

public static final Item.ToolMaterial ancientToolMaterial = EnumHelper.addToolMaterial("ancientToolMaterial", 0, 100, 0.0F, 1.0F, 0);

 

    @EventHandler

    public void preInit(FMLPreInitializationEvent event) {

   

itemsoulshard = new Itemsoulshard().setUnlocalizedName("Itemsoulshard").setTextureName("watwm:soul_shard").setCreativeTab(tabWeAreTheWarriorsMod);

    itemcorruptedsoulgem = new Itemcorruptedsoulgem().setUnlocalizedName("Itemcorruptedsoulgem").setTextureName("watwm:corrupted_soul_gem").setCreativeTab(tabWeAreTheWarriorsMod);

    itemdragonrod = new Itemdragonrod().setUnlocalizedName("Itemdragonrod").setTextureName("watwm:dragon_rod").setCreativeTab(tabWeAreTheWarriorsMod);

   

    GameRegistry.registerItem(itemsoulshard, itemsoulshard.getUnlocalizedName().substring(5));

    GameRegistry.registerItem(itemcorruptedsoulgem, itemcorruptedsoulgem.getUnlocalizedName().substring(5));

    GameRegistry.registerItem(itemdragonrod, itemdragonrod.getUnlocalizedName().substring(5));

   

    swordofcorruptedsouls = new ItemSwordofcorruptedsouls(corruptedToolMaterial).setUnlocalizedName("ItemSwordofcorruptedsouls").setTextureName("watwm:sword_of_corrupted_souls").setCreativeTab(tabWeAreTheWarriorsMod);

    dragonsword = new ItemDragonsword(dragonToolMaterial).setUnlocalizedName("ItemDragonsword").setTextureName("watwm:dragon_sword").setCreativeTab(tabWeAreTheWarriorsMod);

    ancientsword = new ItemAncientsword(ancientToolMaterial).setUnlocalizedName("ItemAncientsword").setTextureName("watwm:ancient_sword").setCreativeTab(tabWeAreTheWarriorsMod);

   

    GameRegistry.registerItem(swordofcorruptedsouls, swordofcorruptedsouls.getUnlocalizedName().substring(5));

    GameRegistry.registerItem(dragonsword, dragonsword.getUnlocalizedName().substring(5));

    GameRegistry.registerItem(ancientsword, ancientsword.getUnlocalizedName().substring(5));

   

 

   

    }

    @EventHandler

    public void init(FMLInitializationEvent event) {

   

    GameRegistry.addRecipe(new ItemStack(swordofcorruptedsouls), new Object[]{" A ", " A ", " B ", "A", itemcorruptedsoulgem, "B", Items.stick});

    GameRegistry.addRecipe(new ItemStack(dragonsword), new Object[]{" A ", " A ", " B ", "A", itemdragonrod, "B", Items.blaze_rod});

       

    }

    @EventHandler

    public void postInit(FMLPostInitializationEvent event) {

    }

    public static CreativeTabs tabWeAreTheWarriorsMod = new CreativeTabs("tabWeAreTheWarriorsMod"){

    @Override

    public Item getTabIconItem(){

    return itemcorruptedsoulgem;

    }

   

    };

    }

 

 

Link to comment
Share on other sites

GameRegistry.addRecipe(new ItemStack(swordofcorruptedsouls), new Object[]{" A ", " A ", " B ", "A", itemcorruptedsoulgem, "B", Items.stick});

Wrong.

 

addRecipe(new ItemStack(<ITEM>), new Object[] {"ABC", "DEF", "GHI", 'A', new ItemStack(<ITEM>), 'b', new ItemStack(<ITEM>), 'c', new ItemStack(<ITEM>)});

 

The Object array goes:

Row 1, Row 2, Row 3, Char 1, Definition for char 1, Char 2, Definition for Char 2, etc.

Link to comment
Share on other sites

diesieben07, would you be able to paste the actual code for the recipie for the two swords please, im just a little confused by this. im only a beginer this is my first mod. Thanks

Link to comment
Share on other sites

He gave you (almost) working code.

addRecipe(MyItems.someItem, "ABC", "DEF", "GHI",
    'A', MyItems.someOtherItem,
    'B', MyBlocks.someBlock,
    'C', new ItemStack(MyItems.item3, 1, 3));

If you don't understand it, you need to learn Java.

 

"x" - string

'x' - char

In your recipy, you define pattern using 3-letter strings like "XYZ" or "  X" or "X X" or whatever.

Then you associate a char 'X' 'Y' and 'Z' (or ANY other) with some item or itemstack (if you want to utilize itemstack's meta as ingredient).

It won't get simplier than that and you won't get working code here - forum is for Java coders and forge modders in need of help, not java kindergarten.

 

Again:

 

addRecipe(OUTPUT ITEMSTACK, 1PATTERN, 2PATTERN, 3PATTERN, CHAR, ASSOCIATED ITEM, CHAR, ASSOCIATED ITEM)

This will create 3x3 pattern in your crafting grid, and use CHAR and ASSOCIATED ITEM (always one after another) as key.

or

addRecipe(OUTPUT ITEMSTACK, PATTERN, CHAR, ASSOCIATED ITEM)

Will make 1x3 pattern with one definition.

 

Can i be more clear?

 

Btw. write in google something like: "GitHub <SomeModName>", you will probably find likt to src code and you can lookup all stuff you want.

https://github.com/Glitchfiend/BiomesOPlenty/blob/3cdb526f0defbcfe6f49153d01d9d601c5b31b20/src/main/java/biomesoplenty/common/core/BOPCrafting.java

1.7.10 is no longer supported by forge, you are on your own.

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.