Résolu #1.12.2 - Problème : slots container / entity / ghostblocks
-
Yo, tout le monde
Des problèmes, toujours des problèmes….J’ai créer un blocks type quarry (like buildcraft) sauf que bah quand je fait un world#setBlockair ou dektroyBlock, jai un ghostblocks qui apparait (Class du TE)
ensuite avec le container de ce même block, les slots du player inventory sont placé n’importe comment (Class du container)
et pour fini j’ai “essayé” de créer une entity tout ce quil y a de plus basique (en gros une petite bouboule pour faire jolie) (Class RenderEntityQuarryMiner, ModelQuarryMiner, EntityQuarryMiner, main class pour le registry)
j’arrive a avoir l’entity en faisant /summon mais elle apparait pas dans le mondesi quelqu’un aurait l’amabilité de bien vouloir m’aider, j’en serait très content, car j’en n’ai mare de suivre des vieux tutos tout claquer qui me mène a rien
Merci encore de m’aider a résoudre mes problèmes si toutefois vous y parvenez
-
Salut,
il se trouve que le gui est coté client, donc le bouton n’active la quarry uniquement coté client. (-> packets !) -
srx je pensais pas que cela se comportais ainsi
donc je dois utiliser les packets par contre je ne sais pas du tout comment faire (j’ai jamais utiliser de packets)
peut-tu m’indiquer la marche a suivre plz ? -
Je sais pas si ça a changé des masses depuis la 1.7.2/1.7.10 mais ce tuto est bien pour apprendre a manier les packets
-
merci
-
Coucou tout le monde, comme je ne sais pas use les packets bah je sais pas trop résoudre ca
net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Basic Machines (basicmachines) Caused by: java.lang.NullPointerException at net.spyman.basicmachines.common.BasicMachines.init(BasicMachines.java:59) 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:498) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:608) 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:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26)
je pense aussi que mes class <implements IMessage>et <implements IMessageHandler>ne pas correctement construites
-
Tu appelles le champ network mais tu ne l’as pas instancié (tu l’as bien déclaré mais pas défini) ce qui explique un NullPointerException.
Je te conseille cette vidéo pour apprendre a lire les crash logs car c’est une erreur commune et facile a résoudre quand on commence a toucher au modding.
Je ne te donne pas le code directement mais si tu comprends la vidéo tu seras la corrger par toi même ce qui te feras progresser. Je suis passé par là aussi, comme a peu près tout le monde je pense.
PS : pour peu de ligne de code comme un paquet essaie de mettre ton code directement sur le forum, c’est moins long pour nous de t’aider
PS 2 : Si quelqu’un de plus expérimenté se rend compte que mon vocabulaire n’est pas au point n’hésitez pas à me reprendre surtout. -
ok je suis aveugle j’avais pas vu que javais oublier le network = …
bon c’est bon mon network n’est plus null mais j’ai un autre problème quand le sendToServer();
(appleler quand je click sur un button dans ma class de Gui (GuiBlockQuarry)14:42:54] [Netty Server IO #1/ERROR]: FMLIndexedMessageCodec exception caught io.netty.handler.codec.DecoderException: java.lang.InstantiationException: net.spyman.basicmachines.common.packet.MessageBlockQuarry at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98) ~[MessageToMessageDecoder.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [DefaultChannelPipeline$HeadContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [DefaultChannelPipeline.class:4.1.9.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:274) [EmbeddedChannel.class:4.1.9.Final] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:108) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:155) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:49) [NetworkManager.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [SimpleChannelInboundHandler.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleServerSideCustomPacket(NetworkDispatcher.java:446) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:268) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:72) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [SimpleChannelInboundHandler.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [DefaultChannelPipeline$HeadContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [DefaultChannelPipeline.class:4.1.9.Final] at io.netty.channel.local.LocalChannel.finishPeerRead0(LocalChannel.java:443) [LocalChannel.class:4.1.9.Final] at io.netty.channel.local.LocalChannel.access$500(LocalChannel.java:49) [LocalChannel.class:4.1.9.Final] at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:397) [LocalChannel$5.class:4.1.9.Final] at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [AbstractEventExecutor.class:4.1.9.Final] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) [SingleThreadEventExecutor.class:4.1.9.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442) [NioEventLoop.class:4.1.9.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [SingleThreadEventExecutor$5.class:4.1.9.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121] Caused by: java.lang.InstantiationException: net.spyman.basicmachines.common.packet.MessageBlockQuarry at java.lang.Class.newInstance(Class.java:427) ~[?:1.8.0_121] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:99) ~[FMLIndexedMessageToMessageCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:38) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) ~[MessageToMessageDecoder.class:4.1.9.Final] … 35 more Caused by: java.lang.NoSuchMethodException: net.spyman.basicmachines.common.packet.MessageBlockQuarry.<init>() at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_121] at java.lang.Class.newInstance(Class.java:412) ~[?:1.8.0_121] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:99) ~[FMLIndexedMessageToMessageCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:38) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) ~[MessageToMessageDecoder.class:4.1.9.Final] … 35 more [14:42:54] [Netty Server IO #1/ERROR]: SimpleChannelHandlerWrapper exception io.netty.handler.codec.DecoderException: java.lang.InstantiationException: net.spyman.basicmachines.common.packet.MessageBlockQuarry at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98) ~[MessageToMessageDecoder.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [DefaultChannelPipeline$HeadContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [DefaultChannelPipeline.class:4.1.9.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:274) [EmbeddedChannel.class:4.1.9.Final] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:108) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:155) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:49) [NetworkManager.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [SimpleChannelInboundHandler.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleServerSideCustomPacket(NetworkDispatcher.java:446) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:268) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:72) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [SimpleChannelInboundHandler.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [DefaultChannelPipeline$HeadContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [DefaultChannelPipeline.class:4.1.9.Final] at io.netty.channel.local.LocalChannel.finishPeerRead0(LocalChannel.java:443) [LocalChannel.class:4.1.9.Final] at io.netty.channel.local.LocalChannel.access$500(LocalChannel.java:49) [LocalChannel.class:4.1.9.Final] at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:397) [LocalChannel$5.class:4.1.9.Final] at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [AbstractEventExecutor.class:4.1.9.Final] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) [SingleThreadEventExecutor.class:4.1.9.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442) [NioEventLoop.class:4.1.9.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [SingleThreadEventExecutor$5.class:4.1.9.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121] Caused by: java.lang.InstantiationException: net.spyman.basicmachines.common.packet.MessageBlockQuarry at java.lang.Class.newInstance(Class.java:427) ~[?:1.8.0_121] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:99) ~[FMLIndexedMessageToMessageCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:38) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) ~[MessageToMessageDecoder.class:4.1.9.Final] … 35 more Caused by: java.lang.NoSuchMethodException: net.spyman.basicmachines.common.packet.MessageBlockQuarry.<init>() at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_121] at java.lang.Class.newInstance(Class.java:412) ~[?:1.8.0_121] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:99) ~[FMLIndexedMessageToMessageCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:38) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) ~[MessageToMessageDecoder.class:4.1.9.Final] … 35 more [14:42:54] [Netty Server IO #1/ERROR]: There was a critical exception handling a packet on channel basicmachines:channel1 io.netty.handler.codec.DecoderException: java.lang.InstantiationException: net.spyman.basicmachines.common.packet.MessageBlockQuarry at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98) ~[MessageToMessageDecoder.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) ~[DefaultChannelPipeline$HeadContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) ~[DefaultChannelPipeline.class:4.1.9.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:274) ~[EmbeddedChannel.class:4.1.9.Final] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:108) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:155) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:49) [NetworkManager.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [SimpleChannelInboundHandler.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleServerSideCustomPacket(NetworkDispatcher.java:446) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:268) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:72) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [SimpleChannelInboundHandler.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [DefaultChannelPipeline$HeadContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [DefaultChannelPipeline.class:4.1.9.Final] at io.netty.channel.local.LocalChannel.finishPeerRead0(LocalChannel.java:443) [LocalChannel.class:4.1.9.Final] at io.netty.channel.local.LocalChannel.access$500(LocalChannel.java:49) [LocalChannel.class:4.1.9.Final] at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:397) [LocalChannel$5.class:4.1.9.Final] at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [AbstractEventExecutor.class:4.1.9.Final] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) [SingleThreadEventExecutor.class:4.1.9.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442) [NioEventLoop.class:4.1.9.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [SingleThreadEventExecutor$5.class:4.1.9.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121] Caused by: java.lang.InstantiationException: net.spyman.basicmachines.common.packet.MessageBlockQuarry at java.lang.Class.newInstance(Class.java:427) ~[?:1.8.0_121] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:99) ~[FMLIndexedMessageToMessageCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:38) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) ~[MessageToMessageDecoder.class:4.1.9.Final] … 35 more Caused by: java.lang.NoSuchMethodException: net.spyman.basicmachines.common.packet.MessageBlockQuarry.<init>() at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_121] at java.lang.Class.newInstance(Class.java:412) ~[?:1.8.0_121] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:99) ~[FMLIndexedMessageToMessageCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:38) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.1.9.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) ~[MessageToMessageDecoder.class:4.1.9.Final] … 35 more [14:42:54] [Netty Server IO #1/ERROR]: Network Disconnect: A fatal error has occurred, this connection is terminated
-
Envoie les classes concernées en pastebin ça sera plus simple, on n’a pas que ça à faire de dl le src
-
package net.spyman.basicmachines.common; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; import net.spyman.basicmachines.client.events.ClientEventHandler; import net.spyman.basicmachines.common.blocks.BMBlocks; import net.spyman.basicmachines.common.items.BMItems; import net.spyman.basicmachines.common.packet.MessageBlockQuarry; @Mod(modid = "basicmachines", name = "BasicMachines", version = "1.0") public class BasicMachines { // Mod id field public static final String MODID = "basicmachines"; // Mod id + ':' field for resource location prefix public static final String RPREFIX = MODID + ":"; // Insatance field; @Mod.Instance("basicmachines") public static BasicMachines instance; // Network packets field public static SimpleNetworkWrapper network; // Creative tab public static CreativeTabs BM_TAB = new CreativeTabs("bm_tab") { @Override public ItemStack getTabIconItem() { return new ItemStack(BMBlocks.BLOCK_QUARRY); } }; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { new BMBlocks(); new BMItems(); } @Mod.EventHandler public void init(FMLInitializationEvent event) { NetworkRegistry.INSTANCE.registerGuiHandler(this, new BMGuiHandler()); if (event.getSide().isClient()) { MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); } network = NetworkRegistry.INSTANCE.newSimpleChannel(RPREFIX + "channel1"); network.registerMessage(MessageBlockQuarry.Handler.class, MessageBlockQuarry.class, 0, Side.SERVER); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { } }
package net.spyman.basicmachines.common.packet; import io.netty.buffer.ByteBuf; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class MessageBlockQuarry implements IMessage { private String value = "false"; public MessageBlockQuarry(String v) { this.value = v; } @Override public void fromBytes(ByteBuf buf) { this.value = ByteBufUtils.readUTF8String(buf); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, this.value); } public static class Handler implements IMessageHandler <messageblockquarry, imessage="">{ @Override public IMessage onMessage(MessageBlockQuarry message, MessageContext ctx) { System.out.println(message.value); return null; } } }
package net.spyman.basicmachines.client.gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraft.util.ResourceLocation; import net.spyman.basicmachines.client.gui.components.GuiSwitchButton; import net.spyman.basicmachines.common.BasicMachines; import net.spyman.basicmachines.common.blocks.tileentities.TEBlockQuarry; import net.spyman.basicmachines.common.containers.ContainerBlockQuarry; import net.spyman.basicmachines.common.packet.MessageBlockQuarry; import java.awt.*; import java.io.IOException; public class GuiBlockQuarry extends GuiContainer { private final ResourceLocation texture = new ResourceLocation(BasicMachines.RPREFIX + "textures/gui/container/gui_quarry.png"); private TEBlockQuarry tile; private String title = I18n.format("gui.block_quarry.title"); private int x = 0; private int y = 0; private int bh = 7; private int bw = 15; private int color = new Color(21, 21, 21).getRGB(); private GuiSwitchButton switchButton; /* **** AREA BOUNDS **** */ private int sx = 0; private int sy = 0; private int sz = 0; /* **** AREA BOUNDS **** */ private boolean isActive = false; private ContainerBlockQuarry container; public GuiBlockQuarry(TEBlockQuarry tile, ContainerBlockQuarry container) { super(container); this.container = container; this.tile = tile; this.xSize = 176; this.ySize = 199; this.sx = tile.getSizeX(); this.sy = tile.getStopY(); this.sz = tile.getSizeZ(); this.isActive = tile.isActivated(); } @Override public void initGui() { this.x = (this.width - this.xSize) / 2; this.y = (this.height - this.ySize) / 2; this.switchButton = new GuiSwitchButton(6, (4 + x + 20 + 10 * 5) + 23, y + 81, 65, 20, I18n.format("gui.block_quarry.button.activated", this.isActive)); this.addButton(new GuiButton(0, 4 + x + 10, 10 + y + 50 + 15, this.bw, this.bh, "+")); this.addButton(new GuiButton(1, 4 + x + 10, y + 100, this.bw, this.bh, "-")); this.addButton(new GuiButton(2, 4 + x + 10 + 10 * 3, 10 + y + 50 + 15, this.bw, this.bh, "+")); this.addButton(new GuiButton(3, 4 + x + 10 + 10 * 3, y + 100, this.bw, this.bh, "-")); this.addButton(new GuiButton(4, 4 + x + 20 + 10 * 5, 10 + y + 50 + 15, this.bw, this.bh, "+")); this.addButton(new GuiButton(5, 4 + x + 20 + 10 * 5, y + 100, this.bw, this.bh, "-")); this.addButton(this.switchButton); // ID = 6 } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(this.texture); this.drawTexturedModalRect(this.x, this.y, 0, 0, this.xSize, this.ySize); } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { this.mc.fontRenderer.drawString(this.title, (float)(this.width - this.mc.fontRenderer.getStringWidth(this.title)) / 2, (float)this.y + 9, this.color, false); this.mc.fontRenderer.drawString(" X Y Z", x + 13, y + 62, this.color, false); this.mc.fontRenderer.drawString(this.sx + "", (float)5 +x + 10, (float)12 + y + this.bh + 4 + 50 + 15, this.color, false); this.mc.fontRenderer.drawString(this.sy + "", (float)5 + x + 10 + 10 * 3, (float)12 + y + this.bh + 4 + 50 + 15, this.color, false); this.mc.fontRenderer.drawString(this.sz + "", (float)5 + x + 20 + 10 * 5, (float)12 + y + this.bh + 4 + 50 + 15, this.color, false); } @Override protected void actionPerformed(GuiButton button) throws IOException { super.actionPerformed(button); if (button.id == 0) this.sx++; if (button.id == 1) this.sx–; if (button.id == 2) this.sy++; if (button.id == 3) this.sy--; if (button.id == 4) this.sz++; if (button.id == 5) this.sz--; if (button.id == 6) { this.tile.setActivated(this.switchButton.getState()); BasicMachines.network.sendToServer(new MessageBlockQuarry(this.switchButton.getState() + "")); } if (this.sx < 0) this.sx = 0; if (this.sy < 0) this.sy = 0; if (this.sz < 0) this.sz = 0; this.tile.setAreaBounds(this.sx, this.sz, this.sy); } } ```</messageblockquarry,>
-
Pourquoi ne pas utiliser un booléen à la place d’un String, je vois que tu set v sur “false”, quel intérêt ? Et donne le même nom à ta variable “value”, renomme-la v, ce qui doit te donner this.v = v, sinon quel intérêt de mettre this ?
-
Chacun sa façon de mettre en forme son code et de nommer ses vars, et si j’ai mit un string c’est pour une bonne raison a moins que cela ne pose soucis
-
Il te faut un constructeur vide (sans paramètres) en plus pour ton MessageBlockQuarry. Ça sert à forge pour instancier la class quand le message est reçu.