MFF

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

    Table de craft buguée

    Planifier Épinglé Verrouillé Déplacé Résolu 1.8.x
    1.8
    19 Messages 6 Publieurs 3.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.
    • EryahE Hors-ligne
      Eryah
      dernière édition par

      J’en ai pas besoin mais il ne gêne as, j’ai carrèment la flemme de l’enlever pour être franc 😛

      Membre fantôme
      Je développe maintenant un jeu sur UnrealEngine4


      Contact :…

      1 réponse Dernière réponse Répondre Citer 0
      • DiabolicaTrixD Hors-ligne
        DiabolicaTrix Correcteurs Moddeurs confirmés
        dernière édition par

        Haha, d’accord 😛

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

          Ah, je viens de me rendre compte que c’est pas ma classe … Fuck, désolé ^^’
          Voici ma classe

          package eryah.usefulthings.container;
          
          import net.minecraft.entity.player.EntityPlayer;
          import net.minecraft.inventory.IInventory;
          import net.minecraft.inventory.InventoryCrafting;
          import net.minecraft.inventory.Slot;
          import net.minecraft.item.ItemStack;
          import eryah.usefulthings.recipes.WeaponTableRecipes;
          
          public class SlotWeaponResult extends Slot
          {
          /** The craft matrix inventory linked to this result slot. */
          private final InventoryCrafting craftMatrix;
          /** The player that is using the GUI where this slot resides. */
          private final EntityPlayer thePlayer;
          /** The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset. */
          private int amountCrafted;
          
          public SlotWeaponResult(EntityPlayer player, InventoryCrafting craftingInventory, IInventory p_i45790_3_, int slotIndex, int xPosition, int yPosition)
          {
          super(p_i45790_3_, slotIndex, xPosition, yPosition);
          this.thePlayer = player;
          this.craftMatrix = craftingInventory;
          }
          
          /**
          * Check if the stack is a valid item for this slot. Always true beside for the armor slots.
          */
          public boolean isItemValid(ItemStack stack)
          {
          return false;
          }
          
          /**
          * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new
          * stack.
          */
          public ItemStack decrStackSize(int amount)
          {
          if (this.getHasStack())
          {
          this.amountCrafted += Math.min(amount, this.getStack().stackSize);
          }
          
          return super.decrStackSize(amount);
          }
          
          /**
          * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an
          * internal count then calls onCrafting(item).
          */
          protected void onCrafting(ItemStack stack, int amount)
          {
          this.amountCrafted += amount;
          this.onCrafting(stack);
          }
          
          /**
          * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
          */
          protected void onCrafting(ItemStack stack)
          {
          if (this.amountCrafted > 0)
          {
          stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
          }
          
          this.amountCrafted = 0;
          
          }
          
          public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack)
          {
          net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix);
          this.onCrafting(stack);
          net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn);
          ItemStack[] aitemstack = WeaponTableRecipes.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj);
          net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null);
          
          for (int i = 0; i < aitemstack.length; ++i)
          {
          ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i);
          ItemStack itemstack2 = aitemstack*;
          
          if (itemstack1 != null)
          {
          this.craftMatrix.decrStackSize(i, 1);
          }
          
          if (itemstack2 != null)
          {
          if (this.craftMatrix.getStackInSlot(i) == null)
          {
          this.craftMatrix.setInventorySlotContents(i, itemstack2);
          }
          else if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2))
          {
          this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false);
          }
          }
          }
          }
          }
          

          Membre fantôme
          Je développe maintenant un jeu sur UnrealEngine4


          Contact :…

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

            protected void onCrafting(ItemStack stack, int amount) {
               this.amountCrafted += amount;
               this.onCrafting(stack);
            }
            

            Tu augmentes le nombre d’items dans la case résultat sans vider la matrice de craft?

            **EDIT : **Je suis con, amountCrafted c’est même pas le nombre d’items en résultat… si?
            EDIT 2 :…Eryah il est con aussi, il nous donne la classe corrigée, comment il veut qu’on trouve l’erreur facepalm

            Mes mods :

            • Cookie Ore (1.7.10)

            Mod en cours : **E…

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

              Ca pourrait être ça, mais non

              Membre fantôme
              Je développe maintenant un jeu sur UnrealEngine4


              Contact :…

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

                J’ai mis la classe corrigée –’

                package eryah.usefulthings.container;
                
                import net.minecraft.entity.player.EntityPlayer;
                import net.minecraft.inventory.IInventory;
                import net.minecraft.inventory.InventoryCrafting;
                import net.minecraft.inventory.Slot;
                import net.minecraft.item.ItemStack;
                import eryah.usefulthings.recipes.WeaponTableRecipes;
                
                public class SlotWeaponResult extends Slot
                {
                   /** The craft matrix inventory linked to this result slot. */
                   private final InventoryCrafting craftMatrix;
                   /** The player that is using the GUI where this slot resides. */
                   private final EntityPlayer thePlayer;
                   /** The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset. */
                   private int amountCrafted;
                
                   public SlotWeaponResult(EntityPlayer player, InventoryCrafting craftingInventory, IInventory p_i45790_3_, int slotIndex, int xPosition, int yPosition)
                   {
                       super(p_i45790_3_, slotIndex, xPosition, yPosition);
                       this.thePlayer = player;
                       this.craftMatrix = craftingInventory;
                   }
                
                   /**
                    * Check if the stack is a valid item for this slot. Always true beside for the armor slots.
                    */
                   public boolean isItemValid(ItemStack stack)
                   {
                       return false;
                   }
                
                   /**
                    * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new
                    * stack.
                    */
                   public ItemStack decrStackSize(int amount)
                   {
                       if (this.getHasStack())
                       {
                           this.amountCrafted += Math.min(amount, this.getStack().stackSize);
                       }
                
                       return super.decrStackSize(amount);
                   }
                
                   /**
                    * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an
                    * internal count then calls onCrafting(item).
                    */
                   protected void onCrafting(ItemStack stack, int amount)
                   {
                       this.amountCrafted += amount;
                       this.onCrafting(stack);
                   }
                
                   /**
                    * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
                    */
                   protected void onCrafting(ItemStack stack)
                   {
                       if (this.amountCrafted > 0)
                       {
                           stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
                       }
                
                       this.amountCrafted = 0;
                
                   }
                
                   public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack)
                   {
                       net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix);
                       this.onCrafting(stack);
                       net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn);
                       ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj);
                       net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null);
                
                       for (int i = 0; i < aitemstack.length; ++i)
                       {
                           ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i);
                           ItemStack itemstack2 = aitemstack*;
                
                           if (itemstack1 != null)
                           {
                               this.craftMatrix.decrStackSize(i, 1);
                           }
                
                           if (itemstack2 != null)
                           {
                               if (this.craftMatrix.getStackInSlot(i) == null)
                               {
                                   this.craftMatrix.setInventorySlotContents(i, itemstack2);
                               }
                               else if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2))
                               {
                                   this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false);
                               }
                           }
                       }
                   }
                }
                

                Membre fantôme
                Je développe maintenant un jeu sur UnrealEngine4


                Contact :…

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

                  Code erroné :

                  ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj);
                  

                  Code corrigé :

                  ItemStack[] aitemstack = WeaponTableRecipes.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj);
                  

                  :::
                  Trouvé avec ceci x)
                  :::

                  Mes mods :

                  • Cookie Ore (1.7.10)

                  Mod en cours : **E…

                  1 réponse Dernière réponse Répondre Citer 0
                  • DiabolicaTrixD Hors-ligne
                    DiabolicaTrix Correcteurs Moddeurs confirmés
                    dernière édition par

                    Je l’ai dit avant 😛

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

                      Mais pas sur ce topic 😛

                      Mes mods :

                      • Cookie Ore (1.7.10)

                      Mod en cours : **E…

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

                        Arghhh je venais de voir le même truc x( mais Sasukz, tu fus plus rapide…

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

                          Vous avez gagnés un cookie 🙂
                          GG a vous deux

                          Membre fantôme
                          Je développe maintenant un jeu sur UnrealEngine4


                          Contact :…

                          1 réponse Dernière réponse Répondre Citer 0
                          • DiabolicaTrixD Hors-ligne
                            DiabolicaTrix Correcteurs Moddeurs confirmés
                            dernière édition par

                            C’était easy avec Winmerge 😛

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

                            MINECRAFT FORGE FRANCE © 2024

                            Powered by NodeBB