Problème IGUIHandler
-
D’accord j’essaye ça je te dis des nouvelles,
en gros moi aymeric se que je veux faire c’est remplacer l’inv vanilla oui, je les cancelled en solo mais en multi non pour les construction etc ^^.
Résultat: l’inv s’ouvre plus d’érreur niquel mais j’ai encore un soucis il save pas mon item! c’est chiant ça je vois pas d’ou ça vient .EDIT: ah si finalement j’ai un soucis (quand j’ouvre l’inventaire que je ferme puis que je réouvre j’ai ça

[19:21:48] [Client thread/ERROR] [FML]: Detected ongoing potential memory leak. 100 packets have leaked. Top offenders [19:21:48] [Client thread/ERROR] [FML]: amm: : 100 [19:21:52] [Client thread/ERROR] [FML]: Detected ongoing potential memory leak. 200 packets have leaked. Top offenders [19:21:52] [Client thread/ERROR] [FML]: amm: : 200 [19:21:53] [Client thread/ERROR] [FML]: Detected ongoing potential memory leak. 300 packets have leaked. Top offenders [19:21:53] [Client thread/ERROR] [FML]: amm: : 300 [19:21:54] [Client thread/ERROR] [FML]: Detected ongoing potential memory leak. 400 packets have leaked. Top offenders [19:21:54] [Client thread/ERROR] [FML]: amm: : 400 [19:21:56] [Client thread/ERROR] [FML]: Detected ongoing potential memory leak. 500 packets have leaked. Top offenders [19:21:56] [Client thread/ERROR] [FML]: amm: : 500 -
Ah oui, il y a un problème de packets, je mange donc je vois ça après, sinon essaye de mettre un throw new Throwable() dans le constructeur du pa ket, t’aura tt la stack trace pour savoir où c’est appelé
-
D’accord, mais le problème de packet n’est pas le plus important pour moi le gros soucis c’est que ça ne save pas mon item .
Pour le throwable je vais regarder comment ça marche car j’ai j’aimais utilisé. -
C’est juste une erreur, et comme les erreurs donnent des stacks trace, ben c’est pratique, ou sinon tu peux aussi faire clic droit sur la fonction et open call hierarchy dans éclipse.pour le pb de packet,je pense qu’il vaut mieux le résoudre parce ça va lagger
-
D’accord, pour le soucis des packets je sais pas du tout d’ou il vient.
EDIT: Quand je spam la touche pour ouvrir l’inventaire la les erreurs apparaisse .
Et pour le guiclosed, j’ai plus que le extendedprop donc le soucis vient de la sync du extended je pense … -
T’a qu’à mettre un blocage si le gui est déjà ouvert.
Et pour la sync, Minecraft s’occupe déjà de sync tt cequi est slots, donc tu peux l’enlever. -
Pas con je vais voir ça, pour le slot j’ai tout viré c’est pareil…
-
T’es sur ? Tu mets bien l’item, tu sors et tu remets ?
Aussi je viens de penser, oublie pas, dans les méthodes de ton container de mettre les super.lenomdelafonction() à chaque -
Oui je met mon item dans le slot, je quitte l’inventaire puis je le ré ouvre l’item a disparu comme si mon inventaire était une poubelle x).
Pour le super.nomfonction(); je l’avais déjà.
Je vois pas comment minecraft peut enregistrer mon item aussi j’ai que ça dans ma fonction de close:@Override public void onContainerClosed(EntityPlayer player) { super.onContainerClosed(player); } -
Vérifies aussi pour tes autres fonctions.
Parce que quand par exemple tu fais un four, ta pas besoin de rajouter de packet pour sync ou quoi que ce soit -
J’ai que pour le containerclosed et slotclick en super.fonction();
J’ai une érreur ici quand je ferme mon inv:
[19:09:17] [Client Shutdown Thread/ERROR] [FML]: Failed to save extended properties for ExtPropInv. This is a mod issue. [19:09:17] [Client Shutdown Thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: java.lang.ArrayIndexOutOfBoundsException: 0 [19:09:17] [Client Shutdown Thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at armacraft.net.ExtendedPropInv.saveNBTData(ExtendedPropInv.java:55) [19:09:17] [Client Shutdown Thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.entity.Entity.writeToNBT(Entity.java:1527) [19:09:17] [Client Shutdown Thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:33) [19:09:17] [Client Shutdown Thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.server.management.ServerConfigurationManager.saveAllPlayerData(ServerConfigurationManager.java:949) [19:09:17] [Client Shutdown Thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:398) [19:09:17] [Client Shutdown Thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:266) [19:09:17] [Client Shutdown Thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.Minecraft.stopIntegratedServer(Minecraft.java:2789) [19:09:17] [Client Shutdown Thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.main.Main$3.run(Main.java:154) Java HotSpot(TM) Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future releaseClass extendedpropinv:
package armacraft.net; import java.util.ArrayList; import scala.collection.mutable.ArrayStack; import armacraft.net.GUI.InventaireArma; import armacraft.net.Packets.PacketInv; import armacraft.net.Packets.PacketMoney; import armacraft.net.Proxy.CommonProxy; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; import net.minecraftforge.common.util.Constants; public class ExtendedPropInv implements IExtendedEntityProperties{ public final static String EXT_PROP_Inv = "ExtPropInv"; private static InventaireArma inv; private final EntityPlayer player; public ItemStack[] content; public static int size; public ArrayList <itemstack[]>items = new ArrayList<itemstack[]>(); public ExtendedPropInv(InventaireArma inv, EntityPlayer player, int size) { this.inv = inv; this.player = player; this.size = size + 10; this.content = new ItemStack; } public static final void register(EntityPlayer player) { player.registerExtendedProperties(ExtendedPropInv.EXT_PROP_Inv, new ExtendedPropInv(inv, player, size)); } public static final ExtendedPropInv get(EntityPlayer player) { return (ExtendedPropInv) player.getExtendedProperties(EXT_PROP_Inv); } @Override public void saveNBTData(NBTTagCompound comp) { NBTTagList nbtlist = new NBTTagList(); for (int i = 0; i < this.size; i++) { if (this.content* != null) { NBTTagCompound comp1 = new NBTTagCompound(); comp1.setInteger("Slot", i); this.content*.writeToNBT(comp1); nbtlist.appendTag(comp1); } } } @Override public void loadNBTData(NBTTagCompound comp) { NBTTagList nbtlist = comp.getTagList("a", Constants.NBT.TAG_COMPOUND); for (int i = 0; i < nbtlist.tagCount(); i++) { NBTTagCompound comp1 = nbtlist.getCompoundTagAt(i); int slot = comp1.getInteger("z"); this.content[slot] = ItemStack.loadItemStackFromNBT(comp1); } } public final void sync() { PacketInv packetInv = new PacketInv(this.items); AltisMineMod.network.sendToServer(packetInv); if (!player.worldObj.isRemote) { EntityPlayerMP player1 = (EntityPlayerMP) player; AltisMineMod.network.sendTo(packetInv, player1); } } private static String getSaveKey(EntityPlayer player) { return player.getDisplayName() + ":" + EXT_PROP_Inv; } public static void saveProxyData(EntityPlayer player) { ExtendedPropMoney playerData = ExtendedPropMoney.get(player); NBTTagCompound savedData = new NBTTagCompound(); playerData.saveNBTData(savedData); CommonProxy.storeEntityData(getSaveKey(player), savedData); } public static void loadProxyData(EntityPlayer player) { ExtendedPropMoney playerData = ExtendedPropMoney.get(player); NBTTagCompound savedData = CommonProxy .getEntityData(getSaveKey(player)); if (savedData != null) { playerData.loadNBTData(savedData); } playerData.sync(); } @Override public void init(Entity entity, World world) { // TODO Auto-generated method stub } public void setItem(ArrayList <itemstack[]>items2) { this.items = items2; } } ```</itemstack[]></itemstack[]></itemstack[]> -
Robin, Tu peux pas regardé pourquoi mon item se save pas et pourquoi j’ai des erreurs de packet stp ta mon src plus haut .
-
Tu as une erreur car je pense que tu m’as mal compris

Quand je t’ai dis de mettre le this.size = size +10, fallait pas enlever le +10 au size de ton this.content. -
Non Non je t’ai bien compris^^
j’ai ça:public InventaireArma(int size, EntityPlayer player) { this.prop = ExtendedPropInv.get(player); this.size = size + 10; this.prop.content = new ItemStack; this.player = player; -
Nn tu m’as mal compris ^^
Ça “ItemStack” devient ça “ItemStack” -
Ok niquel j’ai plus l’érreur merci,
mais maintenant mon inventaire s’ouvre plus x) -
Ah…. Refait le truc des system.out.println alors
-
@‘floriangabet’:
Robin, Tu peux pas regardé pourquoi mon item se save pas et pourquoi j’ai des erreurs de packet stp ta mon src plus haut .
Où ?
Sinon envoies-moi un zip complet de tes sources. Et dit moi exactement ce que tu veux faire (j’ai complètement perdu de vue ton objectif de base avec ces 17 pages et sur la première page tu n’avais pas expliqué ce que tu veux faire) -
@‘robin4002’:
@‘floriangabet’:
Robin, Tu peux pas regardé pourquoi mon item se save pas et pourquoi j’ai des erreurs de packet stp ta mon src plus haut .
Où ?
Sinon envoies-moi un zip complet de tes sources. Et dit moi exactement ce que tu veux faire (j’ai complètement perdu de vue ton objectif de base avec ces 17 pages et sur la première page tu n’avais pas expliqué ce que tu veux faire)Tien je te passe mon SRC.
En gros se que je veux faire, c’est remplacer l’inventaire de minecraft de base, j’ai toute les class mais la j’ai un soucis c’est que l’inventaire s’ouvre plus x) et que mon item quand je le met dans mon slot et que je ferme puis ré ouvre mon inventaire il disparaît en gros l’item se save pas.
PS: Robin si c’est pas trop te demandé essaye de regarder aussi mon slot quand je met le curseur dessus il est tout blanc comme si le slot avait pas de texture.
Merci d’avance. -
@‘AymericRed’:
Ah…. Refait le truc des system.out.println alors
Ouaip je fais ça de suite

EDIT: c’est bon aymeric l’inventaire s’ouvre c’est bon j’avais oublier un truc tout con^^ ( j’avais register mon packet côté client et je l’ouvrer côté serveur …).
L’item se save toujours pad