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.
    • robin4002R Hors-ligne
      robin4002 Moddeurs confirmés Rédacteurs Administrateurs
      dernière édition par

      Regardes dans le code du tile entity du coffre.

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

        ok je vais regarder

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

          dans le tile ya pas de onBlockActivated

          et dans la clase du block chest sa resemble a sa!

          public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
              {
                  if (worldIn.isRemote)
                  {
                      return true;
                  }
                  else
                  {
                      ILockableContainer ilockablecontainer = this.getLockableContainer(worldIn, pos);
          
                      if (ilockablecontainer != null)
                      {
                          playerIn.displayGUIChest(ilockablecontainer);
          
                          if (this.chestType == BlockChest.Type.BASIC)
                          {
                              playerIn.addStat(StatList.CHEST_OPENED);
                          }
                          else if (this.chestType == BlockChest.Type.TRAP)
                          {
                              playerIn.addStat(StatList.TRAPPED_CHEST_TRIGGERED);
                          }
                      }
          
                      return true;
                  }
              }
          

          ses pas du tous la même chose

          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

            Le problème ne se trouve pas dans ton bloc mais dans ton tile entity.

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

              @robin4002

              package fr.thexrayfr.familygame.tile;
               
               import net.minecraft.entity.player.EntityPlayer;
               import net.minecraft.inventory.ItemStackHelper;
               import net.minecraft.item.ItemStack;
               import net.minecraft.nbt.NBTTagCompound;
               
               public class TileEntityBarrel extends TileEntityStorage
               {
                 public int getSizeInventory()
                 {
                   return 18;
                 }
              
                   @Override
                   public boolean isEmpty() {
                       return false;
                   }
              
                   @Override
                   public ItemStack getStackInSlot(int index) {
                       return null;
                   }
              
                   @Override
                   public ItemStack decrStackSize(int index, int count) {
                       return null;
                   }
              
                   @Override
                   public ItemStack removeStackFromSlot(int index) {
                       return null;
                   }
              
                   @Override
                   public int getInventoryStackLimit() {
                       return 0;
                   }
              
                   @Override
                   public boolean isUsableByPlayer(EntityPlayer player) {
                       return false;
                   }
              
                   @Override
                   public void openInventory(EntityPlayer player) {
              
                   }
              
                   @Override
                   public void closeInventory(EntityPlayer player) {
              
                   }
              
                   @Override
                   public boolean isItemValidForSlot(int index, ItemStack stack) {
                       return false;
                   }
              
                   @Override
                   public int getField(int id) {
                       return 0;
                   }
              
                   @Override
                   public void setField(int id, int value) {
              
                   }
              
                   @Override
                   public int getFieldCount() {
                       return 0;
                   }
              
                   @Override
                   public void clear() {
              
                   }
              
              
                   public void readFromNBT(NBTTagCompound compound)
                 {
                   super.readFromNBT(compound);
                   ItemStackHelper.loadAllItems(compound, this.stacks);
                 }
                 
               
                 public NBTTagCompound writeToNBT(NBTTagCompound compound)
                 {
                   ItemStackHelper.saveAllItems(compound, this.stacks);
                   return super.writeToNBT(compound);
                 }
              
                   @Override
                   public String getName() {
                       return null;
                   }
              
                   @Override
                   public boolean hasCustomName() {
                       return false;
                   }
               }
              

              il ma demander quand je lais mise a joue d’importer ca donc apret

              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

                TileEntityStorage contient quoi ?

                Et tu as pleins de fonction non implémenté qui retourne null, ce n’est pas bon. getStackInSlot, decrStackSize, removeStackFromSlot etc.

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

                  @robin4002

                  package fr.thexrayfr.familygame.tile;
                   
                   import net.minecraft.entity.player.EntityPlayer;
                   import net.minecraft.inventory.IInventory;
                   import net.minecraft.inventory.ItemStackHelper;
                   import net.minecraft.item.ItemStack;
                   import net.minecraft.tileentity.TileEntity;
                   import net.minecraft.util.NonNullList;
                  
                   
                   public abstract class TileEntityStorage extends TileEntity implements IInventory
                   {
                  
                     public NonNullList<ItemStack> stacks = NonNullList.withSize(getSizeInventory(), ItemStack.EMPTY);
                  
                     public String getName()
                     {
                      return null;
                     }
                  
                     public boolean hasCustomName()
                     {
                       return false;
                     }
                     
                     public boolean isEmpty()
                     {
                       for (ItemStack itemstack : this.stacks)
                       {
                         if (!itemstack.isEmpty())
                         {
                           return false;
                         }
                       }
                       
                       return true;
                     }
                   
                     public ItemStack getStackInSlot(int index)
                     {
                       return (ItemStack)this.stacks.get(index);
                     }
                  
                     public ItemStack decrStackSize(int index, int count)
                     {
                       return ItemStackHelper.getAndSplit(this.stacks, index, count);
                     }
                  
                     public ItemStack removeStackFromSlot(int index)
                     {
                       this.stacks.set(index, ItemStack.EMPTY);
                       return getStackInSlot(index);
                     }
                  
                     public void setInventorySlotContents(int index, ItemStack stack)
                     {
                       this.stacks.set(index, stack);
                     }
                  
                     public int getInventoryStackLimit()
                     {
                       return 64;
                     }
                  
                     public boolean isUsableByPlayer(EntityPlayer player)
                     {
                       if (this.world.getTileEntity(this.pos) != this)
                       {
                         return false;
                       }
                  
                       return player.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D;
                     }
                  
                     public void openInventory(EntityPlayer player) {}
                  
                     public void closeInventory(EntityPlayer player) {}
                  
                     public boolean isItemValidForSlot(int index, ItemStack stack)
                     {
                       return true;
                     }
                  
                     public int getField(int id)
                     {
                       return 0;
                     }
                     public void setField(int id, int value) {}
                  
                     public int getFieldCount()
                     {
                       return 0;
                     }
                  
                     public void clear()
                     {
                       this.stacks.clear();
                     }
                   }
                  
                  1 réponse Dernière réponse Répondre Citer 0
                  • TheXrayFRT Hors-ligne
                    TheXrayFR
                    dernière édition par

                    jais fait le ménage

                    package fr.thexrayfr.familygame.tile;
                     
                     import net.minecraft.entity.player.EntityPlayer;
                     import net.minecraft.inventory.ItemStackHelper;
                     import net.minecraft.item.ItemStack;
                     import net.minecraft.nbt.NBTTagCompound;
                     
                     public class TileEntityBarrel extends TileEntityStorage
                     {
                         
                       public int getSizeInventory()
                       {
                         return 18;
                       }
                    
                         @Override
                         public boolean isEmpty() {
                             return false;
                         }
                    
                         @Override
                         public int getInventoryStackLimit() {
                             return 0;
                         }
                    
                         @Override
                         public boolean isUsableByPlayer(EntityPlayer player) {
                             return false;
                         }
                    
                         @Override
                         public void openInventory(EntityPlayer player) {
                    
                         }
                    
                         @Override
                         public void closeInventory(EntityPlayer player) {
                    
                         }
                    
                         @Override
                         public boolean isItemValidForSlot(int index, ItemStack stack) {
                             return false;
                         }
                    
                         @Override
                         public int getField(int id) {
                             return 0;
                         }
                    
                         @Override
                         public void setField(int id, int value) {
                    
                         }
                    
                         @Override
                         public int getFieldCount() {
                             return 0;
                         }
                    
                         @Override
                         public void clear() {
                    
                         }
                    
                         public void readFromNBT(NBTTagCompound compound)
                       {
                         super.readFromNBT(compound);
                         ItemStackHelper.loadAllItems(compound, this.stacks);
                       }
                       
                     
                       public NBTTagCompound writeToNBT(NBTTagCompound compound)
                       {
                         ItemStackHelper.saveAllItems(compound, this.stacks);
                         return super.writeToNBT(compound);
                       }
                    
                         @Override
                         public boolean hasCustomName() {
                             return false;
                         }
                         
                     }
                    
                    1 réponse Dernière réponse Répondre Citer 0
                    • TheXrayFRT Hors-ligne
                      TheXrayFR
                      dernière édition par

                      déja sa crash plus sa ouvre et referme le gui

                      1 réponse Dernière réponse Répondre Citer 0
                      • 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
                                            • 1
                                            • 2
                                            • 2 / 2
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB