MFF

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

    Machine Recipe Complex

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    43 Messages 4 Publieurs 6.1k 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.
    • AymericRedA Hors-ligne
      AymericRed
      dernière édition par

      Dans ton for() de ta fonction smelt, tu as mis un <= au lieu d’un<

      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

        Quand un craft est terminé le suivant ne se lance pas car le premier slot (3) n’est pas vide et les items du même type se dispatche sur plusieurs slots au lieu de se retrouver dans le même. Comment faire ?

        [font=Courier Newpublic class ]TileEntityOreExtractor extends TileEntity implements %(#345f99)[IInventory
        ]{
           private byte direction%(#aaa9a7)[;
        ]    %(#8242ff)[/** Slots list */
        ]    private ItemStack[] contents = new ItemStack[15]%(#aaa9a7)[;
        ]    %(#8242ff)[/** Actual working time */
        ]    protected int workingTime = 0%(#aaa9a7)[;
        ]    %(#8242ff)[/** Working time for one recipes */
        ]    protected int workingTimeNeeded = 200%(#aaa9a7)[;
        ]    %(#8242ff)[/** Working time default value for one recipes */
        ]    protected int workingTimeNeededDefault = 200%(#aaa9a7)[;
        ]    %(#8242ff)[/** Actual burn time */
        ]    protected int burnTime = 0%(#aaa9a7)[;
        ]    %(#8242ff)[/** Burn time of fuel */
        ]    protected int burnTimeTotal = 0%(#aaa9a7)[;
        ]    %(#8242ff)[/** Id of the result slot */
        ]    private int slotResultID = 3%(#aaa9a7)[;
        ]    %(#8242ff)[/** Id of the upgrade slot */
        ]    private int slotUpgradeID = 2%(#aaa9a7)[;
        ]    %(#8242ff)[/** Id of the fuel slot */
        ]    private int slotFuelID = 1%(#aaa9a7)[;
        ]    %(#8242ff)[/** Id of the input slot */
        ]    private int slotInputID = 0%(#aaa9a7)[;
        ]
           %(#278c3c)[***@Override
        ***]    public void readFromNBT(NBTTagCompound *compound*)
           {
               super.readFromNBT(*compound*)%(#aaa9a7)[;
        ]        this.direction = *compound*.getByte("Direction")%(#aaa9a7)[;
        ]        NBTTagList nbttaglist = *compound*.getTagList("Items", 10)%(#aaa9a7)[;
        ]        this.contents = new ItemStack[this.getSizeInventory()]%(#aaa9a7)[;
        ]
               for(int %(#666965)_= 0; %(#666965)_< nbttaglist.tagCount(); ++%(#666965)*)
               {
                   NBTTagCompound nbtTagCompound = nbttaglist.getCompoundTagAt(%(#666965)*)%(#aaa9a7)[;
        ]            int j = nbtTagCompound.getByte("Slot") & 255%(#aaa9a7)[;
        ]
                   if(j >= 0 && j < this.contents.length)
                   {
                       this.contents[j] = ItemStack.loadItemStackFromNBT(nbtTagCompound)%(#aaa9a7)[;
        ]            }
               }
               this.workingTime = *compound*.getShort("workingTime")%(#aaa9a7)[;
        ]        this.burnTime = *compound*.getShort("burnTime")%(#aaa9a7)[;
        ]        this.burnTimeTotal = *compound*.getShort("burnTimeTotal")%(#aaa9a7)[;
        ]    }
        
           %(#278c3c)[***@Override
        ***]    public void writeToNBT(NBTTagCompound *compound*)
           {
               super.writeToNBT(*compound*)%(#aaa9a7)[;
        ]        NBTTagList nbttaglist = new NBTTagList()%(#aaa9a7)[;
        ]        *compound*.setByte("Direction", this.direction)%(#aaa9a7)[;
        ]        for(int %(#666965)_= 0; %(#666965)_< this.contents.length; ++%(#666965)*)
               {
                   if(this.contents[%(#666965)*] != null)
                   {
                       NBTTagCompound nbtTagCompound = new NBTTagCompound()%(#aaa9a7)[;
        ]                nbtTagCompound.setByte("Slot", (byte)%(#666965)*)%(#aaa9a7)[;
        ]                this.contents[%(#666965)*].writeToNBT(nbtTagCompound)%(#aaa9a7)[;
        ]                nbttaglist.appendTag(nbtTagCompound)%(#aaa9a7)[;
        ]
                   }
               }
               *compound*.setTag("Items", nbttaglist)%(#aaa9a7)[;
        ]        *compound*.setShort("workingTime", (short)this.workingTime)%(#aaa9a7)[;
        ]        *compound*.setShort("burnTime", (short)this.burnTime)%(#aaa9a7)[;
        ]        *compound*.setShort("burnTimeTotal", (short)this.burnTimeTotal)%(#aaa9a7)[;
        ]    }
        
           public byte getDirection()
           {
               return direction%(#aaa9a7)[;
        ]    }
        
           public void setDirection(byte *direction*)
           {
               this.direction = *direction*%(#aaa9a7)[;
        ]        this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord)%(#aaa9a7)[;
        ]    }
        
           public Packet getDescriptionPacket()
           {
               NBTTagCompound nbtTagCompound = new NBTTagCompound()%(#aaa9a7)[;
        ]        this.writeToNBT(nbtTagCompound)%(#aaa9a7)[;
        ]        return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbtTagCompound)%(#aaa9a7)[;
        ]    }
        
           public void onDataPacket(NetworkManager *net*, S35PacketUpdateTileEntity *pkt*)
           {
               this.readFromNBT(*pkt*.func_148857_g())%(#aaa9a7)[;
        ]    }
        
           public int getSizeInventory()
           {
               return this.contents.length%(#aaa9a7)[;
        ]    }
        
           public void openInventory() {}
        
           public void closeInventory() {}
        
           public String getInventoryName()
           {
               return MechanicalCraft.oreExtractor.getLocalizedName()%(#aaa9a7)[;
        ]    }
        
           public boolean hasCustomInventoryName()
           {
               return false%(#aaa9a7)[;
        ]    }
        
           public int 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, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D%(#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.markDirty()%(#aaa9a7)[;
        ]                return itemstack%(#aaa9a7)[;
        ]            }
                   %(#0187df)[else
        ]            {
                       itemstack = this.contents[*slotIndex*].splitStack(*amount*)%(#aaa9a7)[;
        ]
                       if(this.contents[*slotIndex*].stackSize == 0)
                       {
                           this.contents[*slotIndex*] = null%(#aaa9a7)[;
        ]                }
                       this.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.getInventoryStackLimit())
               {
                   *stack*.stackSize = this.getInventoryStackLimit()%(#aaa9a7)[;
        ]        }
               this.markDirty()%(#aaa9a7)[;
        ]    }
        
           public boolean isItemValidForSlot(int *slot*, ItemStack *stack*)
           {
               return *slot *== 2 ? false : true%(#aaa9a7)[;
        ]    }
        
           public boolean isBurning()
           {
               return this.workingTime > 0%(#aaa9a7)[;
        ]    }
        
           protected boolean canSmelt()
           {
               if(this.contents[this.slotInputID] == null)
               {
                   return false%(#aaa9a7)[;
        ]        }
               %(#0187df)[else
        ]        {
                   ItemStack itemstack = OreExtractorRecipes.smelting().getSmeltingResult(new ItemStack[] { this.contents[this.slotInputID] })%(#aaa9a7)[;
        ]            int j = 0%(#aaa9a7)[;
        ]            
                   for (int %(#666965)_= 3; %(#666965)_< 15; %(#666965)*++)
                   {
                       j = %(#666965)*%(#aaa9a7)[;
        ]
                       if (itemstack == null)
                       {
                           return false%(#aaa9a7)[;
        ]                }
                       if (this.contents[%(#666965)*] == null)
                       {
                           return true%(#aaa9a7)[;
        ]                }
                       if (!this.contents[%(#666965)*].isItemEqual(itemstack))
                       {
                           return false%(#aaa9a7)[;
        ]                }
                   }
                   int result = contents[j].stackSize + itemstack.stackSize%(#aaa9a7)[;
        ]            return result <= getInventoryStackLimit() && result <= this.contents[j].getMaxStackSize()%(#aaa9a7)[;
        ]        }
           }
        
           public void smeltItem()
           {
               ItemStack itemstack = OreExtractorRecipes.smelting().getSmeltingResult(new ItemStack[] { this.contents[this.slotInputID] })%(#aaa9a7)[;
        ]
               for (int %(#666965)_= 3; %(#666965)_< 15; %(#666965)*++)
               {
                   if (this.canSmelt())
                   {
                       if (this.contents[%(#666965)*] == null)
                       {
                           this.contents[%(#666965)*] = itemstack.copy()%(#aaa9a7)[;
        ]                }
                       else if (this.contents[%(#666965)*].getItem() == itemstack.getItem())
                       {
                           this.contents[%(#666965)*].stackSize += itemstack.stackSize%(#aaa9a7)[;
        ]                }
        
                       this.decrStackSize(0, 1)%(#aaa9a7)[;
        ]            }
               }
           }
        
           public void updateEntity()
           {
               if(this.burnTime > 0)
               {
                   burnTime%(#aaa9a7)[–;
        ]        }
               if(this.canSmelt())
               {
                   if(this.burnTime <= 0)
                   {
                       int %(#666965)________
        1 réponse Dernière réponse Répondre Citer 0
        • AymericRedA Hors-ligne
          AymericRed
          dernière édition par

          "                if (!this.contents*.isItemEqual(itemstack))
                          {
                              return false;
                          }" dans canSmelt(), si tu mets return false, le for s’arrêtera et tu ne cherche pas dans les autres slots, il faut que tu mettes un break à la place.

          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

            Le recipes se fait mais tout les slotresults sont remplit par le même item et le stack en input se consume 10 par 10

            [font=Trebuchet MSpublic class ]TileEntityOreExtractor extends TileEntity implements %(#345f99)[IInventory
            ]{
               private byte direction%(#aaa9a7)[;
            ]    %(#8242ff)[/** Slots list */
            ]    private ItemStack[] contents = new ItemStack[15]%(#aaa9a7)[;
            ]    %(#8242ff)[/** Actual working time */
            ]    protected int workingTime = 0%(#aaa9a7)[;
            ]    %(#8242ff)[/** Working time for one recipes */
            ]    protected int workingTimeNeeded = 200%(#aaa9a7)[;
            ]    %(#8242ff)[/** Working time default value for one recipes */
            ]    protected int workingTimeNeededDefault = 200%(#aaa9a7)[;
            ]    %(#8242ff)[/** Actual burn time */
            ]    protected int burnTime = 0%(#aaa9a7)[;
            ]    %(#8242ff)[/** Burn time of fuel */
            ]    protected int burnTimeTotal = 0%(#aaa9a7)[;
            ]    %(#8242ff)[/** Id of the result slot */
            ]    private int slotResultID = 3%(#aaa9a7)[;
            ]    %(#8242ff)[/** Id of the upgrade slot */
            ]    private int slotUpgradeID = 2%(#aaa9a7)[;
            ]    %(#8242ff)[/** Id of the fuel slot */
            ]    private int slotFuelID = 1%(#aaa9a7)[;
            ]    %(#8242ff)[/** Id of the input slot */
            ]    private int slotInputID = 0%(#aaa9a7)[;
            ]
               %(#278c3c)[***@Override
            ***]    public void readFromNBT(NBTTagCompound *compound*)
               {
                   super.readFromNBT(*compound*)%(#aaa9a7)[;
            ]        this.direction = *compound*.getByte("Direction")%(#aaa9a7)[;
            ]        NBTTagList nbttaglist = *compound*.getTagList("Items", 10)%(#aaa9a7)[;
            ]        this.contents = new ItemStack[this.getSizeInventory()]%(#aaa9a7)[;
            ]
                   for(int %(#666965)_= 0; %(#666965)_< nbttaglist.tagCount(); ++%(#666965)*)
                   {
                       NBTTagCompound nbtTagCompound = nbttaglist.getCompoundTagAt(%(#666965)*)%(#aaa9a7)[;
            ]            int j = nbtTagCompound.getByte("Slot") & 255%(#aaa9a7)[;
            ]
                       if(j >= 0 && j < this.contents.length)
                       {
                           this.contents[j] = ItemStack.loadItemStackFromNBT(nbtTagCompound)%(#aaa9a7)[;
            ]            }
                   }
                   this.workingTime = *compound*.getShort("workingTime")%(#aaa9a7)[;
            ]        this.burnTime = *compound*.getShort("burnTime")%(#aaa9a7)[;
            ]        this.burnTimeTotal = *compound*.getShort("burnTimeTotal")%(#aaa9a7)[;
            ]    }
            
               %(#278c3c)[***@Override
            ***]    public void writeToNBT(NBTTagCompound *compound*)
               {
                   super.writeToNBT(*compound*)%(#aaa9a7)[;
            ]        NBTTagList nbttaglist = new NBTTagList()%(#aaa9a7)[;
            ]        *compound*.setByte("Direction", this.direction)%(#aaa9a7)[;
            ]        for(int %(#666965)_= 0; %(#666965)_< this.contents.length; ++%(#666965)*)
                   {
                       if(this.contents[%(#666965)*] != null)
                       {
                           NBTTagCompound nbtTagCompound = new NBTTagCompound()%(#aaa9a7)[;
            ]                nbtTagCompound.setByte("Slot", (byte)%(#666965)*)%(#aaa9a7)[;
            ]                this.contents[%(#666965)*].writeToNBT(nbtTagCompound)%(#aaa9a7)[;
            ]                nbttaglist.appendTag(nbtTagCompound)%(#aaa9a7)[;
            ]
                       }
                   }
                   *compound*.setTag("Items", nbttaglist)%(#aaa9a7)[;
            ]        *compound*.setShort("workingTime", (short)this.workingTime)%(#aaa9a7)[;
            ]        *compound*.setShort("burnTime", (short)this.burnTime)%(#aaa9a7)[;
            ]        *compound*.setShort("burnTimeTotal", (short)this.burnTimeTotal)%(#aaa9a7)[;
            ]    }
            
               public byte getDirection()
               {
                   return direction%(#aaa9a7)[;
            ]    }
            
               public void setDirection(byte *direction*)
               {
                   this.direction = *direction*%(#aaa9a7)[;
            ]        this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord)%(#aaa9a7)[;
            ]    }
            
               public Packet getDescriptionPacket()
               {
                   NBTTagCompound nbtTagCompound = new NBTTagCompound()%(#aaa9a7)[;
            ]        this.writeToNBT(nbtTagCompound)%(#aaa9a7)[;
            ]        return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbtTagCompound)%(#aaa9a7)[;
            ]    }
            
               public void onDataPacket(NetworkManager *net*, S35PacketUpdateTileEntity *pkt*)
               {
                   this.readFromNBT(*pkt*.func_148857_g())%(#aaa9a7)[;
            ]    }
            
               public int getSizeInventory()
               {
                   return this.contents.length%(#aaa9a7)[;
            ]    }
            
               public void openInventory() {}
            
               public void closeInventory() {}
            
               public String getInventoryName()
               {
                   return MechanicalCraft.oreExtractor.getLocalizedName()%(#aaa9a7)[;
            ]    }
            
               public boolean hasCustomInventoryName()
               {
                   return false%(#aaa9a7)[;
            ]    }
            
               public int 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, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D%(#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.markDirty()%(#aaa9a7)[;
            ]                return itemstack%(#aaa9a7)[;
            ]            }
                       %(#0187df)[else
            ]            {
                           itemstack = this.contents[*slotIndex*].splitStack(*amount*)%(#aaa9a7)[;
            ]
                           if(this.contents[*slotIndex*].stackSize == 0)
                           {
                               this.contents[*slotIndex*] = null%(#aaa9a7)[;
            ]                }
                           this.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.getInventoryStackLimit())
                   {
                       *stack*.stackSize = this.getInventoryStackLimit()%(#aaa9a7)[;
            ]        }
                   this.markDirty()%(#aaa9a7)[;
            ]    }
            
               public boolean isItemValidForSlot(int *slot*, ItemStack *stack*)
               {
                   return *slot *== 2 ? false : true%(#aaa9a7)[;
            ]    }
            
               public boolean isBurning()
               {
                   return this.workingTime > 0%(#aaa9a7)[;
            ]    }
            
               protected boolean canSmelt()
               {
                   if(this.contents[this.slotInputID] == null)
                   {
                       return false%(#aaa9a7)[;
            ]        }
                   %(#0187df)[else
            ]        {
                       ItemStack itemstack = OreExtractorRecipes.smelting().getSmeltingResult(new ItemStack[] { this.contents[this.slotInputID] })%(#aaa9a7)[;
            ]            int j = 0%(#aaa9a7)[;
            ]
                       for (int %(#666965)_= 3; %(#666965)_< 15; %(#666965)*++)
                       {
                           j = %(#666965)*%(#aaa9a7)[;
            ]
                           if (itemstack == null)
                           {
                               return false%(#aaa9a7)[;
            ]                }
                           if (this.contents[%(#666965)*] == null)
                           {
                               return true%(#aaa9a7)[;
            ]                }
                           if (!this.contents[%(#666965)*].isItemEqual(itemstack))
                           {
                               break%(#aaa9a7)[;
            ]                }
                       }
                       int result = contents[j].stackSize + itemstack.stackSize%(#aaa9a7)[;
            ]            return result <= getInventoryStackLimit() && result <= this.contents[j].getMaxStackSize()%(#aaa9a7)[;
            ]        }
               }
            
               public void smeltItem()
               {
                   ItemStack itemstack = OreExtractorRecipes.smelting().getSmeltingResult(new ItemStack[] { this.contents[this.slotInputID] })%(#aaa9a7)[;
            ]
                   for (int %(#666965)_= 3; %(#666965)_< 15; %(#666965)*++)
                   {
                       if (this.canSmelt())
                       {
                           if (this.contents[%(#666965)*] == null)
                           {
                               this.contents[%(#666965)*] = itemstack.copy()%(#aaa9a7)[;
            ]                }
                           else if (this.contents[%(#666965)*].getItem() == itemstack.getItem())
                           {
                               this.contents[%(#666965)*].stackSize += itemstack.stackSize%(#aaa9a7)[;
            ]                }
            
                           this.decrStackSize(0, 1)%(#aaa9a7)[;
            ]            }
                   }
               }
            
               public void updateEntity()
               {
                   if(this.burnTime > 0)
                   {
                       burnTime%(#aaa9a7)[–;
            ]        }
                   if(this.canSmelt())
                   {
                       if(this.burnTime <= 0)
                       {
                           int %(#666965)________
            1 réponse Dernière réponse Répondre Citer 0
            • AymericRedA Hors-ligne
              AymericRed
              dernière édition par

              Alors déjà dans ta fonction canSmelt() :

                        int result = contents[j].stackSize + itemstack.stackSize;
              
              

              Il faut que tu mettes la condition du return dansun if dans ton for() et return true si la condition est réalisée. Et à la fin de la fonction, tu mets un return false.

              Dans ta fonction smelt(), quand tu insères le result dans un slot, tu n’arrêtes pas ton for() et il va continue d’ajouter dans tous les slots, il faut que tu l’arrêtes quand t’a résussi à ajouter le stack.

              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

                Mon jeu crash 😕

                [font=Courier Newpublic class ]TileEntityOreExtractor extends TileEntity implements %(#345f99)[IInventory
                ]{
                   private byte direction%(#aaa9a7)[;
                ]    %(#8242ff)[/** Slots list */
                ]    private ItemStack[] slotResult = new ItemStack[15]%(#aaa9a7)[;
                ]    %(#8242ff)[/** Actual working time */
                ]    protected int workingTime = 0%(#aaa9a7)[;
                ]    %(#8242ff)[/** Working time for one recipes */
                ]    protected int workingTimeNeeded = 200%(#aaa9a7)[;
                ]    %(#8242ff)[/** Working time default value for one recipes */
                ]    protected int workingTimeNeededDefault = 200%(#aaa9a7)[;
                ]    %(#8242ff)[/** Actual burn time */
                ]    protected int burnTime = 0%(#aaa9a7)[;
                ]    %(#8242ff)[/** Burn time of fuel */
                ]    protected int burnTimeTotal = 0%(#aaa9a7)[;
                ]    %(#8242ff)[/** Id of the result slot */
                ]    private int slotResultID = 3%(#aaa9a7)[;
                ]    %(#8242ff)[/** Id of the upgrade slot */
                ]    private int slotUpgradeID = 2%(#aaa9a7)[;
                ]    %(#8242ff)[/** Id of the fuel slot */
                ]    private int slotFuelID = 1%(#aaa9a7)[;
                ]    %(#8242ff)[/** Id of the input slot */
                ]    private int slotInputID = 0%(#aaa9a7)[;
                ]
                   %(#278c3c)[***@Override
                ***]    public void readFromNBT(NBTTagCompound *compound*)
                   {
                       super.readFromNBT(*compound*)%(#aaa9a7)[;
                ]        this.direction = *compound*.getByte("Direction")%(#aaa9a7)[;
                ]        NBTTagList nbttaglist = *compound*.getTagList("Items", 10)%(#aaa9a7)[;
                ]        this.slotResult = new ItemStack[this.getSizeInventory()]%(#aaa9a7)[;
                ]
                       for(int %(#666965)_= 0; %(#666965)_< nbttaglist.tagCount(); ++%(#666965)*)
                       {
                           NBTTagCompound nbtTagCompound = nbttaglist.getCompoundTagAt(%(#666965)*)%(#aaa9a7)[;
                ]            int j = nbtTagCompound.getByte("Slot") & 255%(#aaa9a7)[;
                ]
                           if(j >= 0 && j < this.slotResult.length)
                           {
                               this.slotResult[j] = ItemStack.loadItemStackFromNBT(nbtTagCompound)%(#aaa9a7)[;
                ]            }
                       }
                       this.workingTime = *compound*.getShort("workingTime")%(#aaa9a7)[;
                ]        this.burnTime = *compound*.getShort("burnTime")%(#aaa9a7)[;
                ]        this.burnTimeTotal = *compound*.getShort("burnTimeTotal")%(#aaa9a7)[;
                ]    }
                
                   %(#278c3c)[***@Override
                ***]    public void writeToNBT(NBTTagCompound *compound*)
                   {
                       super.writeToNBT(*compound*)%(#aaa9a7)[;
                ]        NBTTagList nbttaglist = new NBTTagList()%(#aaa9a7)[;
                ]        *compound*.setByte("Direction", this.direction)%(#aaa9a7)[;
                ]        for(int %(#666965)_= 0; %(#666965)_< this.slotResult.length; ++%(#666965)*)
                       {
                           if(this.slotResult[%(#666965)*] != null)
                           {
                               NBTTagCompound nbtTagCompound = new NBTTagCompound()%(#aaa9a7)[;
                ]                nbtTagCompound.setByte("Slot", (byte)%(#666965)*)%(#aaa9a7)[;
                ]                this.slotResult[%(#666965)*].writeToNBT(nbtTagCompound)%(#aaa9a7)[;
                ]                nbttaglist.appendTag(nbtTagCompound)%(#aaa9a7)[;
                ]
                           }
                       }
                       *compound*.setTag("Items", nbttaglist)%(#aaa9a7)[;
                ]        *compound*.setShort("workingTime", (short)this.workingTime)%(#aaa9a7)[;
                ]        *compound*.setShort("burnTime", (short)this.burnTime)%(#aaa9a7)[;
                ]        *compound*.setShort("burnTimeTotal", (short)this.burnTimeTotal)%(#aaa9a7)[;
                ]    }
                
                   public byte getDirection()
                   {
                       return direction%(#aaa9a7)[;
                ]    }
                
                   public void setDirection(byte *direction*)
                   {
                       this.direction = *direction*%(#aaa9a7)[;
                ]        this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord)%(#aaa9a7)[;
                ]    }
                
                   public Packet getDescriptionPacket()
                   {
                       NBTTagCompound nbtTagCompound = new NBTTagCompound()%(#aaa9a7)[;
                ]        this.writeToNBT(nbtTagCompound)%(#aaa9a7)[;
                ]        return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbtTagCompound)%(#aaa9a7)[;
                ]    }
                
                   public void onDataPacket(NetworkManager *net*, S35PacketUpdateTileEntity *pkt*)
                   {
                       this.readFromNBT(*pkt*.func_148857_g())%(#aaa9a7)[;
                ]    }
                
                   public int getSizeInventory()
                   {
                       return this.slotResult.length%(#aaa9a7)[;
                ]    }
                
                   public void openInventory() {}
                
                   public void closeInventory() {}
                
                   public String getInventoryName()
                   {
                       return MechanicalCraft.oreExtractor.getLocalizedName()%(#aaa9a7)[;
                ]    }
                
                   public boolean hasCustomInventoryName()
                   {
                       return false%(#aaa9a7)[;
                ]    }
                
                   public int 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, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D%(#aaa9a7)[;
                ]    }
                
                   public ItemStack getStackInSlot(int *slotIndex*)
                   {
                       return this.slotResult[*slotIndex*]%(#aaa9a7)[;
                ]    }
                
                   public ItemStack decrStackSize(int *slotIndex*, int *amount*)
                   {
                       if(this.slotResult[*slotIndex*] != null)
                       {
                           ItemStack itemstack%(#aaa9a7)[;
                ]
                           if(this.slotResult[*slotIndex*].stackSize <= *amount*)
                           {
                               itemstack = this.slotResult[*slotIndex*]%(#aaa9a7)[;
                ]                this.slotResult[*slotIndex*] = null%(#aaa9a7)[;
                ]                this.markDirty()%(#aaa9a7)[;
                ]                return itemstack%(#aaa9a7)[;
                ]            }
                           %(#0187df)[else
                ]            {
                               itemstack = this.slotResult[*slotIndex*].splitStack(*amount*)%(#aaa9a7)[;
                ]
                               if(this.slotResult[*slotIndex*].stackSize == 0)
                               {
                                   this.slotResult[*slotIndex*] = null%(#aaa9a7)[;
                ]                }
                               this.markDirty()%(#aaa9a7)[;
                ]                return itemstack%(#aaa9a7)[;
                ]            }
                       }
                       %(#0187df)[else
                ]        {
                           return null%(#aaa9a7)[;
                ]        }
                   }
                
                   public ItemStack getStackInSlotOnClosing(int *slotIndex*)
                   {
                       if(this.slotResult[*slotIndex*] != null)
                       {
                           ItemStack itemstack = this.slotResult[*slotIndex*]%(#aaa9a7)[;
                ]            this.slotResult[*slotIndex*] = null%(#aaa9a7)[;
                ]            return itemstack%(#aaa9a7)[;
                ]        }
                       %(#0187df)[else
                ]        {
                           return null%(#aaa9a7)[;
                ]        }
                   }
                
                   public void setInventorySlotContents(int *slotIndex*, ItemStack *stack*)
                   {
                       this.slotResult[*slotIndex*] = *stack*%(#aaa9a7)[;
                ]
                       if(*stack *!= null && *stack*.stackSize > this.getInventoryStackLimit())
                       {
                           *stack*.stackSize = this.getInventoryStackLimit()%(#aaa9a7)[;
                ]        }
                       this.markDirty()%(#aaa9a7)[;
                ]    }
                
                   public boolean isItemValidForSlot(int *slot*, ItemStack *stack*)
                   {
                       return *slot *== 2 ? false : true%(#aaa9a7)[;
                ]    }
                
                   public boolean isBurning()
                   {
                       return this.workingTime > 0%(#aaa9a7)[;
                ]    }
                
                   protected boolean canSmelt()
                   {
                       if(this.slotResult[this.slotInputID] == null)
                       {
                           return false%(#aaa9a7)[;
                ]        }
                       %(#0187df)[else
                ]        {
                           ItemStack itemstack = OreExtractorRecipes.smelting().getSmeltingResult(new ItemStack[] { this.slotResult[this.slotInputID] })%(#aaa9a7)[;
                ]
                           for (int %(#666965)_= 3; %(#666965)_< 15; %(#666965)*++)
                           {
                               int result = slotResult[%(#666965)*].stackSize + itemstack.stackSize%(#aaa9a7)[;
                ]
                               if (this.slotResult[%(#666965)*] != null)
                               {
                                   if (this.slotResult[%(#666965)*].isItemEqual(itemstack))
                                   {
                                       if (result <= getInventoryStackLimit() && result <= this.slotResult[%(#666965)*].getMaxStackSize())
                                       {
                                           return true%(#aaa9a7)[;
                ]                        }
                                   }
                                   %(#0187df)[else
                ]                    {
                                       return false%(#aaa9a7)[;
                ]                    }
                               }
                               %(#0187df)[else
                ]                {
                                   return false%(#aaa9a7)[;
                ]                }
                           }
                           return false%(#aaa9a7)[;
                ]        }
                   }
                
                   public void smeltItem()
                   {
                       ItemStack itemstack = OreExtractorRecipes.smelting().getSmeltingResult(new ItemStack[] { this.slotResult[this.slotInputID] })%(#aaa9a7)[;
                ]
                       for (int %(#666965)_= 3; %(#666965)_< 15; %(#666965)*++)
                       {
                           if (this.canSmelt())
                           {
                               if (this.slotResult[%(#666965)*] != null)
                               {
                                   this.slotResult[%(#666965)*] = itemstack.copy()%(#aaa9a7)[;
                ]                    break%(#aaa9a7)[;
                ]                }
                
                               if (this.slotResult[%(#666965)*].getItem() == itemstack.getItem())
                               {
                                   this.slotResult[%(#666965)*].stackSize += itemstack.stackSize%(#aaa9a7)[;
                ]                    break%(#aaa9a7)[;
                ]                }
                               this.decrStackSize(0, 1)%(#aaa9a7)[;
                ]            }
                       }
                   }
                
                   public void updateEntity()
                   {
                       if(this.burnTime > 0)
                       {
                           burnTime%(#aaa9a7)[–;
                ]        }
                       if(this.canSmelt())
                       {
                           if(this.burnTime <= 0)
                           {
                               int %(#666965)________
                1 réponse Dernière réponse Répondre Citer 0
                • AymericRedA Hors-ligne
                  AymericRed
                  dernière édition par

                  Dans ta fonction canSmelt(), remplace le 1er return false par un break et dans smelt(), remplace les break par des return;, et remplace le != null par un == null.
                  Comme je vois que t’a pas totalement compris, les return … sortent de la fonction mais les break ne sortent que de la boucle (en gros si il te reste autre chose après le break à l’intérieur du for(), ça sera sauté mais par contre si t’a, pas exemple, i=1 et i<5, alors si tu appelle un break, le i=1 ne sera pas totalement exécuté mais le i=2, i=3, i=4 seront exécutés, contrairement au return…). J’espère que c’est assez clair ^^

                  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

                    Mon jeu crash au lancement

                    java.lang.NullPointerException: Ticking block entity
                    at com.google.SpyMan.Mechanicalcraft.common.blockOreExtractor.TileEntityOreExtractor.canSmelt(TileEntityOreExtractor.java:230)
                    at com.google.SpyMan.Mechanicalcraft.common.blockOreExtractor.TileEntityOreExtractor.updateEntity(TileEntityOreExtractor.java:285)
                    at net.minecraft.world.World.updateEntities(World.java:2160)
                    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515)
                    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703)
                    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
                    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
                    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
                    at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
                    
                    [font=Courier Newpublic class ]TileEntityOreExtractor extends TileEntity implements %(#345f99)[IInventory
                    ]{
                       private byte direction%(#aaa9a7)[;
                    ]    %(#8242ff)[/** Slots list */
                    ]    private ItemStack[] slotResult = new ItemStack[15]%(#aaa9a7)[;
                    ]    %(#8242ff)[/** Actual working time */
                    ]    protected int workingTime = 0%(#aaa9a7)[;
                    ]    %(#8242ff)[/** Working time for one recipes */
                    ]    protected int workingTimeNeeded = 200%(#aaa9a7)[;
                    ]    %(#8242ff)[/** Working time default value for one recipes */
                    ]    protected int workingTimeNeededDefault = 200%(#aaa9a7)[;
                    ]    %(#8242ff)[/** Actual burn time */
                    ]    protected int burnTime = 0%(#aaa9a7)[;
                    ]    %(#8242ff)[/** Burn time of fuel */
                    ]    protected int burnTimeTotal = 0%(#aaa9a7)[;
                    ]    %(#8242ff)[/** Id of the result slot */
                    ]    private int slotResultID = 3%(#aaa9a7)[;
                    ]    %(#8242ff)[/** Id of the upgrade slot */
                    ]    private int slotUpgradeID = 2%(#aaa9a7)[;
                    ]    %(#8242ff)[/** Id of the fuel slot */
                    ]    private int slotFuelID = 1%(#aaa9a7)[;
                    ]    %(#8242ff)[/** Id of the input slot */
                    ]    private int slotInputID = 0%(#aaa9a7)[;
                    ]
                       %(#278c3c)[***@Override
                    ***]    public void readFromNBT(NBTTagCompound *compound*)
                       {
                           super.readFromNBT(*compound*)%(#aaa9a7)[;
                    ]        this.direction = *compound*.getByte("Direction")%(#aaa9a7)[;
                    ]        NBTTagList nbttaglist = *compound*.getTagList("Items", 10)%(#aaa9a7)[;
                    ]        this.slotResult = new ItemStack[this.getSizeInventory()]%(#aaa9a7)[;
                    ]
                           for(int %(#666965)_= 0; %(#666965)_< nbttaglist.tagCount(); ++%(#666965)*)
                           {
                               NBTTagCompound nbtTagCompound = nbttaglist.getCompoundTagAt(%(#666965)*)%(#aaa9a7)[;
                    ]            int j = nbtTagCompound.getByte("Slot") & 255%(#aaa9a7)[;
                    ]
                               if(j >= 0 && j < this.slotResult.length)
                               {
                                   this.slotResult[j] = ItemStack.loadItemStackFromNBT(nbtTagCompound)%(#aaa9a7)[;
                    ]            }
                           }
                           this.workingTime = *compound*.getShort("workingTime")%(#aaa9a7)[;
                    ]        this.burnTime = *compound*.getShort("burnTime")%(#aaa9a7)[;
                    ]        this.burnTimeTotal = *compound*.getShort("burnTimeTotal")%(#aaa9a7)[;
                    ]    }
                    
                       %(#278c3c)[***@Override
                    ***]    public void writeToNBT(NBTTagCompound *compound*)
                       {
                           super.writeToNBT(*compound*)%(#aaa9a7)[;
                    ]        NBTTagList nbttaglist = new NBTTagList()%(#aaa9a7)[;
                    ]        *compound*.setByte("Direction", this.direction)%(#aaa9a7)[;
                    ]        for(int %(#666965)_= 0; %(#666965)_< this.slotResult.length; ++%(#666965)*)
                           {
                               if(this.slotResult[%(#666965)*] != null)
                               {
                                   NBTTagCompound nbtTagCompound = new NBTTagCompound()%(#aaa9a7)[;
                    ]                nbtTagCompound.setByte("Slot", (byte)%(#666965)*)%(#aaa9a7)[;
                    ]                this.slotResult[%(#666965)*].writeToNBT(nbtTagCompound)%(#aaa9a7)[;
                    ]                nbttaglist.appendTag(nbtTagCompound)%(#aaa9a7)[;
                    ]
                               }
                           }
                           *compound*.setTag("Items", nbttaglist)%(#aaa9a7)[;
                    ]        *compound*.setShort("workingTime", (short)this.workingTime)%(#aaa9a7)[;
                    ]        *compound*.setShort("burnTime", (short)this.burnTime)%(#aaa9a7)[;
                    ]        *compound*.setShort("burnTimeTotal", (short)this.burnTimeTotal)%(#aaa9a7)[;
                    ]    }
                    
                       public byte getDirection()
                       {
                           return direction%(#aaa9a7)[;
                    ]    }
                    
                       public void setDirection(byte *direction*)
                       {
                           this.direction = *direction*%(#aaa9a7)[;
                    ]        this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord)%(#aaa9a7)[;
                    ]    }
                    
                       public Packet getDescriptionPacket()
                       {
                           NBTTagCompound nbtTagCompound = new NBTTagCompound()%(#aaa9a7)[;
                    ]        this.writeToNBT(nbtTagCompound)%(#aaa9a7)[;
                    ]        return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbtTagCompound)%(#aaa9a7)[;
                    ]    }
                    
                       public void onDataPacket(NetworkManager *net*, S35PacketUpdateTileEntity *pkt*)
                       {
                           this.readFromNBT(*pkt*.func_148857_g())%(#aaa9a7)[;
                    ]    }
                    
                       public int getSizeInventory()
                       {
                           return this.slotResult.length%(#aaa9a7)[;
                    ]    }
                    
                       public void openInventory() {}
                    
                       public void closeInventory() {}
                    
                       public String getInventoryName()
                       {
                           return MechanicalCraft.oreExtractor.getLocalizedName()%(#aaa9a7)[;
                    ]    }
                    
                       public boolean hasCustomInventoryName()
                       {
                           return false%(#aaa9a7)[;
                    ]    }
                    
                       public int 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, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D%(#aaa9a7)[;
                    ]    }
                    
                       public ItemStack getStackInSlot(int *slotIndex*)
                       {
                           return this.slotResult[*slotIndex*]%(#aaa9a7)[;
                    ]    }
                    
                       public ItemStack decrStackSize(int *slotIndex*, int *amount*)
                       {
                           if(this.slotResult[*slotIndex*] != null)
                           {
                               ItemStack itemstack%(#aaa9a7)[;
                    ]
                               if(this.slotResult[*slotIndex*].stackSize <= *amount*)
                               {
                                   itemstack = this.slotResult[*slotIndex*]%(#aaa9a7)[;
                    ]                this.slotResult[*slotIndex*] = null%(#aaa9a7)[;
                    ]                this.markDirty()%(#aaa9a7)[;
                    ]                return itemstack%(#aaa9a7)[;
                    ]            }
                               %(#0187df)[else
                    ]            {
                                   itemstack = this.slotResult[*slotIndex*].splitStack(*amount*)%(#aaa9a7)[;
                    ]
                                   if(this.slotResult[*slotIndex*].stackSize == 0)
                                   {
                                       this.slotResult[*slotIndex*] = null%(#aaa9a7)[;
                    ]                }
                                   this.markDirty()%(#aaa9a7)[;
                    ]                return itemstack%(#aaa9a7)[;
                    ]            }
                           }
                           %(#0187df)[else
                    ]        {
                               return null%(#aaa9a7)[;
                    ]        }
                       }
                    
                       public ItemStack getStackInSlotOnClosing(int *slotIndex*)
                       {
                           if(this.slotResult[*slotIndex*] != null)
                           {
                               ItemStack itemstack = this.slotResult[*slotIndex*]%(#aaa9a7)[;
                    ]            this.slotResult[*slotIndex*] = null%(#aaa9a7)[;
                    ]            return itemstack%(#aaa9a7)[;
                    ]        }
                           %(#0187df)[else
                    ]        {
                               return null%(#aaa9a7)[;
                    ]        }
                       }
                    
                       public void setInventorySlotContents(int *slotIndex*, ItemStack *stack*)
                       {
                           this.slotResult[*slotIndex*] = *stack*%(#aaa9a7)[;
                    ]
                           if(*stack *!= null && *stack*.stackSize > this.getInventoryStackLimit())
                           {
                               *stack*.stackSize = this.getInventoryStackLimit()%(#aaa9a7)[;
                    ]        }
                           this.markDirty()%(#aaa9a7)[;
                    ]    }
                    
                       public boolean isItemValidForSlot(int *slot*, ItemStack *stack*)
                       {
                           return *slot *== 2 ? false : true%(#aaa9a7)[;
                    ]    }
                    
                       public boolean isBurning()
                       {
                           return this.workingTime > 0%(#aaa9a7)[;
                    ]    }
                    
                       protected boolean canSmelt()
                       {
                           if(this.slotResult[this.slotInputID] == null)
                           {
                               return false%(#aaa9a7)[;
                    ]        }
                           %(#0187df)[else
                    ]        {
                               ItemStack itemstack = OreExtractorRecipes.smelting().getSmeltingResult(new ItemStack[] { this.slotResult[this.slotInputID] })%(#aaa9a7)[;
                    ]
                               for (int %(#666965)_= 3; %(#666965)_< 15; %(#666965)*++)
                               {
                                   int result = slotResult[%(#666965)*].stackSize + itemstack.stackSize%(#aaa9a7)[;
                    ]
                                   if (this.slotResult[%(#666965)*] != null)
                                   {
                                       if (this.slotResult[%(#666965)*].isItemEqual(itemstack))
                                       {
                                           if (result <= getInventoryStackLimit() && result <= this.slotResult[%(#666965)*].getMaxStackSize())
                                           {
                                               break%(#aaa9a7)[;
                    ]                        }
                                       }
                                       %(#0187df)[else
                    ]                    {
                                           return false%(#aaa9a7)[;
                    ]                    }
                                   }
                                   %(#0187df)[else
                    ]                {
                                       return false%(#aaa9a7)[;
                    ]                }
                               }
                               return false%(#aaa9a7)[;
                    ]        }
                       }
                    
                       public void smeltItem()
                       {
                           ItemStack itemstack = OreExtractorRecipes.smelting().getSmeltingResult(new ItemStack[] { this.slotResult[this.slotInputID] })%(#aaa9a7)[;
                    ]
                           for (int %(#666965)_= 3; %(#666965)_< 15; %(#666965)*++)
                           {
                               if (this.canSmelt())
                               {
                                   if (this.slotResult[%(#666965)*] == null)
                                   {
                                       this.slotResult[%(#666965)*] = itemstack.copy()%(#aaa9a7)[;
                    ]                    return%(#aaa9a7)[;
                    ]                }
                    
                                   if (this.slotResult[%(#666965)*].getItem() == itemstack.getItem())
                                   {
                                       this.slotResult[%(#666965)*].stackSize += itemstack.stackSize%(#aaa9a7)[;
                    ]                    return%(#aaa9a7)[;
                    ]                }
                                   this.decrStackSize(0, 1)%(#aaa9a7)[;
                    ]            }
                           }
                       }
                    
                       public void updateEntity()
                       {
                           if(this.burnTime > 0)
                           {
                               burnTime%(#aaa9a7)[–;
                    ]        }
                           if(this.canSmelt())
                           {
                               if(this.burnTime <= 0)
                               {
                                   int %(#666965)________
                    1 réponse Dernière réponse Répondre Citer 0
                    • AymericRedA Hors-ligne
                      AymericRed
                      dernière édition par

                      Le int result (ds canSmelt), faut que tu le mettes après le null check

                      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

                        bon bah ce foutu block ma rendu fou. Rien ne fonctionne mais c’est pas grave, je vais le laisser de coté pour un trés trés long moment
                        Merci de votre aide quand bien même 🙂

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

                        MINECRAFT FORGE FRANCE © 2024

                        Powered by NodeBB