MFF

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

    Probléme machine

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    105 Messages 12 Publieurs 15.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.
    • ? Hors-ligne
      Un Ancien Utilisateur
      dernière édition par

      j’ai 1 input 9 résultats de crafts mais mes crafts ne fonctionne pas j’ai déjà vue se problème mosca l’avait eu il avait créer un sujet mais il avait donner un code de TileEntity qui ne fonctionne pas pour moi car j’ai pas le même nombres d’oput en d’input

      voici ma Class TileEntityMachineCraft ( le nom que je lui est donner ) ;

      
      package com.adamitemod.mod;
      
      import cpw.mods.fml.relauncher.Side;
      import cpw.mods.fml.relauncher.SideOnly;
      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;
      
      public class TileEntityMachineCraft extends TileEntity implements IInventory {
      
      private ItemStack[] contents = new ItemStack[4]; //0, 1 et 2 sont les inputs et 3 est l'output
      private int workingTime = 0; //Temps de cuisson actuel
      private int workingTimeNeeded = 60; //Temps de cuisson nécessaire
      
      @SideOnly(Side.CLIENT)
      public int getCookProgress()
      {
      return this.workingTime * 17 / this.workingTimeNeeded; //41 correspond à la hauteur de la barre de progression car notre barre de progression se déroule de haut en bas
      }
      
      @Override 
          public void writeToNBT(NBTTagCompound compound)
          {
              super.writeToNBT(compound);
              NBTTagList nbttaglist = new NBTTagList();
      
              for (int i = 0; i < this.contents.length; ++i) //pour les slots
              {
                  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); //On les enregistrent en short
              compound.setShort("workingTimeNeeded", (short)this.workingTimeNeeded);
          }
      
      @Override
          public void readFromNBT(NBTTagCompound compound)
          {
              super.readFromNBT(compound);
      
              NBTTagList nbttaglist = compound.getTagList("Items", 10);
              this.contents = new ItemStack[this.getSizeInventory()];
      
              for (int i = 0; i < nbttaglist.tagCount(); ++i) //Encore une fois pour les slots
              {
                  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"); //On lit nos valeurs
              this.workingTimeNeeded = compound.getShort("workingTimeNeeded");
          }
      
      @Override
      public int getSizeInventory() { //Tout est dans le nom, retourne la taille de l'inventaire, pour notre bloc c'est quatre
      return this.contents.length;
      }
      
      @Override
      public ItemStack getStackInSlot(int slotIndex) { //Renvoie L'itemStack se trouvant dans le slot passé en argument
      return this.contents[slotIndex];
      }
      
      @Override
      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;
             }
      }
      
      @Override
      public ItemStack getStackInSlotOnClosing(int slotIndex) {
      if (this.contents[slotIndex] != null)
              {
                  ItemStack itemstack = this.contents[slotIndex];
                  this.contents[slotIndex] = null;
                  return itemstack;
              }
              else
              {
                  return null;
              }
      }
      
      @Override
      public void setInventorySlotContents(int slotIndex, ItemStack stack) {
      this.contents[slotIndex] = stack;
      
              if (stack != null && stack.stackSize > this.getInventoryStackLimit())
              {
                  stack.stackSize = this.getInventoryStackLimit();
              }
      
              this.markDirty();
      }
      
      @Override
      public String getInventoryName() { 
      return "tile.machineTuto";
      }
      
      @Override
      public boolean hasCustomInventoryName() {
      return false;
      }
      
      @Override
      public int getInventoryStackLimit() {
      return 64;
      }
      
      @Override
      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;
      }
      
      @Override
      public void openInventory() {
      
      }
      
      @Override
      public void closeInventory() {
      
      }
      
      @Override
      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 || this.contents[2] == null) //Si les trois premiers slots sont vides
              {
                  return false; //On ne peut pas lancer le processus
              }
              else
              {
                  ItemStack itemstack = MachineRecipesCraft.smelting().getSmeltingResult(new ItemStack[]{this.contents[0], this.contents[1], this.contents[2]}); //Il y a une erreur ici, c'est normal, on y vient après (c'est pour les recettes)
                  if (itemstack == null) return false; //rapport avec les recettes
                  if (this.contents[3] == null) return true; //vérifications du slot d'output
                  if (!this.contents[3].isItemEqual(itemstack)) return false; //ici aussi
                  int result = contents[3].stackSize + itemstack.stackSize;
                  return result <= getInventoryStackLimit() && result <= this.contents[3].getMaxStackSize(); //Et là aussi décidément
              }
          }
      
      public void updateEntity() //Méthode exécutée à chaque tick
          {
          if(this.isBurning() && this.canSmelt()) //Si on "cuit" et que notre recette et toujours bonne, on continue
          {
          ++this.workingTime; //incrémentation
          }
          if(this.canSmelt() && !this.isBurning()) //Si la recette est bonne mais qu'elle n'est toujours pas lancée, on la lance
          {
          this.workingTime = 1; //La méthode isBurning() renverra true maintenant (1>0)
          }
          if(this.canSmelt() && this.workingTime == this.workingTimeNeeded) //Si on est arrivé au bout du temps de cuisson et que la recette est toujours bonne
          {
          this.smeltItem(); //on "cuit" les items
          this.workingTime = 0; //et on réinitialise le temps de cuisson
          }
              if(!this.canSmelt()) //Si la recette la recette n'est plus bonne
              {
                     this.workingTime= 0; //le temps de cuisson est de 0
              }
          }
      
      public void smeltItem()
          {
              if (this.canSmelt())
              {
                  ItemStack itemstack = MachineRecipesCraft.smelting().getSmeltingResult(new ItemStack[]{this.contents[0], this.contents[1], this.contents[2]}); //On récupère l'output de la recette
                   if (this.contents[3] == null) //Si il y a rien dans le slot d'output
                   {
                        this.contents[3] = itemstack.copy(); //On met directement l'ItemStack
                   }
                   else if (this.contents[3].getItem() == itemstack.getItem()) //Et si l'item que l'on veut est le même que celui qu'il y a déjà
                   {
                        this.contents[3].stackSize += itemstack.stackSize; // Alors ont incrémente l'ItemStack
                   }
      
                   –this.contents[0].stackSize; //On décrémente les slots d'input
                   –this.contents[1].stackSize;
                   –this.contents[2].stackSize;
      
                   if (this.contents[0].stackSize <= 0) //Si les slots sont vides, on remet à null le slot
                   {
                       this.contents[0] = null;
                   }
                   if (this.contents[1].stackSize <= 0)
                   {
                       this.contents[1] = null;
                   }
                   if (this.contents[2].stackSize <= 0)
                   {
                       this.contents[2] = null;
                   }
              }
          }
      }
      
      
      1 réponse Dernière réponse Répondre Citer 0
      • ? Hors-ligne
        Un Ancien Utilisateur
        dernière édition par

        comme je veux créer un uncrafting table il y a que 1 input donc j’ai sa :

        this.addRecipe(BlocksMod.adamiteBlock, BlocksMod.FissionBlock, BlocksMod.adamiteBlock, new ItemStack(ItemsMod.Adasceptre));
        

        je veux le remplacer par ca :

        this.addRecipe(BlocksMod.adamiteBlock, new ItemStack(ItemsMod.Adasceptre));
        

        mais sa ne marche pas voici mes Class de la machine : http://download950.mediafire.com/m1levwdmjiag/3mmftjgju5i3u15/src+adamite+machine+2.rar___Up sa fait 13h

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

          1- 13h ne suffisent pas entre 2 messages, de plus ton message a été envoyé à un moment où beaucoup de personnes dorment (entre minuit et 13h moi je dors !)
          2- J’ai été gentil et j’ai modifié 2 classes, tu aurais pu tout à fait le faire toi-même si tu avais suivis un minimum le tutoriel
          3- Il y aura très certainement des erreurs lorsque tu vas faire un bête copier-coller de ce que je t’ai donné, c’est normal, je ne vais pas faire tout le travail à ta place alors que tu n’as même pas pris la peine d’enlever les commentaires

          Voici les classes modifiées :

          package com.adamitemod.mod;
          
          import java.util.HashMap;
          import java.util.Iterator;
          import java.util.Map;
          import java.util.Map.Entry;
          
          import com.adamitemod.mod.init.BlocksMod;
          import com.adamitemod.mod.init.ItemsMod;
          
          import net.minecraft.block.Block;
          import net.minecraft.init.Blocks;
          import net.minecraft.init.Items;
          import net.minecraft.item.Item;
          import net.minecraft.item.ItemStack;
          
          public class MachineRecipesCraft {
          
          private static final MachineRecipesCraft smeltingBase = new MachineRecipesCraft();
          private HashMap <itemstack, itemstack="">smeltingList = new HashMap(); // #SCAREX : c'est mieux d'indiquer ce que l'on met dans la HashMap
          
          public MachineRecipesCraft()
          {
          
          this.addRecipe(BlocksMod.adamiteBlock, new ItemStack(ItemsMod.Adasceptre)); // #SCAREX : tu changes ta recette
          }
          
          public void addRecipe(ItemStack input, ItemStack output)
          {
          this.smeltingList.put(input, output);
          }
          
          public void addRecipe(Item input, ItemStack output)
          {
          this.addRecipe(new ItemStack(input), output);
          }
          
          public void addRecipe(Block input, ItemStack output)
          {
          this.addRecipe(Item.getItemFromBlock(block1), item2, item3, stack);
          }
          
          public ItemStack getSmeltingResult(ItemStack stack)
          {
          Iterator iterator = this.smeltingList.entrySet().iterator();
          Entry entry;
          
          do
          {
          if (!iterator.hasNext())
          {
          return null;
          }
          entry = (Entry)iterator.next();
          }
          while (!this.isSameKey(stack, (ItemStack)entry.getKey()));
          
          return (ItemStack)entry.getValue();
          }
          
          private boolean isSameKey(ItemStack machinesStack, ItemStack key) // #SCAREX : vu que tu n'as qu'un seul item, ça ne sert à rien de faire une boucle
          {
          return machinesStack.getItem() == key.getItem();
          }
          
          public HashMap <itemstack, itemstack="">getSmeltingList()
          {
          return this.smeltingList;
          }
          
          public static MachineRecipesCraft smelting()
          {
          return smeltingBase;
          }
          }
          
          package com.adamitemod.mod;
          
          import cpw.mods.fml.relauncher.Side;
          import cpw.mods.fml.relauncher.SideOnly;
          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;
          
          public class TileEntityMachineCraft extends TileEntity implements IInventory {
          
          private ItemStack[] contents = new ItemStack[2]; // #SCAREX : tu n'as que 2 slots
          private int workingTime = 0;
          private int workingTimeNeeded = 60;
          
          @SideOnly(Side.CLIENT)
          public int getCookProgress()
          {
          return this.workingTime * 17 / this.workingTimeNeeded;
          }
          
          @Override
          public void writeToNBT(NBTTagCompound compound)
          {
          super.writeToNBT(compound);
          NBTTagList nbttaglist = new NBTTagList();
          
          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);
          
          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");
          }
          
          @Override
          public int getSizeInventory() {
          return this.contents.length;
          }
          
          @Override
          public ItemStack getStackInSlot(int slotIndex) {
          return this.contents[slotIndex];
          }
          
          @Override
          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;
          }
          }
          
          @Override
          public ItemStack getStackInSlotOnClosing(int slotIndex) {
          if (this.contents[slotIndex] != null)
          {
          ItemStack itemstack = this.contents[slotIndex];
          this.contents[slotIndex] = null;
          return itemstack;
          }
          else
          {
          return null;
          }
          }
          
          @Override
          public void setInventorySlotContents(int slotIndex, ItemStack stack) {
          this.contents[slotIndex] = stack;
          
          if (stack != null && stack.stackSize > this.getInventoryStackLimit())
          {
          stack.stackSize = this.getInventoryStackLimit();
          }
          
          this.markDirty();
          }
          
          @Override
          public String getInventoryName() {
          return "tile.machineTuto";
          }
          
          @Override
          public boolean hasCustomInventoryName() {
          return false;
          }
          
          @Override
          public int getInventoryStackLimit() {
          return 64;
          }
          
          @Override
          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;
          }
          
          @Override
          public void openInventory() {
          
          }
          
          @Override
          public void closeInventory() {
          
          }
          
          @Override
          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) // #SCAREX : tu n'as qu'un seul slot ici
          {
          return false;
          }
          else
          {
          ItemStack itemstack = MachineRecipesCraft.smelting().getSmeltingResult(this.contents[0]); // #SCAREX : un seul slot
          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()
          {
          if(this.isBurning() && this.canSmelt())
          {
          ++this.workingTime;
          }
          if(this.canSmelt() && !this.isBurning())
          {
          this.workingTime = 1;
          }
          if(this.canSmelt() && this.workingTime == this.workingTimeNeeded)
          {
          this.smeltItem();
          this.workingTime = 0;
          }
          if(!this.canSmelt())
          {
          this.workingTime= 0;
          }
          }
          
          public void smeltItem()
          {
          if (this.canSmelt())
          {
          ItemStack itemstack = MachineRecipesCraft.smelting().getSmeltingResult(this.contents[0]); // #SCAREX : tu n'as qu'un seul input
          if (this.contents[1] == null) // #SCAREX : ton slot d'output devient 1
          {
          this.contents[1] = itemstack.copy();
          }
          else if (this.contents[1].getItem() == itemstack.getItem())
          {
          this.contents[1].stackSize += itemstack.stackSize;
          }
          
          –this.contents[0].stackSize;
          
          if (this.contents[0].stackSize <= 0)
          {
          this.contents[0] = null;
          }
          }
          }
          }
          ```</itemstack,></itemstack,>

          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
          • ? Hors-ligne
            Un Ancien Utilisateur
            dernière édition par

            public void addRecipe(Block input, ItemStack output)
            {
            this.addRecipe(Item.getItemFromBlock(block1), item2, item3, stack);
            }
            
            

            probléme ici : (block1), item2, item3, stack)

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

              Retire item2, item3
              Encore une fois tu aurais pu le trouver tout seul

              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
              • ? Hors-ligne
                Un Ancien Utilisateur
                dernière édition par

                Sauf que je l’ai déja fait et sa demande de créer des variable a stack et a block

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

                  On va suivre les étapes une par une :
                  1- Regarde les différences entre le code que j’ai fait et l’ancien code
                  2- Trouver pourquoi j’ai fait ça
                  3- Voir que c’est parce que tu n’as qu’un seul input
                  4- Changer les 2 variables en fonction des paramètres de la fonction

                  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
                  • ? Hors-ligne
                    Un Ancien Utilisateur
                    dernière édition par

                    j’ai pas mon ancien code

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

                      Je vais pas mettre 40 000 messages ! Passe à l’étape 4 !!

                      PS : si le prochain message n’est toujours pas constructif moi j’arrête de t’aider

                      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 1
                      • Superloup10S Hors-ligne
                        Superloup10 Modérateurs
                        dernière édition par

                        Une nouvelle fois, je vois, amigo que tu ne comprends toujours rien à ce que l’on te dit. Pour RÉSOUDRE ça, tu suis ce tutoriel

                        Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                        Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

                        1 réponse Dernière réponse Répondre Citer 0
                        • ? Hors-ligne
                          Un Ancien Utilisateur
                          dernière édition par

                          OKKKKK ses bon ! Sauf qu je l’ai déja fait met sa sert a rien sa pale pas minecraft

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

                            Salut
                            1 conseil : évites de commencer par des éléments trop complexes à réaliser, quand tu ne connais pas le (ou très peu) Java. Sinon en + d’abandonner dans 1 semaine, tu fais perdre du temps au autres.
                            Je veux t’aider, mais je t’avoue que là j’ai perdu le fil depuis le début. Réexplique ton problème avec une phrase qui contient un sujet, un verbe et un complément et si possible qui dépasse les 5 mots 😮

                            1 réponse Dernière réponse Répondre Citer 0
                            • ? Hors-ligne
                              Un Ancien Utilisateur
                              dernière édition par

                              Ok bon je vais te dire le probléme que j’ai actuellement je veux créer un uncraftingTable Donc j’ai mis 9oput et 1 input mais j’ai une erreur ici

                              package com.adamitemod.mod;
                              
                              import java.util.HashMap;
                              import java.util.Iterator;
                              import java.util.Map;
                              import java.util.Map.Entry;
                              
                              import com.adamitemod.mod.init.BlocksMod;
                              import com.adamitemod.mod.init.ItemsMod;
                              
                              import net.minecraft.block.Block;
                              import net.minecraft.init.Blocks;
                              import net.minecraft.init.Items;
                              import net.minecraft.item.Item;
                              import net.minecraft.item.ItemStack;
                              
                              public class MachineRecipesCraft {
                              
                              private static final MachineRecipesCraft smeltingBase = new MachineRecipesCraft();
                              private HashMap <itemstack, itemstack="">smeltingList = new HashMap(); // #SCAREX : c'est mieux d'indiquer ce que l'on met dans la HashMap
                              
                              public MachineRecipesCraft()
                              {
                              
                              this.addRecipe(BlocksMod.adamiteOre, new ItemStack(ItemsMod.Adasceptre)); // #SCAREX : tu changes ta recette
                              }
                              
                              public void addRecipe(ItemStack input, ItemStack output)
                              {
                              this.smeltingList.put(input, output);
                              }
                              
                                      public void addRecipe(Item input, ItemStack output)
                              {
                              this.addRecipe(new ItemStack(input), output);
                              }
                              
                              public void addRecipe(Block input, ItemStack output)
                              {
                              this.addRecipe(Item.getItemFromBlock(block1), stack);
                              }
                              
                              public ItemStack getSmeltingResult(ItemStack stack)
                              {
                                  Iterator iterator = this.smeltingList.entrySet().iterator();
                                  Entry entry;
                              
                                  do
                                  {
                                      if (!iterator.hasNext())
                                      {
                                          return null;
                                      }
                                         entry = (Entry)iterator.next();
                                     }
                                     while (!this.isSameKey(stack, (ItemStack)entry.getKey()));
                              
                                     return (ItemStack)entry.getValue();
                               }
                              
                              private boolean isSameKey(ItemStack machinesStack, ItemStack key) // #SCAREX : vu que tu n'as qu'un seul item, ça ne sert à rien de faire une boucle
                              {
                              return machinesStack.getItem() == key.getItem();
                              }
                              
                              public HashMap <itemstack, itemstack="">getSmeltingList()
                              {
                                     return this.smeltingList;
                                  }
                              
                              public static MachineRecipesCraft smelting()
                              {
                              return smeltingBase;
                              }
                              }
                              

                              à la ligne 40 ( this.addRecipe(Item.getItemFromBlock(block1), stack); )
                              à block1 et stack il me demande de créer des variables</itemstack,></itemstack,>

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

                                Change block1 –-> input et stack —> output

                                1 réponse Dernière réponse Répondre Citer 0
                                • ? Hors-ligne
                                  Un Ancien Utilisateur
                                  dernière édition par

                                  Merci je laisse ce sujet ouvert car j’aurais d’autre problémes je pense

                                  1 réponse Dernière réponse Répondre Citer 0
                                  • ? Hors-ligne
                                    Un Ancien Utilisateur
                                    dernière édition par

                                    Dez double post mais sa me ferme le launcheur quand j’ouvre le GUI voici mon crash report

                                    –-- Minecraft Crash Report ----
                                    // Don't be sad. I'll do better next time, I promise!
                                    
                                    Time: 08/05/16 20:20
                                    Description: Rendering screen
                                    
                                    java.lang.ArrayIndexOutOfBoundsException: 2
                                    at com.adamitemod.mod.TileEntityMachineCraft.getStackInSlot(TileEntityMachineCraft.java:76)
                                    at net.minecraft.inventory.Slot.getStack(Slot.java:88)
                                    at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:219)
                                    at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:114)
                                    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137)
                                    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067)
                                    at net.minecraft.client.Minecraft.run(Minecraft.java:962)
                                    at net.minecraft.client.main.Main.main(Main.java:164)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                                    at java.lang.reflect.Method.invoke(Unknown Source)
                                    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
                                    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                                    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
                                    at GradleStart.main(Unknown Source)
                                    
                                    A detailed walkthrough of the error, its code path and all known details is as follows:
                                    ---------------------------------------------------------------------------------------
                                    
                                    -- Head --
                                    Stacktrace:
                                    at com.adamitemod.mod.TileEntityMachineCraft.getStackInSlot(TileEntityMachineCraft.java:76)
                                    at net.minecraft.inventory.Slot.getStack(Slot.java:88)
                                    at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:219)
                                    at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:114)
                                    
                                    -- Screen render details --
                                    Details:
                                    Screen name: com.adamitemod.mod.GuiMachineCraft
                                    Mouse location: Scaled: (213, 119). Absolute: (427, 240)
                                    Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2
                                    
                                    -- Affected level --
                                    Details:
                                    Level name: MpServer
                                    All players: 1 total; [EntityClientPlayerMP['Player971'/281, l='MpServer', x=-133,57, y=90,62, z=315,22]]
                                    Chunk stats: MultiplayerChunkCache: 49, 49
                                    Level seed: 0
                                    Level generator: ID 00 - default, ver 1\. Features enabled: false
                                    Level generator options: 
                                    Level spawn location: World: (-188,64,256), Chunk: (at 4,4,0 in -12,16; contains blocks -192,0,256 to -177,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
                                    Level time: 330319 game time, 193663 day time
                                    Level dimension: 0
                                    Level storage version: 0x00000 - Unknown?
                                    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
                                    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
                                    Forced entities: 7 total; [EntityPig['Pig'/160, l='MpServer', x=-91,50, y=69,00, z=298,84], EntityPig['Pig'/134, l='MpServer', x=-104,50, y=71,00, z=319,69], EntityPig['Pig'/135, l='MpServer', x=-103,81, y=74,00, z=331,13], EntityItem['item.item.rottenFlesh'/121, l='MpServer', x=-130,66, y=70,13, z=325,06], EntityClientPlayerMP['Player971'/281, l='MpServer', x=-133,57, y=90,62, z=315,22], EntityChicken['Chicken'/174, l='MpServer', x=-86,61, y=79,47, z=364,72], EntityPig['Pig'/127, l='MpServer', x=-116,69, y=72,00, z=339,50]]
                                    Retry entities: 0 total; []
                                    Server brand: fml,forge
                                    Server type: Integrated singleplayer server
                                    Stacktrace:
                                    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
                                    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2566)
                                    at net.minecraft.client.Minecraft.run(Minecraft.java:984)
                                    at net.minecraft.client.main.Main.main(Main.java:164)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                                    at java.lang.reflect.Method.invoke(Unknown Source)
                                    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
                                    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                                    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
                                    at GradleStart.main(Unknown Source)
                                    
                                    – System Details --
                                    Details:
                                    Minecraft Version: 1.7.10
                                    Operating System: Windows 10 (x86) version 10.0
                                    Java Version: 1.8.0_66, Oracle Corporation
                                    Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
                                    Memory: 752220696 bytes (717 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB)
                                    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
                                    AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                                    IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
                                    FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 4 mods loaded, 4 mods active
                                    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
                                    UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
                                    UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
                                    UCHIJAAAA Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
                                    UCHIJAAAA adamitemod{1.0.0} [Adamite Mod] (bin) 
                                    GL info: ' Vendor: 'Intel' Version: '4.0.0 - Build 10.18.10.4276' Renderer: 'Intel(R) HD Graphics'
                                    Launched Version: 1.7.10
                                    LWJGL: 2.9.1
                                    OpenGL: Intel(R) HD Graphics GL version 4.0.0 - Build 10.18.10.4276, Intel
                                    GL Caps: Using GL 1.3 multitexturing.
                                    Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
                                    Anisotropic filtering is supported and maximum anisotropy is 16.
                                    Shaders are available because OpenGL 2.1 is supported.
                                    
                                    Is Modded: Definitely; Client brand changed to 'fml,forge'
                                    Type: Client (map_client.txt)
                                    Resource Packs: []
                                    Current Language: English (US)
                                    Profiler Position: N/A (disabled)
                                    Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                                    Anisotropic Filtering: Off (1)
                                    
                                    1 réponse Dernière réponse Répondre Citer 0
                                    • DeletedD Hors-ligne
                                      Deleted
                                      dernière édition par

                                      T’as quoi à cette ligne : at com.adamitemod.mod.TileEntityMachineCraft.getStackInSlot(TileEntityMachineCraft.java:76)
                                      Au pire file ta classe TileEntityMachineCraft, stp 😃

                                      1 réponse Dernière réponse Répondre Citer 0
                                      • ? Hors-ligne
                                        Un Ancien Utilisateur
                                        dernière édition par

                                        et la une Class surgit

                                        package com.adamitemod.mod;
                                        
                                        import cpw.mods.fml.relauncher.Side;
                                        import cpw.mods.fml.relauncher.SideOnly;
                                        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;
                                        
                                        public class TileEntityMachineCraft extends TileEntity implements IInventory {
                                        
                                        private ItemStack[] contents = new ItemStack[2]; // #SCAREX : tu n'as que 2 slots
                                        private int workingTime = 0;
                                        private int workingTimeNeeded = 60;
                                        
                                        @SideOnly(Side.CLIENT)
                                        public int getCookProgress()
                                        {
                                        return this.workingTime * 17 / this.workingTimeNeeded;
                                        }
                                        
                                        @Override 
                                            public void writeToNBT(NBTTagCompound compound)
                                            {
                                                super.writeToNBT(compound);
                                                NBTTagList nbttaglist = new NBTTagList();
                                        
                                                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);
                                        
                                                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");
                                            }
                                        
                                        @Override
                                        public int getSizeInventory() {
                                        return this.contents.length;
                                        }
                                        
                                        @Override
                                        public ItemStack getStackInSlot(int slotIndex) {
                                        return this.contents[slotIndex];
                                        }
                                        
                                        @Override
                                        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;
                                               }
                                        }
                                        
                                        @Override
                                        public ItemStack getStackInSlotOnClosing(int slotIndex) {
                                        if (this.contents[slotIndex] != null)
                                                {
                                                    ItemStack itemstack = this.contents[slotIndex];
                                                    this.contents[slotIndex] = null;
                                                    return itemstack;
                                                }
                                                else
                                                {
                                                    return null;
                                                }
                                        }
                                        
                                        @Override
                                        public void setInventorySlotContents(int slotIndex, ItemStack stack) {
                                        this.contents[slotIndex] = stack;
                                        
                                                if (stack != null && stack.stackSize > this.getInventoryStackLimit())
                                                {
                                                    stack.stackSize = this.getInventoryStackLimit();
                                                }
                                        
                                                this.markDirty();
                                        }
                                        
                                        @Override
                                        public String getInventoryName() {
                                        return "tile.machineTuto";
                                        }
                                        
                                        @Override
                                        public boolean hasCustomInventoryName() {
                                        return false;
                                        }
                                        
                                        @Override
                                        public int getInventoryStackLimit() {
                                        return 64;
                                        }
                                        
                                        @Override
                                        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;
                                        }
                                        
                                        @Override
                                        public void openInventory() {
                                        
                                        }
                                        
                                        @Override
                                        public void closeInventory() {
                                        
                                        }
                                        
                                        @Override
                                        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) // #SCAREX : tu n'as qu'un seul slot ici
                                                {
                                                    return false;
                                                }
                                                else
                                                {
                                                    ItemStack itemstack = MachineRecipesCraft.smelting().getSmeltingResult(this.contents[0]); // #SCAREX : un seul slot
                                                    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()
                                            {
                                            if(this.isBurning() && this.canSmelt())
                                            {
                                            ++this.workingTime;
                                            }
                                            if(this.canSmelt() && !this.isBurning())
                                            {
                                            this.workingTime = 1;
                                            }
                                            if(this.canSmelt() && this.workingTime == this.workingTimeNeeded)
                                            {
                                            this.smeltItem();
                                            this.workingTime = 0;
                                            }
                                                if(!this.canSmelt())
                                                {
                                                       this.workingTime= 0;
                                                }
                                            }
                                        
                                        public void smeltItem()
                                            {
                                                if (this.canSmelt())
                                                {
                                                ItemStack itemstack = MachineRecipesCraft.smelting().getSmeltingResult(this.contents[0]); // #SCAREX : tu n'as qu'un seul input
                                                     if (this.contents[1] == null) // #SCAREX : ton slot d'output devient 1
                                                     {
                                                          this.contents[1] = itemstack.copy();
                                                     }
                                                     else if (this.contents[1].getItem() == itemstack.getItem())
                                                     {
                                                          this.contents[1].stackSize += itemstack.stackSize;
                                                     }
                                        
                                                     –this.contents[0].stackSize;
                                        
                                                     if (this.contents[0].stackSize <= 0)
                                                     {
                                                         this.contents[0] = null;
                                                     }
                                                }
                                            }
                                        }
                                        

                                        Voilla 😛

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

                                          Pour éviter les doubles posts : tu peux éditer le message.

                                          Du coup si tu veux faire un UncraftingTable, tu as besoin de 1 input, 9 outputs et pas besoin de classe pour les recettes car il y a déjà celle de minecraft.

                                          PS : fait gaffe il y a plusieurs moyens de crafter quelque chose

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

                                            Ligne 13, tu mets 2 slots alors que tu as besoin de 10 slots.

                                            Moddeur 1.8

                                            Développeur Java

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

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB