Jump to content

Recommended Posts

Posted

I have created 2 items that are exactly the same but only changing the names and textures, but i get an error:

 

OrbeMedio

package com.xelatercero.xelamod.orbemedio;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;

public class OrbeMedio extends Item {

public OrbeMedio() {
	final int NUMERO_ORBE_MAXIMO = 1;
	this.setMaxStackSize(NUMERO_ORBE_MAXIMO);
	this.setCreativeTab(CreativeTabs.MISC);
}

}

 

 

StartupClientOrbeMedio

 

 

package com.xelatercero.xelamod.orbemedio;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.client.model.ModelLoader;

public class StartupClientOrbeMedio {

public static void preInit() {
	ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation("xelamod:orbemedio", "inventory");
	ModelLoader.setCustomModelResourceLocation(StartupCommonOrbeMedio.orbeMedio, 0, itemModelResourceLocation);
}

public static void Init() {

}

public static void postInit() {

}

}

 

StartupCommonOrbeMedio

 

package com.xelatercero.xelamod.orbemedio;

import com.xelatercero.xelamod.itemhoja.OrbeBasico;

import net.minecraftforge.fml.common.registry.GameRegistry;

public class StartupCommonOrbeMedio {

public static OrbeMedio orbeMedio;

public static void preInitCommon() {
	orbeMedio = (OrbeMedio)(new OrbeBasico().setUnlocalizedName("Orbe Medio"));
	orbeMedio.setRegistryName("OrbeMedio");
	GameRegistry.register(orbeMedio);

}

public static void initCommon() {

}

public static void postInitCommon() {

}

}

 

ClientProxy:

 

package com.xelatercero.xelamod;

import com.xelatercero.xelamod.itemhoja.StartupClientOnly;
import com.xelatercero.xelamod.orbemedio.StartupClientOrbeMedio;

public class ClientProxy extends CommonProxy{

	public void preInit() {
		super.preInit();
		StartupClientOnly.preInit();
		StartupClientOrbeMedio.preInit();
	}

	public void Init() {
		super.Init();


	}

	public void postInit() {
		super.postInit();
	}


	@Override
	  public boolean isDedicatedServer() {return false;}
}

 

 

ServerProxy

 

package com.xelatercero.xelamod;

public class ServerProxy extends CommonProxy{

public void preInit() {
	super.preInit();
}

public void Init() {
	super.Init();
}

public void postInit() {
	super.postInit();
}


@Override
  public boolean isDedicatedServer() {return true;}
}

 

 

Packages:

 

width=432 height=552https://s17.postimg.org/4sq8l5ndr/enviar_orbe_medio.png[/img]subefotos

 

 

Error:

 

[11:43:41] [Client thread/ERROR] [FML]: Caught exception from xelamod
java.lang.ClassCastException: com.xelatercero.xelamod.itemhoja.OrbeBasico cannot be cast to com.xelatercero.xelamod.orbemedio.OrbeMedio
at com.xelatercero.xelamod.orbemedio.StartupCommonOrbeMedio.preInitCommon(StartupCommonOrbeMedio.java:12) ~[bin/:?]
at com.xelatercero.xelamod.CommonProxy.preInit(CommonProxy.java:11) ~[bin/:?]
at com.xelatercero.xelamod.ClientProxy.preInit(ClientProxy.java:9) ~[bin/:?]
at com.xelatercero.xelamod.xelamod.preInit(xelamod.java:23) ~[bin/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:599) ~[forgeSrc-1.10.2-12.18.2.2099.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
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:239) ~[forgeSrc-1.10.2-12.18.2.2099.jar:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217) ~[forgeSrc-1.10.2-12.18.2.2099.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
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:142) [LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:609) [Loader.class:?]
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:257) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
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_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
at GradleStart.main(GradleStart.java:26) [start/:?]
[11:43:41] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: ---- Minecraft Crash Report ----
// You should try our sister game, Minceraft!

Time: 20/10/16 11:43
Description: Initializing game

java.lang.ClassCastException: com.xelatercero.xelamod.itemhoja.OrbeBasico cannot be cast to com.xelatercero.xelamod.orbemedio.OrbeMedio
at com.xelatercero.xelamod.orbemedio.StartupCommonOrbeMedio.preInitCommon(StartupCommonOrbeMedio.java:12)
at com.xelatercero.xelamod.CommonProxy.preInit(CommonProxy.java:11)
at com.xelatercero.xelamod.ClientProxy.preInit(ClientProxy.java:9)
at com.xelatercero.xelamod.xelamod.preInit(xelamod.java:23)
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:599)
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:239)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217)
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:142)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:609)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:257)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:477)
at net.minecraft.client.Minecraft.run(Minecraft.java:386)
at net.minecraft.client.main.Main.main(Main.java:118)
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 com.xelatercero.xelamod.orbemedio.StartupCommonOrbeMedio.preInitCommon(StartupCommonOrbeMedio.java:12)
at com.xelatercero.xelamod.CommonProxy.preInit(CommonProxy.java:11)
at com.xelatercero.xelamod.ClientProxy.preInit(ClientProxy.java:9)
at com.xelatercero.xelamod.xelamod.preInit(xelamod.java:23)
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:599)
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:239)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217)
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:142)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:609)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:257)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:477)

-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:386)
at net.minecraft.client.main.Main.main(Main.java:118)
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.10.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_60, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 787835312 bytes (751 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.32 Powered by Forge 12.18.2.2099 4 mods loaded, 4 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] (forgeSrc-1.10.2-12.18.2.2099.jar) 
UCH	Forge{12.18.2.2099} [Minecraft Forge] (forgeSrc-1.10.2-12.18.2.2099.jar) 
UCE	xelamod{1.10.2-1.0} [xelamod] (bin) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 372.54' Renderer: 'GeForce GTX 750 Ti/PCIe/SSE2'
Launched Version: 1.10.2
LWJGL: 2.9.4
OpenGL: GeForce GTX 750 Ti/PCIe/SSE2 GL version 4.5.0 NVIDIA 372.54, NVIDIA Corporation
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: Yes
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: 8x AMD FX(tm)-8350 Eight-Core Processor 

 

 

Posted

this looks wrong for me:

 

orbeMedio = (OrbeMedio)(new OrbeBasico().setUnlocalizedName("Orbe Medio"));
	orbeMedio.setRegistryName("OrbeMedio");
	GameRegistry.register(orbeMedio);

 

Why are you casting (OrbeMedio) to OrbeBasico?

It should look like this:

orbeMedio = new OrbeMedio().setUnlocalizedName("orbemedio");
	orbeMedio.setRegistryName("orbemedio");
	GameRegistry.register(orbeMedio);

 

You also did not provide the code from OrbeBasico

Also don't forget to initialize your orbeMedio var :

public static Item orbeMedio;

Posted

i have done OrbeBasico like OrbeMedio and works fine no erros but when i ad this item i have taht error. My OrbeMedio classs extends Item so i only cast it in this line:

 

orbeMedio = (OrbeMedio)(new OrbeBasico().setUnlocalizedName("Orbe Medio"));

 

 

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.