Jump to content

[1.8] make my items work in a server. ¿ is my code wrong


perromercenary00

Recommended Posts

good nigths

 

i have this issue from some long weeks , and lately i have little time to spend whith code for working reasons.

 

i have made a lot of items , tools mostly  and some fireguns , all of them works well on single player but on a server do absolutly nothing and sometimes  disapear or become another items.

 

to aknowledge why is this happend i create a simple item a bow, reducing the code to the simples thing  trying to realize whats its making this items useless    but reach the point of not idea what its the trouble

 

in this video:

 

 

i set the server and the normal minecraft whith just mi mod and fireup the two at same time, in the first part i test the bow and the shotgun on a normal world in the vainilla minecraft and this two items work well, in the second part i test the items in the server world neither the shotgun or the bow works and the first shotgun becomes in to  two musrooms whithout aparent reason.

 

this is the code from the bow for now it just work whith vainilla arrows

 

arcoMercenario.java

package mercenarymod.items.arcos;

import mercenarymod.Mercenary;
import mercenarymod.items.MercenaryModItems;
import mercenarymod.utilidades.chat;
import mercenarymod.utilidades.nbtMercenaria;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class arcoMercenario extends Item
{
    
   
    public static String name = "arcoMercenario";
    
    int tick=0;
    int texturajson=0;
    boolean tighten=false;
    boolean animacion=false;
    boolean continuar=false;
        
    float f=0.0F;
    int municion=0;
    int municionMax=0;
    static int municionMax0=32;

    public arcoMercenario()
    {
    	
    	setUnlocalizedName(Mercenary.MODID + "_" + name);
    	GameRegistry.registerItem(this, name);
    	setCreativeTab(Mercenary.herramientas);
        this.maxStackSize = 1;
        this.setMaxDamage(500);
        
    }
    
  //######################################################################################3	
  	 @Override
  public ModelResourceLocation getModel(ItemStack arco, EntityPlayer playerIn, int useRemaining){
  	
  	ModelResourceLocation modelresourcelocation = new ModelResourceLocation("modmercenario:arcos/arcomercenario/arcomercenario00", "inventory");	 
  	animacion(arco, playerIn);
  	
  	if ((tick%10)==0){ //just to not check it every tick or  it lags
  		
  	animacion=nbtMercenaria.getBooleantag(arco, "animacion");
  	//System.out.println("Animacion="+animacion);
  		
  	if(!animacion){
  	
  	tighten=false;
  	
  	}
  	}
  		
  	//System.out.println("textura="+textura);
  	switch(this.texturajson){
    default:modelresourcelocation = new ModelResourceLocation("modmercenario:arcos/arcomercenario/arcomercenario00", "inventory") ;break;
  	case  1:modelresourcelocation = new ModelResourceLocation("modmercenario:arcos/arcomercenario/arcomercenario01", "inventory") ;break;
  	case  2:modelresourcelocation = new ModelResourceLocation("modmercenario:arcos/arcomercenario/arcomercenario02", "inventory") ;break;	
  	case  3:modelresourcelocation = new ModelResourceLocation("modmercenario:arcos/arcomercenario/arcomercenario03", "inventory") ;break;
  	    	                }
  	  	
  	tick++;
  	if (tick>100){tick=0;nbtMercenaria.setBooleantag(arco, "animacion",false);animacion=false;}
    	return modelresourcelocation;
    	
  		}

  //####################################################################################3	
  void animacion(ItemStack arco, EntityPlayer playerIn){	 //int tick
  	
  	//System.out.println("()this.thick="+tick+" cambioDeBotella="+cambioDeBotella+" giro="+giro);
  	 
  	 if ((tighten)){
  	 System.out.println("tighten="+tick);	 
  	 switch (tick){
  	 case 0:  texturajson=0;f=0.50F;break;
  	 case 7:  texturajson=1;f=1.00F;break;
  	 case 14: texturajson=2;f=1.50F;break;
  	 case 21: texturajson=3;f=2.00F;break;
  	 case 28: if(continuar){tick=20;};break;
  	 case 30: texturajson=0;tick=0;nbtMercenaria.setBooleantag(arco, "animacion",false);tighten=false;break;
  	          }   }
  	 else{texturajson=0;}
  	 
  	 
  	 
  }

//####################################################################################3		

void inicializar(ItemStack arco){  //this do nothing for now

int municion=0;
int metadata=arco.getMetadata();

switch(metadata){
case 1: municion=municionMax0/2;break;
case 2: municion=municionMax0;break;
default:municion=0;break;
            	}

nbtMercenaria.setInttag(arco, "municion", municion);
nbtMercenaria.setBooleantag(arco, "animacion", false);
nbtMercenaria.setBooleantag(arco, "liberar", false);
nbtMercenaria.setInttag(arco, "cargador", 0);
nbtMercenaria.setInttag(arco, "textura", 0);			


}
  
//####################################################################################3
    public void onPlayerStoppedUsing(ItemStack arco, World worldIn, EntityPlayer playerIn, int timeLeft)
    {
    	
    	
    	if (!worldIn.isRemote){
    		
    	playerIn.inventory.consumeInventoryItem(MercenaryModItems.flechaMercenaria);	
    		
    	EntityArrow entityarrow = new EntityArrow(worldIn, playerIn, f );	
    		
    	worldIn.spawnEntityInWorld(entityarrow);	
    	
    	chat.chatdp(playerIn, "shooting f="+f);
    	
    	f=0.0F;
    	
    	nbtMercenaria.setBooleantag(arco, "animacion", false);
    	    	
    		
    	                       }
    	
    	
    	
    	texturajson=0;tick=0;tighten=false;continuar=false;
    	
    }

    public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn)
    {
    	//texturajson=0;tick=0;tighten=false;
        return stack;
        
    }

    public int getMaxItemUseDuration(ItemStack stack)
    {
        return 72000;
    }

    public EnumAction getItemUseAction(ItemStack stack)
    {
        return EnumAction.BOW;
    }

    
    //#####################################################################################3
    public ItemStack onItemRightClick(ItemStack arco, World worldIn, EntityPlayer playerIn)
    {
    	
    	if (!worldIn.isRemote){
    		
    		if (playerIn.capabilities.isCreativeMode 
    		|| playerIn.inventory.hasItem(MercenaryModItems.flechaMercenaria)){ //mercenaryArrow
    		//|| playerIn.inventory.hasItem(Items.arrow)){
    		
    		//municion=nbtMercenaria.getInttag(arco, "municion"); //not now
    		nbtMercenaria.setBooleantag(arco, "animacion", true);
    		animacion=true;
    		tighten=true;   //  tight the bow 
    		//chat.chatdp(playerIn, "has item "+tick);
    		
    	                     }}
    	
    	
    	if (tighten){
    		playerIn.setItemInUse(arco, this.getMaxItemUseDuration(arco));	
    		tick=0;
    		continuar=true;     //  tighten it until i tell you to release the arrow
    		//chat.chatdp(playerIn, "En Uso"+tick);  // in use
    		}
    	
    	
      
        
        return arco;
    }

    public int getItemEnchantability()
    {
        return 1;
    }
}

 

 

