Probleme avec un mob



  • Salut j'ai crée un mob y'a pas longtemps et j'ai fini de le mettre en place hier mais quand je run le jeu crash :
    :::

    [10:29:25] [Client thread/ERROR] [FML]: Caught exception from Modevent
    java.lang.NullPointerException
    at cpw.mods.fml.common.registry.EntityRegistry.doModEntityRegistration(EntityRegistry.java:171) ~[forgeSrc-1.7.10-10.13.3.1395-1710ls.jar:?]
    at cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityRegistry.java:150) ~[forgeSrc-1.7.10-10.13.3.1395-1710ls.jar:?]
    at fr.paladium.Modevent.Modevent.init(Modevent.java:40) ~[bin/:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532) ~[forgeSrc-1.7.10-10.13.3.1395-1710ls.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
    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 cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[forgeSrc-1.7.10-10.13.3.1395-1710ls.jar:?]
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[forgeSrc-1.7.10-10.13.3.1395-1710ls.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
    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 cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) [LoadController.class:?]
    at cpw.mods.fml.common.Loader.initializeMods(Loader.java:713) [Loader.class:?]
    at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:304) [FMLClientHandler.class:?]
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:597) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:942) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_51]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_51]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
    at GradleStart.main(Unknown Source) [start/:?]
    

    Class principale

    public void init(FMLInitializationEvent event)
       {
    proxy.registerRender();
    
        EntityRegistry.registerGlobalEntityID(Mobfuze.class, "fuzemob", EntityRegistry.findGlobalUniqueEntityId(), new Color(0, 255, 0).getRGB(), new Color(255, 0, 0).getRGB());
        EntityRegistry.registerModEntity(Mobfuze.class, "fuzemob", 440, this.instance, 40, 1, true);
    
       }
    

    :::
    Class du mob
    :::

    package fr.paladium.Modevent;
    
    import cpw.mods.fml.common.registry.GameRegistry;
    import net.minecraft.entity.SharedMonsterAttributes;
    import net.minecraft.entity.monster.EntityMob;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.world.World;
    
    public class Mobfuze extends EntityMob {
    
    public Mobfuze (World world)
    {
    super(world);
    
    }
    
    public void applyEntityAttributes()
    {
    super.applyEntityAttributes();
    this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(5000D);
    this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(4D);
    this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(9999999D);
    this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(30D);
    
    }
    
    public Item getDropItem()
    
    {
    Item item = GameRegistry.findItem("serveur", "Paladium");
    if(item != null)
    {
    
    return item;
    
    }
    else
    {
    return null;
    }
    }
    
    }
    
    

    :::
    Class render du mob
    :::

    package fr.paladium.Modevent;
    
    import net.minecraft.client.model.ModelBiped;
    import net.minecraft.client.renderer.entity.RenderBiped;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.util.ResourceLocation;
    
    public class RenderMobfuze extends RenderBiped{
    
    public final ResourceLocation texture = new ResourceLocation ("Modevent", "textures/entity/mobfuze.png");
    
    public RenderMobfuze (ModelBiped model, float shadow){
    
    super(model,shadow);
    }
    
    protected ResourceLocation getEntityTexture(EntityLiving living)
    {
    return this.getMobs((Mobfuze)living);
    }
    private ResourceLocation getMobs(Mobfuze Mobs)
    {
    return texture;
    }
    
    }
    

    :::



  • Salut
    Déjà de 1 -Pas de maj dans un modid : "Modevent" devrait être "modevent"
    Ensuite la variable proxy est une instance de CommonProxy ou ClientProxy ?
    Le problème semble venir de la ligne 40 de la classe ModEvent, dans la méthode init. SI tu pouvais nous indiquer c'est quelle ligne. C'est juste un NPE c'est facile à résoudre…



  • Ok merci pour l'info du modid
    Ligne 40 :      EntityRegistry.registerModEntity(Mobfuze.class, "fuzemob", 440, this.instance, 40, 1, true);



  • Ta variable instance doit être comme ceci, placée juste en dessous de la ligne StringMODID
    @Instance("modevent")
    public static ModEventinstance;


  • Administrateurs

    Problème d'ordre d'enregistrement :

    -Render, PUIS entité

    Ce qu'il faut faire :

    Entité, PUIS render…



  • Merci tous le monde j'ai résolu je change la balise



  • @Elias54 :
    Perso j'ai l'ordre Render PUIS Entité et ça ne perturbe en rien mon expérience de jeu ^^'