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.
    • SpyManS Hors-ligne
      SpyMan
      dernière édition par

      Comment fait-on un block avec une metadata ? car je ne crois pas que soit identique a l’1.7

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

        Mes textures ne s’applique pas 😕
        et le rendu en jeux est assez bizarre : c’est le rendu d’un item et non d’un block, comment je oeut regler ça

        [03:24:56] [Client thread/ERROR]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        [03:24:56] [Client thread/ERROR]: The following texture errors were found.
        [03:24:56] [Client thread/ERROR]: ==================================================
        [03:24:56] [Client thread/ERROR]:   DOMAIN spyutil
        [03:24:56] [Client thread/ERROR]: –------------------------------------------------
        [03:24:56] [Client thread/ERROR]:   domain spyutil is missing 0 textures
        [03:24:56] [Client thread/ERROR]:     domain spyutil has 1 location:
        [03:24:56] [Client thread/ERROR]:       mod spyutil resources at S:\Files\Java Modding\SpyUtil\out\production\SpyUtil
        [03:24:56] [Client thread/ERROR]: –-----------------------
        [03:24:56] [Client thread/ERROR]:     The following other errors were reported for domain spyutil:
        [03:24:56] [Client thread/ERROR]: –-----------------------
        [03:24:56] [Client thread/ERROR]:     Problem: broken aspect ratio and not an animation
        [03:24:56] [Client thread/ERROR]:       textures/blocks/models/lantern_torch_off.png
        [03:24:56] [Client thread/ERROR]:       textures/blocks/models/lantern_torch_on.png
        [03:24:56] [Client thread/ERROR]: ==================================================
        [03:24:56] [Client thread/ERROR]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        

        Je comprend pas ça car elle se trouve bien dans le bon dossier 😕

        S:\Files\Java Modding\SpyUtil\src\main\resources\assets\spyutil\textures\blocks\models
        
        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 renvoyer le json en question et la texture ?

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

            blocks/models

            {
             "textures":
             {
               "stone": "blocks/stone",
               "glass": "blocks/glass",
               "torch_off": "spyutil:blocks/models/lantern_torch_off"
            
             },
             "elements": [
               {
                 "name": "bottom",
                 "from": [ 5.0, 0.0, 5.0 ],
                 "to": [ 11.0, 1.0, 11.0 ],
                 "faces": {
                   "north": { "texture": "#stone", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                   "east": { "texture": "#stone", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                   "south": { "texture": "#stone", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                   "west": { "texture": "#stone", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                   "up": { "texture": "#stone", "uv": [ 0.0, 0.0, 6.0, 6.0 ] },
                   "down": { "texture": "#stone", "uv": [ 0.0, 0.0, 6.0, 6.0 ] }
                 }
               },
               {
                 "name": "top",
                 "from": [ 5.0, 8.0, 5.0 ],
                 "to": [ 11.0, 9.0, 11.0 ],
                 "faces": {
                   "north": { "texture": "#stone", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                   "east": { "texture": "#stone", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                   "south": { "texture": "#stone", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                   "west": { "texture": "#stone", "uv": [ 0.0, 0.0, 6.0, 1.0 ] },
                   "up": { "texture": "#stone", "uv": [ 0.0, 0.0, 6.0, 6.0 ] },
                   "down": { "texture": "#stone", "uv": [ 0.0, 0.0, 6.0, 6.0 ] }
                 }
               },
               {
                 "name": "side1",
                 "from": [ 5.0, 1.0, 5.0 ],
                 "to": [ 6.0, 8.0, 6.0 ],
                 "faces": {
                   "north": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "east": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "south": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "west": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "up": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                   "down": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
                 }
               },
               {
                 "name": "side2",
                 "from": [ 10.0, 1.0, 5.0 ],
                 "to": [ 11.0, 8.0, 6.0 ],
                 "faces": {
                   "north": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "east": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "south": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "west": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "up": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                   "down": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
                 }
               },
               {
                 "name": "side4",
                 "from": [ 5.0, 1.0, 10.0 ],
                 "to": [ 6.0, 8.0, 11.0 ],
                 "faces": {
                   "north": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "east": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "south": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "west": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "up": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                   "down": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
                 }
               },
               {
                 "name": "side3",
                 "from": [ 10.0, 1.0, 10.0 ],
                 "to": [ 11.0, 8.0, 11.0 ],
                 "faces": {
                   "north": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "east": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "south": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "west": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "up": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
                   "down": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
                 }
               },
               {
                 "name": "candel",
                 "from": [ 7.0, 1.0, 7.0 ],
                 "to": [ 9.0, 6.0, 9.0 ],
                 "faces": {
                   "north": { "texture": "#torch_off", "uv": [ 0.0, 0.0, 2.0, 5.0 ] },
                   "east": { "texture": "#torch_off", "uv": [ 0.0, 0.0, 2.0, 5.0 ] },
                   "south": { "texture": "#torch_off", "uv": [ 0.0, 0.0, 2.0, 5.0 ] },
                   "west": { "texture": "#torch_off", "uv": [ 0.0, 0.0, 2.0, 5.0 ] },
                   "up": { "texture": "#torch_off", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                   "down": { "texture": "#torch_off", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }
                 }
               },
               {
                 "name": "glasspane1",
                 "from": [ 6.0, 1.0, 6.0 ],
                 "to": [ 7.0, 8.0, 10.0 ],
                 "faces": {
                   "north": { "texture": "#glass", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "east": { "texture": "#glass", "uv": [ 0.0, 0.0, 4.0, 7.0 ] },
                   "south": { "texture": "#glass", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "west": { "texture": "#glass", "uv": [ 0.0, 0.0, 4.0, 7.0 ] },
                   "up": { "texture": "#glass", "uv": [ 0.0, 0.0, 1.0, 4.0 ] },
                   "down": { "texture": "#glass", "uv": [ 0.0, 0.0, 1.0, 4.0 ] }
                 }
               },
               {
                 "name": "glasspane2",
                 "from": [ 9.0, 1.0, 6.0 ],
                 "to": [ 10.0, 8.0, 10.0 ],
                 "faces": {
                   "north": { "texture": "#glass", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "east": { "texture": "#glass", "uv": [ 0.0, 0.0, 4.0, 7.0 ] },
                   "south": { "texture": "#glass", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "west": { "texture": "#glass", "uv": [ 0.0, 0.0, 4.0, 7.0 ] },
                   "up": { "texture": "#glass", "uv": [ 0.0, 0.0, 1.0, 4.0 ] },
                   "down": { "texture": "#glass", "uv": [ 0.0, 0.0, 1.0, 4.0 ] }
                 }
               },
               {
                 "name": "glasspane3",
                 "from": [ 7.0, 1.0, 6.0 ],
                 "to": [ 9.0, 8.0, 7.0 ],
                 "faces": {
                   "north": { "texture": "#glass", "uv": [ 0.0, 0.0, 2.0, 7.0 ] },
                   "east": { "texture": "#glass", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "south": { "texture": "#glass", "uv": [ 0.0, 0.0, 2.0, 7.0 ] },
                   "west": { "texture": "#glass", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "up": { "texture": "#glass", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
                   "down": { "texture": "#glass", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }
                 }
               },
               {
                 "name": "glasspane4",
                 "from": [ 7.0, 1.0, 9.0 ],
                 "to": [ 9.0, 8.0, 10.0 ],
                 "faces": {
                   "north": { "texture": "#glass", "uv": [ 0.0, 0.0, 2.0, 7.0 ] },
                   "east": { "texture": "#glass", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "south": { "texture": "#glass", "uv": [ 0.0, 0.0, 2.0, 7.0 ] },
                   "west": { "texture": "#glass", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
                   "up": { "texture": "#glass", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
                   "down": { "texture": "#glass", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }
                 }
               },
               {
                 "name": "hand1",
                 "from": [ 6.0, 9.0, 7.0 ],
                 "to": [ 7.0, 11.0, 9.0 ],
                 "faces": {
                   "north": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                   "east": { "texture": "#stone", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                   "south": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                   "west": { "texture": "#stone", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                   "up": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                   "down": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 2.0 ] }
                 }
               },
               {
                 "name": "hand2",
                 "from": [ 9.0, 9.0, 7.0 ],
                 "to": [ 10.0, 11.0, 9.0 ],
                 "faces": {
                   "north": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                   "east": { "texture": "#stone", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                   "south": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                   "west": { "texture": "#stone", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
                   "up": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
                   "down": { "texture": "#stone", "uv": [ 0.0, 0.0, 1.0, 2.0 ] }
                 }
               },
               {
                 "name": "hand3",
                 "from": [ 7.0, 11.0, 7.0 ],
                 "to": [ 9.0, 12.0, 9.0 ],
                 "faces": {
                   "north": { "texture": "#stone", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
                   "east": { "texture": "#stone", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
                   "south": { "texture": "#stone", "uv": [ 0.0, 0.0, -8.0, -1.0 ] },
                   "west": { "texture": "#stone", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
                   "up": { "texture": "#stone", "uv": [ 0.0, 0.0, 5.0, 2.0 ] },
                   "down": { "texture": "#stone", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }
                 }
               }
             ]
            }
            
            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

              Normalement ça serait plutôt :
                 “torch_off”: “spyutil:blocks/lantern_torch_off”
              Et la texture devrait être dans assets/spyutil/textures/blocks/

              Et tu peux envoyer le fichier de la texture ?

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

                voici les textures en question
                blocks.zip

                j’ai testé en les mettant seulement dans le dossier block mais cela ne change rien

                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

                  C’est bien ce que je pensais, tes textures n’ont pas une largeur et une hauteur identique, et les dimensions ne sont pas toutes un multiple de 2.
                  D’où le “Problem: broken aspect ratio and not an animation”

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

                    'd’accord alors comment je peut faire?

                    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

                      Il faut un fichier de 16x16.
                      Laisse ce dont tu n’as pas besoin en transparence.

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

                        d’accord je vais faire comment ça, mais aussi comment on regles la le blockbound ?
                        et je comprend pas pourquoi j’ai un rendu pareil dans l’inventaire (c’est pas rendu comme un block mais comme un item) 😕
                        0_1537563941782_screen5.png

                        Y a-t-il un moyen de pouvoir gérer la transparence, car en jeu elle n’est pas présente?

                        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

                          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
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB