MFF

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

    Problème GUI

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    76 Messages 6 Publieurs 11.9k 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

      Là mon craft ne demarre pas

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

        1. Pourquoi “protected static” pour tes variables dans le TE ? Jamais static à part pour certains cas
        2. Dans la fonction canSmelt() :
        Pourquoi tester si le slot du carburant est vide ? Il faut juste qu’il reste du burnTime
        Et pourquoi mettre 3 items pour dans le tableau en paramètre de la fonction getSmeltingResult(ItemStack[] stacks) ? Il faut en mettre 2
        3. Enlève la fonction getBurnTime(ItemStack stack)

        Et je suis encore en train de voir le reste

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

          
          package com.google.SpyMan.Mechanicalcraft.common.BlockAlloyer;
          
          import net.minecraft.entity.player.EntityPlayer;
          import net.minecraft.inventory.IInventory;
          import net.minecraft.item.ItemStack;
          import net.minecraft.nbt.NBTTagCompound;
          import net.minecraft.nbt.NBTTagList;
          import net.minecraft.tileentity.TileEntity;
          import net.minecraft.tileentity.TileEntityFurnace;
          import cpw.mods.fml.relauncher.Side;
          import cpw.mods.fml.relauncher.SideOnly;
          
          public class TileEntityAlloyer extends TileEntity implements IInventory
          {
          private byte direction;
          public byte getDirection()
          {
          return direction;
          }
          
          public void setDirection(byte direction)
          {
          this.direction = direction;
          this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
          }
          
          private ItemStack[] contents = new ItemStack[4];
          protected int workingTime = 0;
          protected int workingTimeNeeded = 200;
          protected int burnTime = 0;
          protected int burnTimeTotal = 0;
          
          @Override
          public void writeToNBT(NBTTagCompound compound)
          {
          super.writeToNBT(compound);
          NBTTagList nbttaglist = new NBTTagList();
          compound.setByte("Direction", this.direction);
          for(int i = 0; i < this.contents.length; ++i)
          {
          if(this.contents* != null)
          {
          NBTTagCompound nbttagcompound1 = new NBTTagCompound();
          nbttagcompound1.setByte("Slot", (byte)i);
          this.contents*.writeToNBT(nbttagcompound1);
          nbttaglist.appendTag(nbttagcompound1);
          
          }
          }
          compound.setTag("Items", nbttaglist);
          compound.setShort("workingTime", (short)this.workingTime);
          compound.setShort("workingTimeNeeded", (short)this.workingTimeNeeded);
          }
          
          @Override
          public void readFromNBT(NBTTagCompound compound)
          {
          super.readFromNBT(compound);
          this.direction = compound.getByte("Direction");
          NBTTagList nbttaglist = compound.getTagList("Items", 10);
          this.contents = new ItemStack[this.getSizeInventory()];
          
          for(int i = 0; i < nbttaglist.tagCount(); ++i)
          {
          NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
          int j = nbttagcompound1.getByte("Slot") & 255;
          
          if(j >= 0 && j < this.contents.length)
          {
          this.contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
          }
          }
          this.workingTime = compound.getShort("workingTime");
          this.workingTimeNeeded = compound.getShort("workingTimeNeeded");
          }
          
          public int getSizeInventory()
          {
          return this.contents.length;
          }
          
          public ItemStack getStackInSlot(int slotIndex)
          {
          return this.contents[slotIndex];
          }
          
          public ItemStack decrStackSize(int slotIndex, int amount)
          {
          if(this.contents[slotIndex] != null)
          {
          ItemStack itemstack;
          
          if(this.contents[slotIndex].stackSize <= amount)
          {
          itemstack = this.contents[slotIndex];
          this.contents[slotIndex] = null;
          this.markDirty();
          return itemstack;
          }
          else
          {
          itemstack = this.contents[slotIndex].splitStack(amount);
          
          if(this.contents[slotIndex].stackSize == 0)
          {
          this.contents[slotIndex] = null;
          }
          this.markDirty();
          return itemstack;
          }
          }
          else
          {
          return null;
          }
          }
          
          public ItemStack getStackInSlotOnClosing(int slotIndex)
          {
          if(this.contents[slotIndex] != null)
          {
          ItemStack itemstack = this.contents[slotIndex];
          this.contents[slotIndex] = null;
          return itemstack;
          }
          else
          {
          return null;
          }
          }
          
          public void setInventorySlotContents(int slotIndex, ItemStack stack)
          {
          this.contents[slotIndex] = stack;
          
          if(stack != null && stack.stackSize > this.getInventoryStackLimit())
          {
          stack.stackSize = this.getInventoryStackLimit();
          }
          this.markDirty();
          }
          
          public String getInventoryName()
          {
          return "tile.Alloyer";
          }
          
          public boolean hasCustomInventoryName()
          {
          return false;
          }
          
          public int getInventoryStackLimit()
          {
          return 64;
          }
          
          public boolean isUseableByPlayer(EntityPlayer player)
          {
          return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D;
          }
          
          public void openInventory() {}
          
          public void closeInventory() {}
          
          public boolean isItemValidForSlot(int slot, ItemStack stack)
          {
          return slot == 3 ? false : true;
          }
          
          public boolean isBurning()
          {
          return this.workingTime > 0;
          }
          
          private boolean canSmelt()
          {
          if(this.contents[0] == null || this.contents[1] == null)
          {
          return false;
          }
          else
          {
          ItemStack itemstack = AlloyerRecipes.smelting().getSmeltingResult(new ItemStack[] {this.contents[0], this.contents[1]});
          if(itemstack == null)
          return false;
          if(this.contents[3] == null)
          return true;
          if(!this.contents[3].isItemEqual(itemstack))
          return false;
          int result = contents[3].stackSize + itemstack.stackSize;
          return result <= getInventoryStackLimit() && result <= this.contents[3].getMaxStackSize();
          }
          }
          
          public void updateEntity()
          {
          System.out.println(burnTime + "/" + burnTimeTotal);
          if(this.burnTime > 0) {
          burnTime–;
          }
          if(this.canSmelt())
          {
          if(this.burnTime <= 0) {
          int time = TileEntityFurnace.getItemBurnTime(contents[2]);
          this.decrStackSize(2, 1);
          this.burnTimeTotal = time;
          this.burnTime = time;
          }
          if(burnTime > 0) {
          workingTime++;
          }
          }
          if (this.workingTime >= this.workingTimeNeeded)
          {
          this.smeltItem();
          this.workingTime = 0;
          }
          if (!this.canSmelt() || burnTime <= 0)
          {
          this.workingTime = 0;
          }
          }
          
          public void smeltItem()
          {
          if(this.canSmelt())
          {
          ItemStack itemstack = AlloyerRecipes.smelting().getSmeltingResult(new ItemStack[] {this.contents[0], this.contents[1]});
          if(this.contents[3] == null)
          {
          this.contents[3] = itemstack.copy();
          }
          else if(this.contents[3].getItem() == itemstack.getItem())
          {
          this.contents[3].stackSize += itemstack.stackSize;
          }
          
          this.decrStackSize(0, 1);
          this.decrStackSize(1, 1);
          }
          }
          
          @SideOnly(Side.CLIENT)
          public int getCookProgress()
          {
          return this.workingTime * 24 / this.workingTimeNeeded;
          }
          }
          
          
          1 réponse Dernière réponse Répondre Citer 0
          • SpyManS Hors-ligne
            SpyMan
            dernière édition par

            La texture des flammes se réduit en commençant par le bas au lieu du haut de la texture

            [font=Consolas**int **]**p **= this.tileAlloyer.%(#b871ff)getBurnTime;
            [font=Consolasthis].drawTexturedModalRect(**k **+ 57, **l **+ 36, 176, 1, 14, **p **+ 1);

            Fonction getBurnTime()

            %(#a9b7c6)[font=Consolas]@SideOnly
            **public int **%(#b871ff)getBurnTime
            {
               return this.**burnTime *%(#aaa9a7) 14 / this.burnTimeTotal%(#aaa9a7)[;
            ]}

            le "14" correspond a la hauteur/largeur (Texture carré) de ma texture
            
            1 réponse Dernière réponse Répondre Citer 0
            • AymericRedA Hors-ligne
              AymericRed
              dernière édition par

              Mets le v à 14 au lieu de 1 (comme la texture se dessine par le bas,il faut commencer en bas de celle-ci)

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

                Si je change le 1 ça ne dessine pas la bonne texture

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

                  Le 1 après le 176 ?
                  Bizarre, je regarde ça dans une demi-heure

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

                    oui ce “1” là

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

                      this.drawTexturedModalRect(k + 57, l + 37 + (14 - p), 176, 14 - p, 14, p);
                      
                      1 réponse Dernière réponse Répondre Citer 0
                      • SpyManS Hors-ligne
                        SpyMan
                        dernière édition par

                        Merci tout fonctionne maintenant !

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

                        MINECRAFT FORGE FRANCE © 2024

                        Powered by NodeBB