TileEntity Item qui disparaissent
-
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
à mettre à la fin de la fonction. -
tu a répondu super vite merci mais çà marche pas
-
J’ai un lecteur de flux RSS sur mon pc, il me prévient dès qu’il y a une nouvelle discussion sur le fofo.
Essayes avec la fonction this.makeDirty();
-
non plus dommage
–-----------------
à noter que les items disparaissent si je quitte le gui
-
Tu appelles la fonction retirer où ?
-
dans le gui quand j’appuye sur le bouton mais je pense pas que ce soit çà : quand j’appelai retirer ou test dans le updateEntitu çà marchiat pas non plus par contre si je crée un item directement de le updateEntity çà marche ; de plus lorsque je met un item dans le slot je peut le récuperez et il ne disparait pas quand je sors du gui
-
En effet, si tu as un bouton sur le gui il faut passer par un paquet.
-
un paquet ? qu est ce que c’est ? j’ai l’impression d’étre un inculte un profane
-
-
merciiiii robin . (sur le ton des alcoolique anonyme)
-
network.registerMessage(PacketDistributeur.Handler.class, PacketDistributeur.class, 0, Side.SERVER);
package com.mathiasetampes.entreprise.common; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.Container; import io.netty.buffer.ByteBuf; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; public class PacketDistributeur implements IMessage { private int money; public PacketDistributeur(int money) { this.money = money; } public PacketDistributeur() { } @Override public void fromBytes(ByteBuf buf) { this.money = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(money); } public class Handler implements IMessageHandler <packetdistributeur,imessage>{ @Override public IMessage onMessage(PacketDistributeur message, MessageContext ctx) { EntityPlayerMP player = ctx.getServerHandler().playerEntity; Container c = player.openContainer; if(c instanceof ContainerDistributeur) { TileEntityDistributeur tile = ((ContainerDistributeur)c).getTileDistributeur(); tile.retirer(money); } return null; } } }et l’erreur
:::
[08:53:00] [Client thread/ERROR] [FML]: Caught exception from entreprise
java.lang.RuntimeException: java.lang.InstantiationException: com.mathiasetampes.entreprise.common.PacketDistributeur$Handler
at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-17.0.jar:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.instantiate(SimpleNetworkWrapper.java:116) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?]
at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:106) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?]
at com.mathiasetampes.entreprise.common.Entreprise.preInit(Entreprise.java:89) ~[bin/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_75]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_75]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_75]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_75]
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_75]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_75]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_75]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_75]
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:208) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?]
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_75]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_75]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_75]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_75]
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:118) [LoadController.class:?]
at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) [Loader.class:?]
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:931) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_75]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_75]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_75]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_75]
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/:?]
Caused by: java.lang.InstantiationException: com.mathiasetampes.entreprise.common.PacketDistributeur$Handler
at java.lang.Class.newInstance(Class.java:364) ~[?:1.7.0_75]
at cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper.instantiate(SimpleNetworkWrapper.java:113) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?]
… 41 more
:::</packetdistributeur,imessage> -
public class Handler implements IMessageHandler <packetdistributeur,imessage>->
public static class Handler implements IMessageHandler<packetdistributeur,imessage></packetdistributeur,imessage></packetdistributeur,imessage> -
a oui c’est vrai merci