Register Entity
-
yo, ton entity doit être extends EntityThrowable et tu l’enregistre avec le EntityRegistry
ou sinon fait un new EntitySnowball et en paramétre dans le constructeur tu peut mettre un itemstack je crois et ca place automatiquement la texture -
@‘SpyMan’:
yo, ton entity doit être extends EntityThrowable et tu l’enregistre avec le EntityRegistry
ou sinon fait un new EntitySnowball et en paramétre dans le constructeur tu peut mettre un itemstack je crois et ca place automatiquement la textureSalut,
Alors déjà merci de ta réponse, je suis déjà passer par EntityThrowable donc pas de problème sur ça. Il est pas faux que être directement extends de entitysnowball aurait pu être une solution mais je trouve plus pratique de créer directement une entité nouvelle. Du coup comment ça s’utilise le EntityRegistry ? Aurais-tu un exemple simple juste que je le reprenne pour mon cas ? ^^
Merci d’avance :-3
-
Faut utiliser la fonction registerModEntity, ça n’a pas changé depuis un bon moment.
Il y a juste un argument en plus, la location de ressource. (mets simplement modid:nom de l’entité) -
@‘robin4002’:
Faut utiliser la fonction registerModEntity, ça n’a pas changé depuis un bon moment.
Il y a juste un argument en plus, la location de ressource. (mets simplement modid:nom de l’entité)Hum malgré ça je bloque sur la location de ressource, ça doit être juste un truc tout bête que j’oublie car je l’ai jamais fait x)
EntityRegistry.registerModEntity(Reference.MOD_ID+":entitydynamite",EntityDynamite.class, "entitydynamite", Reference.MOD_ID, Reference.MOD_NAME, 64, 1, true);C’est un string à la place d’un ResourceLocation, comment je règle ce soucis ?

Merci en tout cas de ton aide ^^
-
new ResourceLocation(Reference.MOD_ID, “entitydynamite”) en premier argument.
-
@‘robin4002’:
new ResourceLocation(Reference.MOD_ID, “entitydynamite”) en premier argument.
Ca fixe effectivement le problème que j’avais ^^
Maintenant j’ai un problème de crash surement car j’ai du oublier quelque d’important je suppose
Voici ma class ou je fais le register de l’entité:
package fr.jules552.mod.init; import fr.jules552.mod.Reference; import fr.jules552.mod.init.Adamantium.EntityDynamite; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.registry.EntityRegistry; @EventBusSubscriber(modid = Reference.MOD_ID) public class EntitiesMod { public static void registerModEntity () { EntityRegistry.registerModEntity(new ResourceLocation(Reference.MOD_ID, "entitydynamite"),EntityDynamite.class, "entitydynamite", 1, Reference.MOD_NAME, 64, 1, true); } }il faut donc je suppose mettre
EntitiesMod.registerModEntity();quelque part sans mes proxy, surement dans les commons mais je peux me tromper donc n’hésitez pas à me dire ou je me trompe.
Du coup où est mon erreur ? :s -
Dans la classe principale ou dans le common.
Quel est le crash ? -
@‘robin4002’:
Dans la classe principale ou dans le common.
Quel est le crash ?Time: 12/16/17 6:52 PM Description: There was a severe problem during mod loading that has caused the game to fail net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Adamantium (adamantium) Caused by: java.lang.NullPointerException at net.minecraftforge.fml.common.registry.EntityRegistry.doModEntityRegistration(EntityRegistry.java:185) at net.minecraftforge.fml.common.registry.EntityRegistry.registerModEntity(EntityRegistry.java:151) at fr.jules552.mod.init.EntitiesMod.registerModEntity(EntitiesMod.java:15) at fr.jules552.mod.proxy.CommonProxy.init(CommonProxy.java:39) at fr.jules552.mod.proxy.ClientProxy.init(ClientProxy.java:22) at fr.jules552.mod.Adamantium.init(Adamantium.java:41) 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:608) 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.Subscriber.invokeSubscriberMethod(Subscriber.java:91) at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) at com.google.common.eventbus.EventBus.post(EventBus.java:217) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:253) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:231) 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.Subscriber.invokeSubscriberMethod(Subscriber.java:91) at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) at com.google.common.eventbus.EventBus.post(EventBus.java:217) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:148) at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:719) at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:352) at net.minecraft.client.Minecraft.init(Minecraft.java:581) at net.minecraft.client.Minecraft.run(Minecraft.java:421) 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: –------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_151, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 811638024 bytes (774 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.42 Powered by Forge 14.23.1.2555 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 | State | ID | Version | Source | Signature | |:----- |:---------- |:------------ |:-------------------------------- |:--------- | | UCHI | minecraft | 1.12.2 | minecraft.jar | None | | UCHI | mcp | 9.42 | minecraft.jar | None | | UCHI | FML | 8.0.99.99 | forgeSrc-1.12.2-14.23.1.2555.jar | None | | UCHI | forge | 14.23.1.2555 | forgeSrc-1.12.2-14.23.1.2555.jar | None | | UCHE | adamantium | 1.0.0 | bin | None | Loaded coremods (and transformers): GL info: ' Vendor: 'Intel' Version: '4.3.0 - Build 20.19.15.4624' Renderer: 'Intel(R) HD Graphics 4600' [18:52:57] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:630]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\xxjul\Desktop\Forge\run\.\crash-reports\crash-2017-12-16_18.52.57-client.txt AL lib: (EE) alc_cleanup: 1 device not closed Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future releaseVoilà le crash
Sinon je le met dans le init dans les commons -
Reference.MOD_NAME devrait être l’instance du mod, pas le modid
-
@‘robin4002’:
Reference.MOD_NAME devrait être l’instance du mod, pas le modid
Effectivement, erreur de ma part quand j’ai recorrigé ^^
Tout fonctionne bien maintenant !Merci à vous deux et passé une bonne soirée je clôture le sujet
