MFF

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

    GUI/Block

    Planifier Épinglé Verrouillé Déplacé Résolu 1.9.x et 1.10.x
    1.10.x
    57 Messages 5 Publieurs 7.4k Vues 1 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

      Ton item est bien rendu comme un bloc dans l’inventaire mais tu ne vois que sur haut.
      Appuies sur F5 et tu verra.

      Pour autoriser la transparance :

      @SideOnly(Side.CLIENT)
      public BlockRenderLayer getBlockLayer()
      {
      return BlockRenderLayer.CUTOUT;
      }
      

      à mettre dans la classe du bloc bien sûr.

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

        et le Block Bound comment on le modifie ?

        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

          La boite de collision ?

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

            ouiii

            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

              public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)

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

                Quelle est la marche a suivre pour générer des minerais en 1.10 ?

                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

                  La même que dans les versions précédentes.

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

                    Bonjour, j’ai tenté de créer un item de type sac avec un gui/container mais je comprend pas trop pourquoi il quand le click droit pour l’ouvrir le jeu crash

                    java.lang.NullPointerException: Unexpected error
                    at net.minecraftforge.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:273)
                    at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:110)
                    at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2723)
                    at net.spyman.utils.common.items.ItemBag.onItemRightClick(ItemBag.java:22)
                    at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:176)
                    at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClick(PlayerControllerMP.java:527)
                    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1629)
                    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2281)
                    at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2058)
                    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1846)
                    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1118)
                    at net.minecraft.client.Minecraft.run(Minecraft.java:406)
                    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)
                    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.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
                    
                    [font=Source Code Propublic class ]ItemBag extends %(#345f99)[Item
                    ]{
                       public ItemBag()
                       {
                    
                       }
                    
                       %(#278c3c)[*@Override
                    *]    public ActionResult<ItemStack> onItemRightClick(ItemStack *itemStack*, World *world*, EntityPlayer *player*, EnumHand *hand*)
                       {
                           *player*.openGui(SpyUtil.INSTANCE, 0, *world*, (int) *player*.posX, (int) *player*.posY, (int) *player*.posZ)%(#aaa9a7)[;
                    ]        return new ActionResult(EnumActionResult.PASS, *itemStack*)%(#aaa9a7)[;
                    ]    }
                    }
                    
                    [font=Source Code Propublic class ]InventoryItemBag implements %(#345f99)[IInventory
                    ]{
                       public ItemStack[] inventorySlots%(#aaa9a7)[;
                    ]    public int inventoryStackLimit = 64%(#aaa9a7)[;
                    ]    %(#8242ff)[/** Use only a multiple of 9 (27, 54, 81, …) */
                    ]    public int inventorySize = 54%(#aaa9a7)[;
                    ]
                       public InventoryItemBag(ItemStack *container*, int *size*)
                       {
                           this.inventorySize = *size*%(#aaa9a7)[;
                    ]        this.inventorySlots = new ItemStack[*size*]%(#aaa9a7)[;
                    ]
                           if (!*container*.hasTagCompound())
                           {
                               *container*.setTagCompound(new NBTTagCompound())%(#aaa9a7)[;
                    ]        }
                    
                           this.readFromNBT(*container*.getTagCompound())%(#aaa9a7)[;
                    ]    }
                    
                       public void readFromNBT(NBTTagCompound *comp*)
                       {
                           NBTTagList nbtlist = *comp*.getTagList("Inventory", Constants.NBT.TAG_COMPOUND)%(#aaa9a7)[;
                    ]
                           for (int %(#666965)_= 0; %(#666965)_< nbtlist.tagCount(); %(#666965)*++) {
                               NBTTagCompound comp1 = nbtlist.getCompoundTagAt(%(#666965)*)%(#aaa9a7)[;
                    ]            int slot = comp1.getInteger("Slot")%(#aaa9a7)[;
                    ]            this.inventorySlots[slot] = ItemStack.loadItemStackFromNBT(comp1)%(#aaa9a7)[;
                    ]        }
                       }
                    
                       public void writeToNBT(NBTTagCompound *comp*)
                       {
                           NBTTagList nbtlist = new NBTTagList()%(#aaa9a7)[;
                    ]
                           for (int %(#666965)_= 0; %(#666965)_< this.inventorySize; %(#666965)*++)
                           {
                               if (this.inventorySlots[%(#666965)*] != null)
                               {
                                   NBTTagCompound comp1 = new NBTTagCompound()%(#aaa9a7)[;
                    ]                comp1.setInteger("Slot", %(#666965)*)%(#aaa9a7)[;
                    ]                this.inventorySlots[%(#666965)*].writeToNBT(comp1)%(#aaa9a7)[;
                    ]                nbtlist.appendTag(comp1)%(#aaa9a7)[;
                    ]            }
                           }
                           *comp*.setTag("Inventory", nbtlist)%(#aaa9a7)[;
                    ]    }
                    
                       %(#278c3c)[*@Override
                    *]    public int getSizeInventory()
                       {
                           return this.inventorySize%(#aaa9a7)[;
                    ]    }
                    
                       %(#278c3c)[*@Nullable
                    *]%(#278c3c)[*    @Override
                    *]    public ItemStack getStackInSlot(int *index*)
                       {
                           return this.inventorySlots[*index*]%(#aaa9a7)[;
                    ]    }
                    
                       %(#278c3c)[*@Nullable
                    *]%(#278c3c)[*    @Override
                    *]    public ItemStack decrStackSize(int *index*, int *count*)
                       {
                           return null%(#aaa9a7)[;
                    ]    }
                    
                       %(#278c3c)[*@Nullable
                    *]%(#278c3c)[*    @Override
                    *]    public ItemStack removeStackFromSlot(int *index*)
                       {
                           return null%(#aaa9a7)[;
                    ]    }
                    
                       %(#278c3c)[*@Override
                    *]    public void setInventorySlotContents(int *index*, *@Nullable *ItemStack *stack*)
                       {
                    
                       }
                    
                       %(#278c3c)[*@Override
                    *]    public int getInventoryStackLimit()
                       {
                           return this.inventoryStackLimit%(#aaa9a7)[;
                    ]    }
                    
                       %(#278c3c)[*@Override
                    *]    public void markDirty()
                       {
                    
                       }
                    
                       %(#278c3c)[*@Override
                    *]    public boolean isUseableByPlayer(EntityPlayer *player*)
                       {
                           return true%(#aaa9a7)[;
                    ]    }
                    
                       %(#278c3c)[*@Override
                    *]    public void openInventory(EntityPlayer *player*)
                       {
                    
                       }
                    
                       %(#278c3c)[*@Override
                    *]    public void closeInventory(EntityPlayer *player*)
                       {
                    
                       }
                    
                       %(#278c3c)[*@Override
                    *]    public boolean isItemValidForSlot(int *index*, ItemStack *stack*)
                       {
                           return !(*stack*.getItem() instanceof ItemBag)%(#aaa9a7)[;
                    ]    }
                    
                       %(#278c3c)[*@Override
                    *]    public int getField(int *id*)
                       {
                           return 0%(#aaa9a7)[;
                    ]    }
                    
                       %(#278c3c)[*@Override
                    *]    public void setField(int *id*, int *value*)
                       {
                    
                       }
                    
                       %(#278c3c)[*@Override
                    *]    public int getFieldCount()
                       {
                           return 0%(#aaa9a7)[;
                    ]    }
                    
                       %(#278c3c)[*@Override
                    *]    public void %(#afb8c5)____
                    1 réponse Dernière réponse Répondre Citer 0
                    • SpyManS Hors-ligne
                      SpyMan
                      dernière édition par

                      J’ai un petit soucis : j’ai créer un item de type sac pour stocker des items mais il sauvegarde pas les items 😕

                      public class InventoryItemBag implements IInventory
                      {
                      public ItemStack[] inventorySlots;
                      public int inventoryStackLimit = 64;
                      /** Use only a multiple of 9 (27, 54, 81, …) */
                      public int inventorySize = 54;
                      
                      public InventoryItemBag(ItemStack container, int size)
                      {
                      this.inventorySize = size;
                      this.inventorySlots = new ItemStack;
                      
                      if (!container.hasTagCompound())
                      {
                      container.setTagCompound(new NBTTagCompound());
                      }
                      
                      this.readFromNBT(container.getTagCompound());
                      }
                      
                      public void readFromNBT(NBTTagCompound comp)
                      {
                      NBTTagList nbtlist = comp.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
                      
                      for (int i = 0; i < nbtlist.tagCount(); i++)
                      {
                      NBTTagCompound comp1 = nbtlist.getCompoundTagAt(i);
                      int slot = comp1.getInteger("Slot");
                      this.inventorySlots[slot] = ItemStack.loadItemStackFromNBT(comp1);
                      }
                      }
                      
                      public void writeToNBT(NBTTagCompound comp)
                      {
                      NBTTagList nbtlist = new NBTTagList();
                      
                      for (int i = 0; i < this.inventorySize; i++)
                      {
                      if (this.inventorySlots != null)
                      {
                      NBTTagCompound comp1 = new NBTTagCompound();
                      comp1.setInteger("Slot", i);
                      this.inventorySlots.writeToNBT(comp1);
                      nbtlist.appendTag(comp1);
                      }
                      }
                      comp.setTag("Inventory", nbtlist);
                      }
                      
                      @Override
                      public int getSizeInventory()
                      {
                      return this.inventorySize;
                      }
                      
                      @Nullable
                      @Override
                      public ItemStack getStackInSlot(int index)
                      {
                      return this.inventorySlots[index];
                      }
                      
                      @Nullable
                      @Override
                      public ItemStack decrStackSize(int index, int count)
                      {
                      return null;
                      }
                      
                      @Nullable
                      @Override
                      public ItemStack removeStackFromSlot(int index)
                      {
                      return null;
                      }
                      
                      @Override
                      public void setInventorySlotContents(int index, @Nullable ItemStack stack)
                      {
                      
                      }
                      
                      @Override
                      public int getInventoryStackLimit()
                      {
                      return this.inventoryStackLimit;
                      }
                      
                      @Override
                      public void markDirty()
                      {
                      
                      }
                      
                      @Override
                      public boolean isUseableByPlayer(EntityPlayer player)
                      {
                      return true;
                      }
                      
                      @Override
                      public void openInventory(EntityPlayer player)
                      {
                      
                      }
                      
                      @Override
                      public void closeInventory(EntityPlayer player)
                      {
                      
                      }
                      
                      @Override
                      public boolean isItemValidForSlot(int index, ItemStack stack)
                      {
                      return !(stack.getItem() instanceof ItemBag);
                      }
                      
                      @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()
                      {
                      
                      }
                      
                      @Override
                      public String getName()
                      {
                      return "item.container.bag.gui";
                      }
                      
                      @Override
                      public boolean hasCustomName()
                      {
                      return false;
                      }
                      
                      @Override
                      public ITextComponent getDisplayName()
                      {
                      return null;
                      }
                      
                      1 réponse Dernière réponse Répondre Citer 0
                      • BrokenSwingB Hors-ligne
                        BrokenSwing Moddeurs confirmés Rédacteurs
                        dernière édition par

                        Comment fais-tu pour te retrouver avec ce formatage foireux du code ? Tu met tout en italique où quoi ?

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

                          c’est a dire ? la police? je n’y peut rien c’est quand je copie/colle dans le message, ça conserve ma police de programmation (Source Code Pro)

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

                            @‘SpyMan’:

                            c’est a dire ? la police? j’ai peut rien c’est quand je copie/colle dans le message, ça conserve ma police de programmation (Source Code Pro)

                            Tu peut sélectionner ton texte et cliquer sur “Supprimer formatage” pour enlever la police et les couleurs.
                            Sinon, pour ton code “setInventorySlotContents”, “removeStackFromSlot” et " decrStackSize" sont vides il faudrais peut-être mettre quelque chose…
                            Et dans ta fonction “readFromNBT”, il vaut mieux mettre “this.inventorySlots = new ItemStack” avant la boucle pour être sûr que l’item na garde pas les items qu’il avait avant que la fonction soit appelée (j’ai déjà eu ce problème avec une tileEntity et je n’y comprenais rien.)

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

                              Comment faire pour que le joueur ne puisse plus déplacer l’item dans son inventaire un fois le gui ouvert car sinon cela cause des problèmes

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

                                Euh … Tu penses qu’on ne remarque pas que tu supprimes ton message et que tu remet le même à chaque fois pour que ça fasse une notification ?

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

                                  oui la première fois c’était pour le up mais je sais pas pourquoi après quand je l’éditais il je ne voyais pas les changements et du coup je les recréer plusieurs fois et puis je sais pas et après ça a fini par apparaître 😕

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

                                    Normal, quand on modifie ça ne notifie pas, et heureusement.

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

                                      Je parle pas de la notif, mais bien que quand je clickais sur le bouton “mettre a jour le message” mon texte ne changais point!

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

                                      MINECRAFT FORGE FRANCE © 2024

                                      Powered by NodeBB