what do you think i coulbe doing wrong ?

 

Link to comment
Share on other sites

    int tick=0;
    int texturajson=0;
    boolean tighten=false;
    boolean animacion=false;
    boolean continuar=false;
        
    float f=0.0F;
    int municion=0;
    int municionMax=0;

You can't do that, Item is just a singleton, shared between all items that use this class. You need to store NBT in ItemStack of Item.

http://www.minecraftforge.net/wiki/Creating_NBT_for_items

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

Link to comment
Share on other sites

not english

perfecto entonces

pero se quedan afuera los usuarios que solo hablan ingles,

 

por el lado de los nombres de las variables, creia que solo afectaban a esta instancia de este item especifico, a menos de que se declaren como public static, entonces si afectarian a todas las instancias de este mismo item, bueno mas tarde hago unas pruebas tengo eso en duda aun

 

hace tiempo trate de meter todas las variables como nbttags en el itemStack pero me estrelle con el problemita de que si trato de leer cada nbt cada tick entonces

int municion= nbtMercenaria.getInttag(arco, "municion");

int texturajson = nbtMercenaria.getInttag(arco, "texturajson");  //define la textura que se va  a usar en este instante

empiezan a devolver null, bueno por la forma en que hize la classe nbtMercenaria devuelve 9999 al encuentrar error al leer nbttag  asi que me frustre y deje de hacerlo de esa manera,  lo reduje a una sola nbttag "animacion" que solo se comprueba cada 10 tics y si es false no deja que el item cambie o actue de ninguna manera.

 

