• Récent
  • Mots-clés
  • Populaire
  • Utilisateurs
  • Groupes
  • S'inscrire
  • Se connecter
  • S'inscrire
  • Se connecter
  • Recherche
  • Récent
  • Mots-clés
  • Populaire
  • Utilisateurs
  • Groupes

Résolu Problème GUI

1.7.x
1.7.10
6
76
10.8k
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.
  • BrokenSwing
    BrokenSwing Moddeurs confirmés Rédacteurs dernière édition par 27 févr. 2016, 10:01

    Holy sh*t qu’est ce que ça ? Fait plutôt un lien vers un pastebin
    Ensuite : Caused by: java.lang.ClassCastException: com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer.TileEntityAlloyer cannot be cast to net.minecraft.inventory.IInventory
    Il faut que tu implémente l’interface IIventory à ton tileentity

    1 réponse Dernière réponse Répondre Citer 1
    • SpyMan
      SpyMan dernière édition par 27 févr. 2016, 10:10

      OMG ! ça marche enfin ! MERCI
      PS : ça faisait 2/3 mois que je cherchais la solution a ce problème

      1 réponse Dernière réponse Répondre Citer 0
      • SpyMan
        SpyMan dernière édition par 27 févr. 2016, 10:17

        J’ai un autre petit soucis le craft ne se lance pas dans la machine

        1 réponse Dernière réponse Répondre Citer 0
        • BrokenSwing
          BrokenSwing Moddeurs confirmés Rédacteurs dernière édition par 27 févr. 2016, 10:36

          Envoie la classe de ton TileEntity et la classe de ta recette s’il te plaît (flemme de download ton src)
          EDIT : Je vais le télécharger finalement

          1 réponse Dernière réponse Répondre Citer 0
          • SpyMan
            SpyMan dernière édition par 27 févr. 2016, 10:39

            Lol
            :::

            [font=Consolas**package **]com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer%(#aaa9a7)[;
            ]
            **import **java.util.HashMap%(#aaa9a7)[;
            ]**import **java.util.Iterator%(#aaa9a7)[;
            ]**import **java.util.Map%(#aaa9a7)[;
            ]**import **java.util.Map.Entry%(#aaa9a7)[;
            ]
            **import **net.minecraft.block.Block%(#aaa9a7)[;
            ]**import **net.minecraft.init.Blocks%(#aaa9a7)[;
            ]**import **net.minecraft.init.Items%(#aaa9a7)[;
            ]**import **net.minecraft.item.Item%(#aaa9a7)[;
            ]**import **net.minecraft.item.ItemStack%(#aaa9a7)[;
            ]
            **public class **%(#345f99)[AlloyerRecipes
            ]{
               **private static final **AlloyerRecipes **smeltingBase **= **new **%(#afb8c5)AlloyerRecipes%(#aaa9a7)[;
            ]    **private **Map **smeltingList **= **new **%(#afb8c5)HashMap%(#aaa9a7)[;
            ]
               **public **%(#afb8c5)AlloyerRecipes
               {
                   this.addRecipe(Items.apple, Items.apple, Items.arrow, **new **%(#afb8c5)ItemStack)%(#aaa9a7)[;
            ]    }

            **public void **addRecipe(ItemStack stack1, ItemStack stack2, ItemStack stack3, ItemStack stack4)
               {
                   ItemStack[] **stackList **= **new **ItemStack[] {stack1, stack2, stack3}%(#aaa9a7)[;
            ]        this.smeltingList.put(stackList, stack4)%(#aaa9a7)[;
            ]    }

            **public void **addRecipe(Item item1, Item item2, Item item3, ItemStack stack)
               {
                   this.addRecipe(**new **%(#afb8c5)ItemStack, **new **%(#afb8c5)ItemStack, **new **%(#afb8c5)ItemStack, stack)%(#aaa9a7)[;
            ]    }

            **public void **addRecipe(Block block1, Item item2, Item item3, ItemStack stack)
               {
                   this.addRecipe(Item.%(#afb8c5)getItemFromBlock, item2, item3, stack)%(#aaa9a7)[;
            ]    }

            **public void **addRecipe(Block block1, Block block2, Item item3, ItemStack stack)
               {
                   this.addRecipe(Item.%(#afb8c5)getItemFromBlock, Item.%(#afb8c5)getItemFromBlock, item3, stack)%(#aaa9a7)[;
            ]    }

            **public void **addRecipe(Block block1, Block block2, Block block3, ItemStack stack)
               {
                   this.addRecipe(Item.%(#afb8c5)getItemFromBlock, Item.%(#afb8c5)getItemFromBlock, Item.%(#afb8c5)getItemFromBlock, stack)%(#aaa9a7)[;
            ]    }

            **public **ItemStack getSmeltingResult(ItemStack[] stack)
               {
                   Iterator **iterator **= this.smeltingList.%(#afb8c5)entrySet.%(#afb8c5)iterator%(#aaa9a7)[;
            ]        Entry entry%(#aaa9a7)[;
            ]
                   %(#0187df)[**do
            **]        {
                       %(#0187df)if
                       {
                           return null%(#aaa9a7)[;
            ]            }
                       **entry **%(#aaa9a7)= iterator.%(#afb8c5)next%(#aaa9a7)[;
            ]        }
                   while(!this.isSameKey(stack%(#aaa9a7), entry.%(#afb8c5)getKey))%(#aaa9a7)[;
            ]
                   %(#0187df)**return **entry.%(#afb8c5)getValue%(#aaa9a7)[;
            ]    }

            **private boolean **isSameKey(ItemStack[] stackList, ItemStack[] stackList2)
               {
                   **boolean ****isSame **= false%(#aaa9a7)[;
            ]        for(**int ****i **= 0; **i **<= 2; i++)
                   {
                       if(stackList[i].%(#afb8c5)getItem == stackList2[i].%(#afb8c5)getItem)
                       {
                           **isSame **= true%(#aaa9a7)[;
            ]            }
                       %(#0187df)[**else
            **]            {
                           return false%(#aaa9a7)[;
            ]            }
                   }
                   **return **isSame%(#aaa9a7)[;
            ]    }

            **public **Map %(#afb8c5)getSmeltingList
               {
                   return this.smeltingList%(#aaa9a7)[;
            ]    }

            **public static **AlloyerRecipes %(#afb8c5)smelting
               {
                   **return **smeltingBase%(#aaa9a7)[;
            ]    }
            }

            :::
            :::

            [font=Consolas**package **]com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer%(#aaa9a7)[;
            ]
            **import **net.minecraft.entity.player.EntityPlayer%(#aaa9a7)[;
            ]**import **net.minecraft.inventory.IInventory%(#aaa9a7)[;
            ]**import **net.minecraft.item.ItemStack%(#aaa9a7)[;
            ]**import **net.minecraft.nbt.NBTTagCompound%(#aaa9a7)[;
            ]**import **net.minecraft.nbt.NBTTagList%(#aaa9a7)[;
            ]**import **net.minecraft.tileentity.TileEntity%(#aaa9a7)[;
            ]
            **public class **TileEntityAlloyer **extends **TileEntity **implements **%(#345f99)[IInventory
            ]{
              **private byte **direction%(#aaa9a7)[;
            ]   **public byte **%(#afb8c5)getDirection
               {
                 **return **direction%(#aaa9a7)[;
            ]   }

            **public void **setDirection(**byte **direction)
               {
                 this.**direction **= direction%(#aaa9a7)[;
            ]      this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord)%(#aaa9a7)[;
            ]   }
             
               **private **ItemStack[] **contents **= **new **ItemStack[4]%(#aaa9a7)[;
            ]    **private int ****workingTime **= 0%(#aaa9a7)[;
            ]    **private int ***workingTimeNeeded = 0%(#aaa9a7)[;
            ]
               %(#278c3c)[@Override
            ***]    **public void **writeToNBT(NBTTagCompound compound)
               {
                   super.%(#afb8c5)writeToNBT%(#aaa9a7)[;
            ]        NBTTagList **nbttaglist **= **new **%(#afb8c5)NBTTagList%(#aaa9a7)[;
            ]        compound.setByte(“Direction”, this.direction)%(#aaa9a7)[;
            ]        for(**int ****i **= 0; **i **< this.contents.length; ++i)
                   {
                       if(this.contents[i] != null)
                       {
                           NBTTagCompound **nbttagcompound1 **= **new **%(#afb8c5)NBTTagCompound%(#aaa9a7)[;
            ]                nbttagcompound1.setByte(“Slot”%(#aaa9a7), i)%(#aaa9a7)[;
            ]                this.contents[i].%(#afb8c5)writeToNBT%(#aaa9a7)[;
            ]                nbttaglist.%(#afb8c5)appendTag%(#aaa9a7)[;
            ]                
                       }
                   }
                   compound.setTag(“Items”, nbttaglist)%(#aaa9a7)[;
            ]        compound.setShort(“workingTime”%(#aaa9a7), this.workingTime)%(#aaa9a7)[;
            ]        compound.setShort(“workingTimeNeeded”%(#aaa9a7), this.workingTimeNeeded)%(#aaa9a7)[;
            ]    }

            %(#278c3c)[***@Override
            ***]    **public void **readFromNBT(NBTTagCompound compound)
               {
                   super.%(#afb8c5)readFromNBT%(#aaa9a7)[;
            ]        this.**direction **= compound.%(#afb8c5)getByte%(#aaa9a7)[;
            ]        NBTTagList **nbttaglist **= compound.getTagList(“Items”, 10)%(#aaa9a7)[;
            ]        this.**contents **= **new **ItemStack[this.%(#afb8c5)getSizeInventory]%(#aaa9a7)[;
            ]
                   for(**int ****i **= 0; **i **< nbttaglist.%(#afb8c5)tagCount; ++i)
                   {
                       NBTTagCompound **nbttagcompound1 **= nbttaglist.%(#afb8c5)getCompoundTagAt%(#aaa9a7)[;
            ]            **int ****j **= nbttagcompound1.%(#afb8c5)getByte & 255%(#aaa9a7)[;
            ]
                       if(**j **>= 0 && **j **< this.contents.length)
                       {
                           this.contents[j] = ItemStack.%(#afb8c5)loadItemStackFromNBT%(#aaa9a7)[;
            ]            }
                   }
                   this.**workingTime **= compound.%(#afb8c5)getShort%(#aaa9a7)[;
            ]        this.**workingTimeNeeded **= compound.%(#afb8c5)getShort%(#aaa9a7)[;
            ]    }

            **public int **%(#afb8c5)getSizeInventory
               {
                   return this.contents.length%(#aaa9a7)[;
            ]    }

            **public **ItemStack getStackInSlot(**int **slotIndex)
               {
                   return this.contents[slotIndex]%(#aaa9a7)[;
            ]    }

            **public **ItemStack decrStackSize(**int **slotIndex, **int **amount)
               {
                   if(this.contents[slotIndex] != null)
                   {
                       ItemStack itemstack%(#aaa9a7)[;
            ]
                       if(this.contents[slotIndex].**stackSize **<= amount)
                       {
                           **itemstack **= this.contents[slotIndex]%(#aaa9a7)[;
            ]                this.contents[slotIndex] = null%(#aaa9a7)[;
            ]                this.%(#afb8c5)markDirty%(#aaa9a7)[;
            ]                **return **itemstack%(#aaa9a7)[;
            ]            }
                       %(#0187df)[**else
            **]            {
                           **itemstack **= this.contents[slotIndex].%(#afb8c5)splitStack%(#aaa9a7)[;
            ]
                           if(this.contents[slotIndex].**stackSize **== 0)
                           {
                               this.contents[slotIndex] = null%(#aaa9a7)[;
            ]                }
                           this.%(#afb8c5)markDirty%(#aaa9a7)[;
            ]                **return **itemstack%(#aaa9a7)[;
            ]            }
                   }
                   %(#0187df)[**else
            **]        {
                       return null%(#aaa9a7)[;
            ]        }
               }

            **public **ItemStack getStackInSlotOnClosing(**int **slotIndex)
               {
                   if(this.contents[slotIndex] != null)
                   {
                       ItemStack **itemstack **= this.contents[slotIndex]%(#aaa9a7)[;
            ]            this.contents[slotIndex] = null%(#aaa9a7)[;
            ]            **return **itemstack%(#aaa9a7)[;
            ]        }
                   %(#0187df)[**else
            **]        {
                       return null%(#aaa9a7)[;
            ]        }
               }

            **public void **setInventorySlotContents(**int **slotIndex, ItemStack stack)
               {
                   this.contents[slotIndex] = stack%(#aaa9a7)[;
            ]
                   if(*stack *!= **null **&& stack.**stackSize **> this.%(#afb8c5)getInventoryStackLimit)
                   {
                       stack.**stackSize **= this.%(#afb8c5)getInventoryStackLimit%(#aaa9a7)[;
            ]        }
                   this.%(#afb8c5)markDirty%(#aaa9a7)[;
            ]    }

            **public **String %(#afb8c5)getInventoryName
               {
                   **return **“tile.Alloyer”%(#aaa9a7)[;
            ]    }

            **public boolean **%(#afb8c5)hasCustomInventoryName
               {
                   return false%(#aaa9a7)[;
            ]    }

            **public int **%(#afb8c5)getInventoryStackLimit
               {
                   **return **64%(#aaa9a7)[;
            ]    }

            **public boolean **isUseableByPlayer(EntityPlayer player)
               {
                   return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != **this **? **false **: player.getDistanceSq((double)this.**xCoord **+ 0.5D%(#aaa9a7), this.**yCoord **+ 0.5D%(#aaa9a7), this.**zCoord **+ 0.5D) <= 64.0D%(#aaa9a7)[;
            ]    }

            **public void **%(#afb8c5)openInventory
               {

            }

            **public void **%(#afb8c5)closeInventory
               {

            }

            **public boolean **isItemValidForSlot(**int **slot, ItemStack stack)
               {
                   **return ***slot *== 3 ? **false **: true%(#aaa9a7)[;
            ]    }

            **public boolean **%(#afb8c5)isBurning
               {
                   return this.**workingTime **> 0%(#aaa9a7)[;
            ]    }

            **private boolean **%(#afb8c5)canSmelt
               {
                   if(this.contents[0] == **null **|| this.contents[1] == **null **|| this.contents[2] == null)
                   {
                       return false%(#aaa9a7)[;
            ]        }
                   %(#0187df)[**else
            **]        {
                       ItemStack **itemstack **= AlloyerRecipes.%(#afb8c5)smelting.getSmeltingResult(**new **ItemStack[] {this.contents[0], this.contents[1], this.contents[2]})%(#aaa9a7)[;
            ]            if(**itemstack **== null)
                           return false%(#aaa9a7)[;
            ]            if(this.contents[3] == null)
                           return true%(#aaa9a7)[;
            ]            %(#0187df)if
                           return false%(#aaa9a7)[;
            ]            **int ****result **= contents[3].**stackSize **+ itemstack.stackSize%(#aaa9a7)[;
            ]            **return ****result **<= %(#afb8c5)getInventoryStackLimit && **result **<= this.contents[3].%(#afb8c5)getMaxStackSize%(#aaa9a7)[;
            ]        }
               }

            **public void **%(#afb8c5)updateEntity
               {
                   if(this.%(#afb8c5)isBurning && this.%(#afb8c5)canSmelt)
                   {
                       ++this.workingTime%(#aaa9a7)[;
            ]        }
                   if(this.%(#afb8c5)canSmelt && !this.%(#afb8c5)isBurning)
                   {
                       this.**workingTime **= 1%(#aaa9a7)[;
            ]        }
                   if(this.%(#afb8c5)canSmelt && this.**workingTime **== this.workingTimeNeeded)
                   {
                       this.%(#afb8c5)smeltItem%(#aaa9a7)[;
            ]            this.**workingTime **= 0%(#aaa9a7)[;
            ]        }
                   %(#0187df)if
                   {
                       this.**workingTime **= 0%(#aaa9a7)[;
            ]        }
               }

            **public void **%(#afb8c5)smeltItem
               {
                   %(#0187df)if
                   {
                       ItemStack **itemstack **= AlloyerRecipes.%(#afb8c5)smelting.getSmeltingResult(**new **ItemStack[] {this.contents[0], this.contents[1], this.contents[2]})%(#aaa9a7)[;
            ]            if(this.contents[3] == null)
                       {
                           this.contents[3] = itemstack.%(#afb8c5)copy%(#aaa9a7)[;
            ]            }
                       else if(this.contents[3].%(#afb8c5)getItem == itemstack.%(#afb8c5)getItem)
                       {
                           this.contents[3].**stackSize **+= itemstack.stackSize%(#aaa9a7)[;
            ]            }

            –this.contents[0].stackSize%(#aaa9a7)[;
            ]            –this.contents[1].stackSize%(#aaa9a7)[;
            ]            –this.contents[2].stackSize%(#aaa9a7)[;
            ]
                       if(this.contents[0].**stackSize **<= 0)
                       {
                           this.contents[0] = null%(#aaa9a7)[;
            ]            }
                       if(this.contents[1].**stackSize **<= 0)
                       {
                           this.contents[1] = null%(#aaa9a7)[;
            ]            }
                       if(this.contents[2].**stackSize **<= 0)
                       {
                           this.contents[2] = null%(#aaa9a7)[;
            ]            }
                   }
               }
            }

            :::

            1 réponse Dernière réponse Répondre Citer 0
            • AymericRed
              AymericRed dernière édition par 27 févr. 2016, 11:18

              Ta méthode isBurning return workingTime > 0 or pour que cette condition soit remplie, il faut que isBurning return true, donc workingTime ne peut pas augmenter

              Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

              AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

              Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
              Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

              1 réponse Dernière réponse Répondre Citer 0
              • SpyMan
                SpyMan dernière édition par 27 févr. 2016, 11:24

                Comme ceci ?

                [font=Consolas**public boolean **]%(#afb8c5)isBurning
                {
                   return true%(#aaa9a7)[;
                ]}

                1 réponse Dernière réponse Répondre Citer 0
                • AymericRed
                  AymericRed dernière édition par 27 févr. 2016, 11:55

                  Ah non, j’avais pas vu qq chose, le problème vient d’autre part ^^

                  Essaye de vérifier si les id de tes slots sont bien cnfigurés (dans le Container) et si tu place les items dans les bons slots.

                  Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                  AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                  Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                  Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

                  1 réponse Dernière réponse Répondre Citer 0
                  • SpyMan
                    SpyMan dernière édition par 27 févr. 2016, 12:06

                    J’ai déjà verifié les slots

                    1 réponse Dernière réponse Répondre Citer 0
                    • BrokenSwing
                      BrokenSwing Moddeurs confirmés Rédacteurs dernière édition par 27 févr. 2016, 12:11

                      private int workingTimeNeeded = 0;
                      

                      C’est ça qui pose un problème il faut que la valeur soit > 0 et pour + de sécurité met ça comme fonction updateEntity() :

                      public void updateEntity()
                      {
                      if(this.isBurning() && this.canSmelt())
                      {
                      ++this.workingTime;
                      //System.out.println(workingTime + "/" + workingTimeNeeded); C'est ici que j'ai vu le problème
                      }
                      if(this.canSmelt() && !this.isBurning())
                      {
                      this.workingTime = 1;
                      }
                      if(this.canSmelt() && this.workingTime >= this.workingTimeNeeded) //Au lieu de == mettre >= au cas où
                      {
                      this.smeltItem();
                      this.workingTime = 0;
                      }
                      if(!this.canSmelt())
                      {
                      this.workingTime = 0;
                      }
                      }

                      EDIT : et change pas ta fonction isBurning(), surtout pas, il faut laisser ```java
                      return this.workingTime > 0;

                      EDIT 2: En fait pour informer la fonction isBurning n'est pas vraiment utile pour le fonctionnement, elle est + utile pour le rendu quand on veut par exemple rendre une texture différente selon si il est en pleine cuissson ou non (comme le four de minecraft), du coup la fonction updateEntity pourrai ressembler à ça :
                      ```java
                      public void updateEntity()
                      {
                      if(this.canSmelt())
                      {
                      ++this.workingTime;
                      }
                      if(this.workingTime >= this.workingTimeNeeded)
                      {
                      this.smeltItem();
                      this.workingTime = 0;
                      }
                      if(!this.canSmelt())
                      {
                      this.workingTime = 0;
                      }
                      }
                      1 réponse Dernière réponse Répondre Citer 0
                      • SpyMan
                        SpyMan dernière édition par 27 févr. 2016, 16:57

                        D’accord, mais ma machine est un four avec trois slots en entré (un pour le charbon, et les 2 autres pour le craft) et un dernier pour le résultat du craft
                        Comment je peut faire un slot pour le combustible ?
                        et aussi appliqué la texture des flammes et les flèche de progression comme le four de minecraft ?

                        1 réponse Dernière réponse Répondre Citer 0
                        • BrokenSwing
                          BrokenSwing Moddeurs confirmés Rédacteurs dernière édition par 27 févr. 2016, 17:01

                          Pour la barre de progression : http://www.minecraftforgefrance.fr/showthread.php?tid=2017#bonus
                          Et pour le slot du carburant (c’est en 1.8 mais c’est l’idée qu’il faut reprendre pas tout le code) : http://www.minecraftforgefrance.fr/showthread.php?tid=2716#

                          1 réponse Dernière réponse Répondre Citer 0
                          • SpyMan
                            SpyMan dernière édition par robin4002 22 sept. 2018, 14:47 27 févr. 2016, 17:27

                            Comment je peut regler ce tout petit problème ?

                            1 réponse Dernière réponse Répondre Citer 0
                            • SCAREX
                              SCAREX dernière édition par 27 févr. 2016, 17:31

                              Tu n’as pas spécifié la largeur et la hauteur de ton gui dans ton constructeur

                              Site web contenant mes scripts : http://SCAREXgaming.github.io

                              Pas de demandes de support par MP ni par skype SVP.
                              Je n'accepte sur skype que l…

                              1 réponse Dernière réponse Répondre Citer 0
                              • SpyMan
                                SpyMan dernière édition par 27 févr. 2016, 18:20

                                Si pourtant

                                :::

                                [font=Consolas**public **]GuiAlloyer(TileEntityAlloyer tile, InventoryPlayer inventory)
                                {
                                   super(**new **ContainerAlloyer(tile, inventory))%(#aaa9a7)[;
                                ]    this.**tileAlloyer **= tile%(#aaa9a7)[;
                                ]    this.**playerInv **= inventory%(#aaa9a7)[;
                                ]    this.**allowUserInput **= false%(#aaa9a7)[;
                                ]    this.**ySize **= 256%(#aaa9a7)[;
                                ]    this.**xSize **= 256%(#aaa9a7)[;
                                ]}

                                %(#278c3c)[***@Override
                                ***]**protected void **drawGuiContainerBackgroundLayer(**float **partialRenderTick, **int **x, **int **y)
                                {
                                   GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F)%(#aaa9a7)[;
                                ]    this.mc.%(#afb8c5)getTextureManager.%(#afb8c5)bindTexture%(#aaa9a7)[;
                                ]    **int ****k **= (this.**width **- this.xSize) / 2%(#aaa9a7)[;
                                ]    **int ****l **= (this.**height **- this.ySize) / 2%(#aaa9a7)[;
                                ]    this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize)%(#aaa9a7)[;
                                ]    this.drawTexturedModalRect(k, l, 176, 14, xSize, ySize)%(#aaa9a7)[;
                                ]}

                                :::

                                1 réponse Dernière réponse Répondre Citer 0
                                • SCAREX
                                  SCAREX dernière édition par 27 févr. 2016, 18:24

                                  this.xSize = 256; Sachant que c’est sur une base 256, tu affiches la texture en entier (même chose pour l’axe Y)

                                  Site web contenant mes scripts : http://SCAREXgaming.github.io

                                  Pas de demandes de support par MP ni par skype SVP.
                                  Je n'accepte sur skype que l…

                                  1 réponse Dernière réponse Répondre Citer 0
                                  • SpyMan
                                    SpyMan dernière édition par 27 févr. 2016, 18:42

                                    Là j’ai carrément plus rien 😕

                                    1 réponse Dernière réponse Répondre Citer 0
                                    • BrokenSwing
                                      BrokenSwing Moddeurs confirmés Rédacteurs dernière édition par 27 févr. 2016, 19:02

                                      Ça rend pas trop mal :
                                      Gui :

                                      package com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer;
                                      import org.lwjgl.opengl.GL11;
                                      import com.google.SpyMan.Mechanicalcraft.common.MechanicalCraft;
                                      import net.minecraft.client.gui.inventory.GuiContainer;
                                      import net.minecraft.client.resources.I18n;
                                      import net.minecraft.entity.player.InventoryPlayer;
                                      import net.minecraft.inventory.IInventory;
                                      import net.minecraft.util.ResourceLocation;
                                      public class GuiAlloyer extends GuiContainer
                                      {
                                      private static final ResourceLocation texture = new ResourceLocation(MechanicalCraft.MOD_ID,"textures/gui/container/GuiAlloyer1.png");
                                      private TileEntityAlloyer tileAlloyer;
                                      private IInventory playerInv;
                                      public GuiAlloyer(TileEntityAlloyer tile, InventoryPlayer inventory)
                                      {
                                      super(new ContainerAlloyer(tile, inventory));
                                      this.tileAlloyer = tile;
                                      this.playerInv = inventory;
                                      this.allowUserInput = false;
                                      this.ySize = 200;
                                      this.xSize = 200;
                                      }
                                      @Override
                                      protected void drawGuiContainerBackgroundLayer(float partialRenderTick, int x, int y)
                                      {
                                      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                                      this.mc.getTextureManager().bindTexture(texture);
                                      int k = (this.width - this.xSize) / 2;
                                      int l = (this.height - this.ySize) / 2;
                                      this.drawTexturedModalRect(k, l, 0, 0, 175, 200);
                                      if(this.tileAlloyer.isBurning())
                                      {
                                      /*
                                      * this.drawTexturedModalRect(x, y, u, v, width, height)
                                      *
                                      * x: correspond à la coordonnée x du gui (in-game) où s'affichera la texture de la barre de progression.
                                      * y: correspond à la coordonnée y du gui (in-game) où s'affichera la texture de la barre de progression.
                                      * u: correspond à la position x de votre barre de progression sur votre texture (dans les ressources, l'image .png).
                                      * v: correspond à la position y de votre barre de progression sur votre texture (dans les ressources, l'image .png).
                                      * width: correspond à la largeur du morceau de texture que vous voulez afficher.
                                      * height: correspond à la hauteur du morceau de texture que vous voulez afficher.
                                      */
                                      int i = this.tileAlloyer.getCookProgress();
                                      this.drawTexturedModalRect(k + 47, l + 46, 0, 2, 100, i);
                                      }
                                      }
                                      protected void drawGuiContainerForegroundLayer(int x, int y)
                                      {
                                      this.fontRendererObj.drawString(this.playerInv.hasCustomInventoryName() ? this.playerInv.getInventoryName() : I18n.format(this.playerInv.getInventoryName()), 9, this.ySize - 127, 4210752);
                                      }
                                      }

                                      Container :

                                      package com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer;
                                      import net.minecraft.entity.player.EntityPlayer;
                                      import net.minecraft.entity.player.InventoryPlayer;
                                      import net.minecraft.inventory.Container;
                                      import net.minecraft.inventory.IInventory;
                                      import net.minecraft.inventory.Slot;
                                      import net.minecraft.item.ItemStack;
                                      public class ContainerAlloyer extends Container
                                      {
                                      private TileEntityAlloyer tileAlloyer;
                                      public ContainerAlloyer(TileEntityAlloyer tile, InventoryPlayer inventory)
                                      {
                                      this.tileAlloyer = tile;
                                      this.addSlotToContainer(new Slot((IInventory)tile, 0, 43, 17));//dust 1
                                      this.addSlotToContainer(new Slot((IInventory)tile, 1, 69, 17));//dust 2
                                      this.addSlotToContainer(new Slot((IInventory)tile, 2, 56, 53));//coal
                                      this.addSlotToContainer(new AlloyerSlotResult(tile, 3, 116, 35));//result
                                      this.bindPlayerInventory(inventory);
                                      }
                                      @Override
                                      public boolean canInteractWith(EntityPlayer player)
                                      {
                                      return this.tileAlloyer.isUseableByPlayer(player);
                                      }
                                      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, 84 + i * 18));
                                      }
                                      }
                                      for (i = 0; i < 9; ++i)
                                      {
                                      this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142));
                                      }
                                      }
                                      public ItemStack transferStackInSlot(EntityPlayer player, int quantity)
                                      {
                                      ItemStack itemstack = null;
                                      Slot slot = (Slot)this.inventorySlots.get(quantity);
                                      if (slot != null && slot.getHasStack())
                                      {
                                      ItemStack itemstack1 = slot.getStack();
                                      itemstack = itemstack1.copy();
                                      if (quantity < this.tileAlloyer.getSizeInventory())
                                      {
                                      if (!this.mergeItemStack(itemstack1, this.tileAlloyer.getSizeInventory(), this.inventorySlots.size(), true))
                                      {
                                      return null;
                                      }
                                      }
                                      else if (!this.mergeItemStack(itemstack1, 0, this.tileAlloyer.getSizeInventory(), false))
                                      {
                                      return null;
                                      }
                                      if (itemstack1.stackSize == 0)
                                      {
                                      slot.putStack((ItemStack)null);
                                      }
                                      else
                                      {
                                      slot.onSlotChanged();
                                      }
                                      }
                                      return itemstack;
                                      }
                                      public void onContainerClosed(EntityPlayer player)
                                      {
                                      super.onContainerClosed(player);
                                      this.tileAlloyer.closeInventory();
                                      }
                                      }
                                      1 réponse Dernière réponse Répondre Citer 0
                                      • SCAREX
                                        SCAREX dernière édition par 27 févr. 2016, 19:06

                                        Les valeurs dépendent de ta texture : déjà il faut regarder si ta texture fait du 256x256

                                        Site web contenant mes scripts : http://SCAREXgaming.github.io

                                        Pas de demandes de support par MP ni par skype SVP.
                                        Je n'accepte sur skype que l…

                                        1 réponse Dernière réponse Répondre Citer 0
                                        • SpyMan
                                          SpyMan dernière édition par 27 févr. 2016, 20:43

                                          Merci de votre aide, mais il me reste encore un problème, la flèche de progression de s’affiche pas et comment modifie ton la vitesse de craft ?

                                          1 réponse Dernière réponse Répondre Citer 0
                                          • 1
                                          • 2
                                          • 3
                                          • 4
                                          • 2 / 4
                                          21 sur 76
                                          • Premier message
                                            21/76
                                            Dernier message
                                          Design by Woryk
                                          Contact / Mentions Légales

                                          MINECRAFT FORGE FRANCE © 2018

                                          Powered by NodeBB