MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    [1.12.2] problème avec mon GUI

    Planifier Épinglé Verrouillé Déplacé Résolu 1.12.x
    1.12.2
    29 Messages 2 Publieurs 1.2k Vues 2 Watching
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • TheXrayFRT Hors-ligne
      TheXrayFR
      dernière édition par

      2019-01-16 20-54-15.zip

      1 réponse Dernière réponse Répondre Citer 0
      • robin4002R Hors-ligne
        robin4002 Moddeurs confirmés Rédacteurs Administrateurs
        dernière édition par

        Ta fonction isUsableByPlayer retourne toujours faux, c’est pour ça que cela ne fonctionne pas.

        TheXrayFRT 1 réponse Dernière réponse Répondre Citer 1
        • TheXrayFRT Hors-ligne
          TheXrayFR
          dernière édition par

          une petite vidéo pour te montrer se qui se passe

          1 réponse Dernière réponse Répondre Citer 0
          • TheXrayFRT Hors-ligne
            TheXrayFR
            dernière édition par

            ses bon le hui s’ouvre mes maintenant ses le snift clique qui pose problème

            1 réponse Dernière réponse Répondre Citer 0
            • TheXrayFRT Hors-ligne
              TheXrayFR @robin4002
              dernière édition par

              @robin4002

              ses pas du au:

              public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
                   ItemStack itemstack = ItemStack.EMPTY;
                   Slot slot = (Slot) this.inventorySlots.get(index);
              
                   if ((slot != null) && (slot.getHasStack())) {
                     ItemStack itemstack1 = slot.getStack();
                     itemstack = itemstack1.copy();
              
                     if (index < 9) {
                       if (!mergeItemStack(itemstack1, 18, this.inventorySlots.size(), true)) {
                         return ItemStack.EMPTY;
                       }
                     } else if (!mergeItemStack(itemstack1, 0, 18, false)) {
                       return ItemStack.EMPTY;
                     }
              
                     if (itemstack1.isEmpty()) {
                       slot.putStack(ItemStack.EMPTY);
                     } else {
                       slot.onSlotChanged();
                     }
                   }
              
                   return itemstack;
                 }
              

              ???

              1 réponse Dernière réponse Répondre Citer 0
              • robin4002R Hors-ligne
                robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                dernière édition par

                Si c’est bien cette fonction qui gère le shift clic.

                TheXrayFRT 1 réponse Dernière réponse Répondre Citer 1
                • TheXrayFRT Hors-ligne
                  TheXrayFR
                  dernière édition par TheXrayFR

                  @robin4002
                  je comprent pas pourquoi il bug quand je shift click sa crash

                  1 réponse Dernière réponse Répondre Citer 0
                  • TheXrayFRT Hors-ligne
                    TheXrayFR @robin4002
                    dernière édition par

                    @robin4002 tu ses a peut prêt dout sa peut être ?

                    1 réponse Dernière réponse Répondre Citer 0
                    • robin4002R Hors-ligne
                      robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                      dernière édition par

                      Tu peux envoyer le rapport de crash ?

                      TheXrayFRT 1 réponse Dernière réponse Répondre Citer 0
                      • TheXrayFRT Hors-ligne
                        TheXrayFR @robin4002
                        dernière édition par

                        @robin4002 il en na pas

                        1 réponse Dernière réponse Répondre Citer 0
                        • robin4002R Hors-ligne
                          robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                          dernière édition par

                          Si cela crash il y a forcément quelque chose dans les logs.

                          TheXrayFRT 1 réponse Dernière réponse Répondre Citer 0
                          • TheXrayFRT Hors-ligne
                            TheXrayFR @robin4002
                            dernière édition par TheXrayFR

                            @robin4002
                            2019-01-16 21-58-41.zip

                            de meme je peut même pas mètre d’objet a l’interrieur

                             package fr.thexrayfr.familygame.container;
                             
                             import fr.thexrayfr.familygame.tile.TileEntityBarrel;
                             import net.minecraft.entity.player.EntityPlayer;
                             import net.minecraft.entity.player.InventoryPlayer;
                             import net.minecraft.inventory.Container;
                             import net.minecraft.inventory.Slot;
                             import net.minecraft.item.ItemStack;
                             
                             public class ContainerBarrel extends Container
                             {
                               private final TileEntityBarrel tileTuto;
                               
                               public ContainerBarrel(TileEntityBarrel tile, InventoryPlayer inventory)
                               {
                            
                                 this.tileTuto = tile;
                                 tile.openInventory(inventory.player);
                            
                                 for (int i = 0; i < 6; i++)
                                 {
                                   for (int j = 0; j < 3; j++)
                                   {
                                     addSlotToContainer(new Slot(tile, j + i * 3, 62 + j * 18, 18 + i * 18));
                                   }
                                 }
                                 bindPlayerInventory(inventory);
                               }
                             
                               private void bindPlayerInventory(InventoryPlayer inventory)
                               {
                                 for (int i = 0; i < 3; i++)
                                 {
                                   for (int j = 0; j < 9; j++)
                                   {
                                     addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 138 + i * 18));
                                   }
                                 }
                            
                                 for (int i = 0; i < 9; i++)
                                 {
                                   addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 196));
                                 }
                               }
                            
                               public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
                                 ItemStack itemstack = ItemStack.EMPTY;
                                 Slot slot = (Slot) this.inventorySlots.get(index);
                            
                                 if ((slot != null) && (slot.getHasStack())) {
                                   ItemStack itemstack1 = slot.getStack();
                                   itemstack = itemstack1.copy();
                            
                                   if (index < 9) {
                                     if (!mergeItemStack(itemstack1, 18, this.inventorySlots.size(), true)) {
                                       return ItemStack.EMPTY;
                                     }
                                   } else if (!mergeItemStack(itemstack1, 0, 18, false)) {
                                     return ItemStack.EMPTY;
                                   }
                            
                                   if (itemstack1.isEmpty()) {
                                     slot.putStack(ItemStack.EMPTY);
                                   } else {
                                     slot.onSlotChanged();
                                   }
                                 }
                            
                                 return itemstack;
                               }
                             
                               public boolean canInteractWith(EntityPlayer player)
                               {
                                 return this.tileTuto.isUsableByPlayer(player);
                               }
                               
                             
                               public void onContainerClosed(EntityPlayer player)
                               {
                                 super.onContainerClosed(player);
                                 this.tileTuto.closeInventory(player);
                               }
                             }
                            
                            1 réponse Dernière réponse Répondre Citer 0
                            • TheXrayFRT Hors-ligne
                              TheXrayFR
                              dernière édition par

                              dans le TileEntity

                               package fr.thexrayfr.familygame.tile;
                              
                               import net.minecraft.inventory.ItemStackHelper;
                               import net.minecraft.nbt.NBTTagCompound;
                               
                               public class TileEntityBarrel extends TileEntityStorage
                               {
                                   @Override
                                 public int getSizeInventory()
                                 {
                                   return 18;
                                 }
                              
                                   @Override
                                 public void readFromNBT(NBTTagCompound compound)
                                 {
                                   super.readFromNBT(compound);
                                   ItemStackHelper.loadAllItems(compound, this.stacks);
                                 }
                              
                                   @Override
                                 public NBTTagCompound writeToNBT(NBTTagCompound compound)
                                 {
                                   ItemStackHelper.saveAllItems(compound, this.stacks);
                                   return super.writeToNBT(compound);
                                 }
                              
                               }
                              

                              Dans le contenair

                               package fr.thexrayfr.familygame.container;
                               
                               import fr.thexrayfr.familygame.tile.TileEntityBarrel;
                               import net.minecraft.entity.player.EntityPlayer;
                               import net.minecraft.entity.player.InventoryPlayer;
                               import net.minecraft.inventory.Container;
                               import net.minecraft.inventory.Slot;
                               import net.minecraft.item.ItemStack;
                               
                               public class ContainerBarrel extends Container
                               {
                                 private final TileEntityBarrel tileTuto;
                                 
                                 public ContainerBarrel(TileEntityBarrel tile, InventoryPlayer inventory)
                                 {
                              
                                   this.tileTuto = tile;
                                   tile.openInventory(inventory.player);
                              
                                   for (int i = 0; i < 6; ++i)
                                   {
                                     for (int j = 0; j < 3; ++j)
                                     {
                                       this.addSlotToContainer(new Slot(tile, j + i * 3, 62 + j * 18, 18 + i * 18));
                                     }
                                   }
                                   this.bindPlayerInventory(inventory);
                                 }
                               
                                 private void bindPlayerInventory(InventoryPlayer inventory)
                                 {
                                   int i;
                                   for (i = 0; i < 3; ++i)
                                   {
                                     for (int j = 0; j < 9; ++j)
                                     {
                                       this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 138 + i * 18));
                                     }
                                   }
                              
                                   for (i = 0; i < 9; ++i)
                                   {
                                     this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 196));
                                   }
                                 }
                              
                                 @Override
                                 public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
                                   ItemStack itemstack = ItemStack.EMPTY;
                                   Slot slot = (Slot) this.inventorySlots.get(index);
                              
                                   if (slot != null && slot.getHasStack()) {
                                     ItemStack itemstack1 = slot.getStack();
                                     itemstack = itemstack1.copy();
                              
                                     if (index < 9) {
                                       if (!this.mergeItemStack(itemstack1, 18, this.inventorySlots.size(), true)) {
                                         return ItemStack.EMPTY;
                                       }
                                     } else if (!this.mergeItemStack(itemstack1, 0, 18, false)) {
                                       return ItemStack.EMPTY;
                                     }
                              
                                     if (itemstack1.isEmpty())
                                     {
                                       slot.putStack(ItemStack.EMPTY);
                                     }
                                     else
                                     {
                                       slot.onSlotChanged();
                                     }
                                   }
                              
                                   return itemstack;
                                 }
                              
                                 @Override
                                 public boolean canInteractWith(EntityPlayer player)
                                 {
                                   return this.tileTuto.isUsableByPlayer(player);
                                 }
                              
                                 @Override
                                 public void onContainerClosed(EntityPlayer player)
                                 {
                                   super.onContainerClosed(player);
                                   this.tileTuto.closeInventory(player);
                                 }
                               }
                              

                              se que j’ai changer ses les ++i et ++j qui étai i++ et j++ donc je les ais inversser

                              1 réponse Dernière réponse Répondre Citer 0
                              • 1
                              • 2
                              • 2 / 2
                              • Premier message
                                Dernier message
                              Design by Woryk
                              ContactMentions Légales

                              MINECRAFT FORGE FRANCE © 2024

                              Powered by NodeBB