de cualquier manera ese es otro problema y otro post,

siendo este el unico arco en el servidor nada mas deberia interferir con el.

aun asi onItemRightClick  bueno en general las partes del codigo que se suponen corren cuando if (!worldIn.isRemote){} no estan funcionando, o hacen cosas raras 

 

bueno nunca e vista el codigo para un arma de fuego en minecraft todo esto que tengo hecho a salido de experimentar, preguntar en los foros y guiarme con lo que hay en la classe bow, y lo que me trae loco es ver que mi codigo funciona en el mundo normal pero no  funciona en el servidor,  entonces pense hay que hacer un arco sencillo  el arco vainilla funciona bien tanto en el mundo local como en el servidor asi que si hago un arco sencillo este deberia funcionar el server sin dar problemas , pero no lo hace  entonces  falta algo

 

 

for the names of the variables, i believe that only affect this instance of this specific item, unless it is declared as public static, then if would affect all instances of the same item, may is wrong but later test will done

 

time ago i try to  set all variables as nbttags in the itemStack but I stuck with this little problem, if I try to read every nbt each tick then

int ammunition = nbtMercenaria.getInttag (bow, "ammunition");

int texturajson = nbtMercenaria.getInttag (bow, "texturajson");  //set current texture for the item

they begin to return null, for the way I code the class nbtMercenaria it returns 9999 when it encounters an error reading nbt, just get tired of this and quit to do that way , so I reduced to a single nbttag "animation" this one is checked only every 10 tics and if false it shall not allow the item to changed or acts in any way.

 

anyway that's another problem and another post,

 

in this case

being the only bow on the server nothing else should interfere with it .

but still  onItemRightClick well the parts in the code that are supposed to run when if (! worldIn.isRemote) {} are not working, or do strange things.

 

well i never see the code the for a gun in minecraft before, all i have done has come from experiment whith code do questions on the forums and lok what is inside the bow class, drives me mad  see mi code work on normal minecraft, but do nothing when on a server, then i think  the bow class works well on normal and on server then if i do a custom bow based on thath code it may worksl, but  dont' it dont' work  there must be something i miss.

 

 

bueno gracias.

Link to comment
Share on other sites

bueno

 

its goes this way

the server i download for minecrafts web is minecraft_server.1.8.3.jar, when install forge it creates the minecraft_server.1.8.jar

 

so i launch the server whith

cd server/
java -Xmx1024M -Xms1024M -jar minecraft_server.1.8.jar 

 

and launch normal vainilla minecraft whith

java -jar Minecraft.jar

 

this two has the same forge version instaled  forge-1.8-11.14.1.1322-installer.jar

 

aniway i do the test launching minecraft_server.1.8.3.jar for server but happends the same.

mods are in  server/mods/

 

there is some command to return the list of mods the server has loaded ? may server is not loading the mod

 

Link to comment
Share on other sites

soo this was all about

 

i have wrong installed the forged server, an this is just the begin p

 

