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

    Résolu Trouver le résultat d'un craft à partir d'une list d'items.

    1.8.x
    1.8.9
    3
    5
    1150
    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.
    • LeBossMax2
      LeBossMax2 dernière édition par

      Bonjour !

      Je suis en trains de créer un block permettant de faire automatiquement des crafts ( sur le système de craft de la table de craft ) et quand je pose mon block ou que je rentre dans un monde qui possède déjà ce block, Minecraft crach :

      [11:37:42] [Client thread/FATAL]: Reported exception thrown!
      net.minecraft.util.ReportedException: Ticking block entity
      at net.minecraft.world.World.updateEntities(World.java:1911) ~[World.class:?]
      at net.minecraft.client.Minecraft.runTick(Minecraft.java:2184) ~[Minecraft.class:?]
      at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1087) ~[Minecraft.class:?]
      at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
      at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
      at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
      at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
      at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
      at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
      at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
      at GradleStart.main(Unknown Source) [start/:?]
      Caused by: java.lang.NullPointerException
      at net.minecraft.item.crafting.RecipeRepairItem.matches(RecipeRepairItem.java:33) ~[RecipeRepairItem.class:?]
      at net.minecraft.item.crafting.CraftingManager.findMatchingRecipe(CraftingManager.java:347) ~[CraftingManager.class:?]
      at com.maxyfactory.tileentity.AutoCrafterTileEntity.checkForCrafting(AutoCrafterTileEntity.java:136) ~[AutoCrafterTileEntity.class:?]
      at com.maxyfactory.tileentity.AutoCrafterTileEntity.update(AutoCrafterTileEntity.java:109) ~[AutoCrafterTileEntity.class:?]
      at net.minecraft.world.World.updateEntities(World.java:1896) ~[World.class:?]
      … 16 more
      [11:37:42] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:663]: –-- Minecraft Crash Report ----
      // Quite honestly, I wouldn't worry myself about that.
      
      Time: 15/08/16 11:37
      Description: Ticking block entity
      
      java.lang.NullPointerException: Ticking block entity
      at net.minecraft.item.crafting.RecipeRepairItem.matches(RecipeRepairItem.java:33)
      at net.minecraft.item.crafting.CraftingManager.findMatchingRecipe(CraftingManager.java:347)
      at com.maxyfactory.tileentity.AutoCrafterTileEntity.checkForCrafting(AutoCrafterTileEntity.java:136)
      at com.maxyfactory.tileentity.AutoCrafterTileEntity.update(AutoCrafterTileEntity.java:109)
      at net.minecraft.world.World.updateEntities(World.java:1896)
      at net.minecraft.client.Minecraft.runTick(Minecraft.java:2184)
      at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1087)
      at net.minecraft.client.Minecraft.run(Minecraft.java:376)
      at net.minecraft.client.main.Main.main(Main.java:117)
      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 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.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 net.minecraft.item.crafting.RecipeRepairItem.matches(RecipeRepairItem.java:33)
      at net.minecraft.item.crafting.CraftingManager.findMatchingRecipe(CraftingManager.java:347)
      at com.maxyfactory.tileentity.AutoCrafterTileEntity.checkForCrafting(AutoCrafterTileEntity.java:136)
      at com.maxyfactory.tileentity.AutoCrafterTileEntity.update(AutoCrafterTileEntity.java:109)
      
      -- Block entity being ticked --
      Details:
      Name: autoCrafterTileEntity // com.maxyfactory.tileentity.AutoCrafterTileEntity
      Block type: ID #198 (tile.autoCrafter // com.maxyfactory.block.AutoCrafter)
      Block data value: 4 / 0x4 / 0b0100
      Block location: World: (-364,5,411), Chunk: (at 4,0,11 in -23,25; contains blocks -368,0,400 to -353,255,415), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
      Actual block type: ID #198 (tile.autoCrafter // com.maxyfactory.block.AutoCrafter)
      Actual block data value: 4 / 0x4 / 0b0100
      Stacktrace:
      at net.minecraft.world.World.updateEntities(World.java:1896)
      
      -- Affected level --
      Details:
      Level name: MpServer
      All players: 1 total; [EntityPlayerSP['LeBossMax2'/103, l='MpServer', x=-365,54, y=4,00, z=411,60]]
      Chunk stats: MultiplayerChunkCache: 200, 200
      Level seed: 0
      Level generator: ID 01 - flat, ver 0\. Features enabled: false
      Level generator options:
      Level spawn location: -360,00,4,00,419,00 - World: (-360,4,419), Chunk: (at 8,0,3 in -23,26; contains blocks -368,0,416 to -353,255,431), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
      Level time: 787 game time, 787 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: 39 total; [EntityCow['Vache'/64, l='MpServer', x=-324,24, y=4,00, z=390,97], EntityCow['Vache'/65, l='MpServer', x=-323,22, y=4,00, z=393,13], EntityCow['Vache'/66, l='MpServer', x=-326,05, y=4,00, z=390,28], EntityCow['Vache'/67, l='MpServer', x=-329,31, y=4,00, z=427,69], EntityChicken['Poule'/68, l='MpServer', x=-333,00, y=4,00, z=427,03], EntityChicken['Poule'/69, l='MpServer', x=-328,88, y=4,00, z=416,63], EntitySlime['Slime'/70, l='MpServer', x=-335,99, y=4,67, z=413,85], EntityChicken['Poule'/71, l='MpServer', x=-330,56, y=4,00, z=429,09], EntitySlime['Slime'/76, l='MpServer', x=-308,42, y=4,26, z=356,89], EntityCow['Vache'/77, l='MpServer', x=-319,50, y=4,00, z=386,50], EntitySlime['Slime'/79, l='MpServer', x=-318,98, y=4,41, z=480,13], EntitySlime['Slime'/19, l='MpServer', x=-433,65, y=4,77, z=365,30], EntitySlime['Slime'/20, l='MpServer', x=-442,33, y=4,40, z=376,31], EntitySlime['Slime'/23, l='MpServer', x=-428,34, y=4,34, z=379,40], EntitySlime['Slime'/24, l='MpServer', x=-419,65, y=4,77, z=383,96], EntitySlime['Slime'/25, l='MpServer', x=-417,81, y=4,31, z=439,78], EntitySlime['Slime'/91, l='MpServer', x=-294,73, y=4,67, z=355,23], EntitySlime['Slime'/28, l='MpServer', x=-388,96, y=4,33, z=371,70], EntitySlime['Slime'/92, l='MpServer', x=-294,75, y=4,03, z=351,13], EntityCow['Vache'/29, l='MpServer', x=-385,50, y=4,00, z=378,50], EntitySlime['Slime'/93, l='MpServer', x=-297,61, y=4,67, z=371,51], EntityHorse['Cheval'/30, l='MpServer', x=-384,94, y=4,00, z=372,59], EntitySlime['Slime'/94, l='MpServer', x=-296,04, y=4,01, z=367,74], EntitySlime['Slime'/31, l='MpServer', x=-392,90, y=4,01, z=376,68], EntitySlime['Slime'/32, l='MpServer', x=-388,23, y=4,17, z=374,16], EntityCow['Vache'/33, l='MpServer', x=-382,50, y=4,00, z=376,50], EntityHorse['Cheval'/34, l='MpServer', x=-383,50, y=4,00, z=370,50], EntityCow['Vache'/35, l='MpServer', x=-383,50, y=4,00, z=378,50], EntityHorse['Cheval'/36, l='MpServer', x=-384,14, y=4,00, z=374,36], EntitySlime['Slime'/37, l='MpServer', x=-386,67, y=4,52, z=404,03], EntitySlime['Slime'/39, l='MpServer', x=-369,66, y=4,31, z=487,22], EntityPlayerSP['LeBossMax2'/103, l='MpServer', x=-365,54, y=4,00, z=411,60], EntitySlime['Slime'/41, l='MpServer', x=-359,73, y=4,51, z=405,82], EntitySlime['Slime'/42, l='MpServer', x=-358,22, y=4,00, z=467,09], EntitySlime['Slime'/43, l='MpServer', x=-356,83, y=4,40, z=482,74], EntitySlime['Slime'/51, l='MpServer', x=-339,36, y=4,01, z=444,68], EntitySlime['Slime'/52, l='MpServer', x=-339,73, y=4,00, z=455,68], EntitySlime['Slime'/53, l='MpServer', x=-347,19, y=4,00, z=480,06], EntitySlime['Slime'/63, l='MpServer', x=-333,26, y=4,28, z=353,78]]
      Retry entities: 0 total; []
      Server brand: fml,forge
      Server type: Integrated singleplayer server
      Stacktrace:
      at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:392)
      at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2614)
      at net.minecraft.client.Minecraft.run(Minecraft.java:398)
      at net.minecraft.client.main.Main.main(Main.java:117)
      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 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.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
      at GradleStart.main(Unknown Source)
      

      Le problème c’est qu’on peux voir qu’il y a un NPE ici :

          public boolean matches(InventoryCrafting inv, World worldIn)
          {
              ArrayList arraylist = Lists.newArrayList();
      
              for (int i = 0; i < inv.getSizeInventory(); ++i)
              {
                  ItemStack itemstack = inv.getStackInSlot(i);
      
                  if (itemstack != null)
                  {
                      arraylist.add(itemstack);
      
                      if (arraylist.size() > 1)
                      {
                          ItemStack itemstack1 = (ItemStack)arraylist.get(0);
      
                          if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) // ici !
                          {
                              return false;
                          }
                      }
                  }
              }
      
              return arraylist.size() == 2;
          }
      

      Or il y a déjà un null check pour les itemstacks, la seul possibilité que je vois, c’est que itemstack1.getItem() est null 😕 . Mais je pense que le problème vient plutôt de ce que j’ai fait dans ma tileEntity :

          private void checkForCrafting()
          {
              ItemStack[] actualGrid = this.getActualGrid();
              boolean flag = false;
              InventoryCrafting invCrafting = new InventoryCrafting(new AutoCrafterContainer(this), GRID_SIZE, GRID_SIZE); // Création d'un inventoryCrafting qui vat permettre de trouver le résultat du craft.
              for (int i = 0; i < actualGrid.length; i++)
              {
                  invCrafting.setInventorySlotContents(i, actualGrid*);
                  if (actualGrid* != null)
                  {
                      flag = true;
                  }
              }
      
              if(!flag) // Petit truc que j'ai fait pour savoir si le problème soit que la list soit vide
              {
                  return;
              }
      
              ItemStack craftResult = CraftingManager.getInstance().findMatchingRecipe(invCrafting, this.worldObj); // Là, j’asseye de récupérer le résultat du craft, c'est la seul fonction que j'ai trouvé, j'ai besion d'un InventoryCrafting
              if (craftResult != null)
              {
                  this.ejectItems(craftResult);
                  this.ejectItems(CraftingManager.getInstance().func_180303_b(invCrafting, this.worldObj));
                  this.consumeItems(actualGrid);
              }
          }
      

      J’ai fait ce code tout seul sans même regarder sur internet donc je suppose que le problème vient plutôt d’ici.
      Ps : chose plutôt étrange, malgrés le “if(!flag) return;”, cela crach alors que la list est vide …

      1 réponse Dernière réponse Répondre Citer 0
      • J
        Jodge dernière édition par

        Qu’elle est la ligne 33 sur la fonction Match ? (celle avec ici je présume ?)

        Ajoute du débug avec System.out.print. Regarde l’état des deux variables, et laquelle est a null (System.out.print(“” + variable); pour évité d’utilisé la fonction toString()).
        Si aucune est a null, fait un print de toute les valeurs que tu check*
        *(pour ça recopie les fonction en local et fait les fonctionnés à la place, me sort pas “je peu pas c’est les sources”)

        :::
        au passage pourquoi (google.com)
        “Lists.newArrayList();”
        alors que
        “new ArrayList<object>();”
        est uniquement java.util.ArrayList (sa revient au même en passant par une fonction de moins, et sans charger la bibliothèque com.google.common.collect.Lists) et aussi
        “if (arraylist.size() > 1)”
        Minecraft est bien codé parfois x) #troll

        :::</object>

        1 réponse Dernière réponse Répondre Citer 0
        • LeBossMax2
          LeBossMax2 dernière édition par

          @‘Jodge’:

          Qu’elle est la ligne 33 sur la fonction Match ? (celle avec ici je présume ?)

          Ajoute du débug avec System.out.print. Regarde l’état des deux variables, et laquelle est a null (System.out.print(“” + variable); pour évité d’utilisé la fonction toString()).
          Si aucune est a null, fait un print de toute les valeurs que tu check*
          *(pour ça recopie les fonction en local et fait les fonctionnés à la place, me sort pas “je peu pas c’est les sources”)

          :::
          au passage pourquoi (google.com)
          “Lists.newArrayList();”
          alors que
          “new ArrayList<object>();”
          est uniquement java.util.ArrayList (sa revient au même en passant par une fonction de moins, et sans charger la bibliothèque com.google.common.collect.Lists) et aussi
          “if (arraylist.size() > 1)”
          Minecraft est bien codé parfois x) #troll

          :::
          Salut et merci de ton aide. J’ai trouver la source de mon problème : la list que je pensais être vide ne l’étais en réalité pas ! Dans la fonction “getActualGrid()” j’utilisais “new ItemStack(checkState.getBlock());” or il était possible que “checkState” soit le BlockState d’un block d’air donc ça donne un ItemStack avec un item = null.
          J’ai encore quelque petits crachs/bugs à corriger donc je mettrais ce sujet en résolu quand j’en aurais plus.</object>

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

            Envoi les crash sinon car tu risques d’oublier après

            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
            • LeBossMax2
              LeBossMax2 dernière édition par

              @‘SCAREX’:

              Envoi les crash sinon car tu risques d’oublier après

              Pour l’instant, j’ai réussi à corriger tout les crash que j’ai trouvé, donc je met le sujet en résolu !

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

              MINECRAFT FORGE FRANCE © 2018

              Powered by NodeBB