[18:42:32] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[18:42:32] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[18:42:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLServerTweaker
[18:42:33] [main/INFO] [FML]: Forge Mod Loader version 8.0.32.1322 for Minecraft 1.8 loading
[18:42:33] [main/INFO] [FML]: Java is Java HotSpot(TM) Server VM, version 1.7.0_76, running on Linux:i386:3.16.0-4-686-pae, installed at /usr/lib/jvm/java-7-oracle/jre
[18:42:33] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:42:33] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[18:42:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:42:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:42:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[18:42:35] [main/INFO] [FML]: Found valid fingerprint for Minecraft Forge. Certificate fingerprint e3c3d50c7c986df74c645c0ac54639741c90a557
[18:42:35] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[18:42:35] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[18:42:37] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[18:42:37] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[18:42:39] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.server.MinecraftServer}
[18:42:48] [server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Starting minecraft server version 1.8
[18:42:48] [server thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
[18:42:49] [server thread/INFO] [FML]: MinecraftForge v11.14.1.1322 Initialized
[18:42:49] [server thread/INFO] [FML]: Replaced 204 ore recipies
[18:42:49] [server thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
[18:42:50] [server thread/INFO] [FML]: Searching /home/tenchi/server/mods for mods
[18:42:51] [server thread/INFO] [modmercenario]: Mod modmercenario is missing the required element 'name'. Substituting modmercenario
[18:42:52] [server thread/INFO] [estructurasmercenarias]: Mod estructurasmercenarias is missing the required element 'name'. Substituting estructurasmercenarias
[18:42:52] [server thread/INFO] [FML]: Forge Mod Loader has identified 6 mods to load
[18:42:53] [server thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, modmercenario, examplemod, estructurasmercenarias] at CLIENT
[18:42:53] [server thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, modmercenario, examplemod, estructurasmercenarias] at SERVER
[18:42:57] [server thread/INFO] [FML]: Processing ObjectHolder annotations
[18:42:57] [server thread/INFO] [FML]: Found 384 ObjectHolder annotations
[18:42:57] [server thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[18:42:58] [server thread/INFO] [FML]: Applying holder lookups
[18:42:58] [server thread/INFO] [FML]: Holder lookups applied
[18:42:58] [server thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue
[18:42:58] [server thread/ERROR] [FML]: 
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{8.0.32.1322} [Forge Mod Loader] (forge-1.8-11.14.1.1322-universal.jar) Unloaded->Constructed->Pre-initialized
Forge{11.14.1.1322} [Minecraft Forge] (forge-1.8-11.14.1.1322-universal.jar) Unloaded->Constructed->Pre-initialized
modmercenario{1.5} [modmercenario] (modMercenario-1.6.jar) Unloaded->Constructed->Errored
examplemod{1.0} [Example Mod] (modMercenario-1.6.jar) Unloaded->Constructed->Pre-initialized
estructurasmercenarias{0.0} [estructurasmercenarias] (modMercenario-1.6.jar) Unloaded->Constructed->Pre-initialized
[18:42:58] [server thread/ERROR] [FML]: The following problems were captured during this phase
[18:42:58] [server thread/ERROR] [FML]: Caught exception from modmercenario
java.lang.NoClassDefFoundError: net/minecraft/client/settings/KeyBinding
at mercenarymod.utilidades.KeyBindings.init(KeyBindings.java:23) ~[KeyBindings.class:?]
at mercenarymod.Mercenary.preInit(Mercenary.java:57) ~[Mercenary.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_76]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:517) ~[FMLModContainer.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_76]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_76]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:514) [Loader.class:?]
at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:88) [FMLServerHandler.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:355) [FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:117) [po.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_76]
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.settings.KeyBinding
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.11.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_76]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_76]
... 34 more
Caused by: java.lang.NullPointerException
[18:42:58] [server thread/ERROR] [net.minecraft.server.MinecraftServer]: Encountered an unexpected exception
net.minecraftforge.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/settings/KeyBinding
at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:162) ~[LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:516) ~[Loader.class:?]
at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:88) ~[FMLServerHandler.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:355) ~[FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:117) ~[po.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_76]
Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/settings/KeyBinding
at mercenarymod.utilidades.KeyBindings.init(KeyBindings.java:23) ~[KeyBindings.class:?]
at mercenarymod.Mercenary.preInit(Mercenary.java:57) ~[Mercenary.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_76]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:517) ~[FMLModContainer.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_76]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_76]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) ~[LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:514) ~[Loader.class:?]
... 5 more
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.settings.KeyBinding
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.11.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_76]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_76]
at mercenarymod.utilidades.KeyBindings.init(KeyBindings.java:23) ~[KeyBindings.class:?]
at mercenarymod.Mercenary.preInit(Mercenary.java:57) ~[Mercenary.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_76]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:517) ~[FMLModContainer.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_76]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_76]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_76]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_76]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_76]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) ~[LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:514) ~[Loader.class:?]
... 5 more
Caused by: java.lang.NullPointerException
[18:42:58] [server thread/ERROR] [net.minecraft.server.MinecraftServer]: This crash report has been saved to: /home/tenchi/server/./crash-reports/crash-2015-03-05_18.42.58-server.txt

 

mi code is full of errors that crash server

and is curious coz  eclipse tell mi nothing about all this, and normal minecraft either show errors in the console it just works 

 

arrfff

what comes next s a long journey of remake the mod looking in every class for the defectives lines an maiby redoo the code for the more complez tools

Link to comment
Share on other sites

Your crash is because you referenced an @SideOnly(Side.CLIENT) class (KeyBinding) somewhere in your code that is not only on the client side.

 

If you have keybindings, you should only register them through your ClientProxy - same with any Render classes and that type of thing.

 

Btw, the visibility and 'static'-ness of a class member has no impact on whether it actually behaves as a static member: every single Item is declared as a singleton, thus only one of each item exists and thus every Item class' members automatically behave as though they were static, because there is only ONE instance. Make sense?

Link to comment
Share on other sites

yap  but

 

I alredy  take another way, an in that way another troubles apear  the keybind i shall solv later,

 

well tere is not only the keybind error but a lot of diferent things failing in the logs , so i decide to clean up.

I download the lastest version of forge and start again,

 

just the basic mercenarimod whith the first basic 10 materials, the bow and the arrow

so until this, all works well on eclipse, compile the mod, and put it on the server  now get

 

[20:54:03] [server thread/ERROR] [FML]: Caught exception from modmercenario
java.lang.NoClassDefFoundError: net/minecraft/client/Minecraft
at mercenarymod.Mercenary.init(Mercenary.java:67) ~[Mercenary.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_76] 


 

there is an error in the line 67 from mi main class and that is in the textures part 

 

    @Mod.EventHandler
    public void init(FMLInitializationEvent event) {
    
    	// materials
    		
    		
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.aceroMercenario,0,new     //this is line 67     
                ModelResourceLocation("modmercenario:aceromercenario", "inventory"));  //steel
    		
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.redstoneMercenaria,0 , 
    		new ModelResourceLocation("modmercenario:redstonemercenaria", "inventory"));  
    				
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.carbonoMercenario,0 , 
    		new ModelResourceLocation("modmercenario:carbonomercenario", "inventory"));   //graphene
    				
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.inertebarradeCarbon,0 , 
    		new ModelResourceLocation("modmercenario:inertebarradecarbon", "inventory"));  //graphene bar
    		
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.hierroAlrojo,0 , 
    		new ModelResourceLocation("modmercenario:hierroalrojo", "inventory"));  //red hot iron
    			
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.coalCompreso,0 , 
    		new ModelResourceLocation("modmercenario:coalcompreso", "inventory"));
    				
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.charcoalCompreso,0 , 
    		new ModelResourceLocation("modmercenario:charcoalcompreso", "inventory"));
    		
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.obsidianaMercenaria,0 , 
    		new ModelResourceLocation("modmercenario:obsidianamercenaria", "inventory"));
    		
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.nokiaMercenaria,0 , 
    		new ModelResourceLocation("modmercenario:nokiamercenaria", "inventory"));  //nokia material just for fun 
    		
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.barradeAcero,0 , 
    		new ModelResourceLocation("modmercenario:barradeacero", "inventory"));   //steel pipe 
    					
    		
    		//bows
    	        ModelBakery.addVariantName(MercenaryModItems.arcoMercenario, new String[]{
    	    		
    	    		"modmercenario:arcos/arcomercenario/arcomercenario00",
    	    		"modmercenario:arcos/arcomercenario/arcomercenario01",
    	    		"modmercenario:arcos/arcomercenario/arcomercenario02",
    	    		"modmercenario:arcos/arcomercenario/arcomercenario03",
    	    		"modmercenario:arcos/arcomercenario/flechaMercenaria" });
    	    
    	    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.arcoMercenario,0 , 
    	    new ModelResourceLocation("modmercenario:arcos/arcomercenario/arcomercenario00", "inventory"));
    	    		
            //arrows
    	    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(MercenaryModItems.flechaMercenaria,0 , 
    	    new ModelResourceLocation("modmercenario:arcos/arcomercenario/flechaMercenaria", "inventory"));
    	    	    
    }

 

for some reason the sever dont like the way i declare the textures for the items

 

repet miself in eclipse it gives no error of any kind this 12 items works and has their current texture at display, everiting is normal the errors ocurr in the server console at the moment of fire up server

 

 

very tankfull

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.