MFF

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

    Créer un bloc type four (machine)

    Planifier Épinglé Verrouillé Déplacé Les interfaces (GUI) et les container
    1.7.10
    236 Messages 39 Publieurs 69.0k Vues 15 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.
    • robin4002R Hors-ligne
      robin4002 Moddeurs confirmés Rédacteurs Administrateurs
      dernière édition par

      Tu n’as pas enregistré ton gui handler, si ?

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

        J’ai regardé le tuto et j’ai pas capter qu’il fallait l’enregistrer O.O c’est quoi la commande ? Je l’ai pas vu 😮

        Je viens de l’ajouter

         NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
        

        J’édite pour dire si sa marche 🙂

        Voila lorsque je fais un click droit sa crash 😕

        A detailed walkthrough of the error, its code path and all known details is as follows:
        –-------------------------------------------------------------------------------------

        – Head –
        Stacktrace:
        at mod.common.block.entity.TileEntityAnalyzer.getStackInSlot(TileEntityAnalyzer.java:70)
        at net.minecraft.inventory.Slot.getStack(Slot.java:88)
        at net.minecraft.inventory.Container.getInventory(Container.java:67)
        at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:53)
        at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88)
        at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
        at mod.common.block.BlockAnalyzer.onBlockActivated(BlockAnalyzer.java:94)
        at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:409)
        at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:593)
        at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
        at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
        at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)

        – Ticking connection –
        Details:
        Connection: net.minecraft.network.NetworkManager@4c6a43d
        Stacktrace:
        at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
        at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
        at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
        at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
        at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

        – System Details –
        Details:
        Minecraft Version: 1.7.10
        Operating System: Windows 8.1 (amd64) version 6.3
        Java Version: 1.7.0_75, Oracle Corporation
        Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
        Memory: 749920904 bytes (715 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 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: 12, tallocated: 94
        FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1448 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.1448-1.7.10.jar) 
        UCHIJAAAA Forge{10.13.4.1448} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar) 
        UCHIJAAAA modminecraft{1.0} [Mod Minecraft] (bin) 
        GL info: ERROR RuntimeException: No OpenGL context found in the current thread.
        Profiler Position: N/A (disabled)
        Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
        Player Count: 1 / 8; [EntityPlayerMP[‘Player812’/228, l=‘New World’, x=117,75, y=66,00, z=571,81]]
        Type: Integrated Server (map_client.txt)
        Is Modded: Definitely; Client brand changed to ‘fml,forge’
        [16:20:48] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:393]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-07-07_16.20.48-server.txt
        [16:20:48] [Client thread/INFO] [FML]: Waiting for the server to terminate/save.
        [16:20:48] [Server thread/INFO]: Saving worlds
        [16:20:48] [Server thread/INFO]: Saving chunks for level ‘New World’/Overworld
        [16:20:48] [Server thread/INFO]: Saving chunks for level ‘New World’/Nether
        [16:20:48] [Server thread/INFO]: Saving chunks for level ‘New World’/The End
        [16:20:48] [Server thread/INFO] [FML]: Unloading dimension 0
        [16:20:48] [Server thread/INFO] [FML]: Unloading dimension -1
        [16:20:48] [Server thread/INFO] [FML]: Unloading dimension 1
        [16:20:48] [Server thread/INFO] [FML]: Applying holder lookups
        [16:20:48] [Server thread/INFO] [FML]: Holder lookups applied
        [16:20:48] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.
        [16:20:48] [Client thread/INFO] [FML]: Server terminated.
        AL lib: (EE) alc_cleanup: 1 device not closed

        La partie du code qui correspond

        @Override
        public ItemStack getStackInSlot(int slotIndex) { //Renvoie L'itemStack se trouvant dans le slot passé en argument
        return this.contents[slotIndex];
        }
        
        @Override //Comme dit plus haut, c'est expliqué dans le tutoriel de robin
        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;
               }
        }
        

        Oui ce gif est drôle.

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

          L’erreur est coupé non ? Il n’y a pas l’exception.

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

            Oui excuse moi j’ai remarqué juste après avoir posté T_T J’ai éditer 🙂

            Oui ce gif est drôle.

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

              Il manque toujours l’exception, il n’y a que le stack trace.

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

                [16:20:46] [Server thread/INFO]: Player812 joined the game
                [16:20:48] [Server thread/ERROR]: Encountered an unexpected exception
                net.minecraft.util.ReportedException: Ticking memory connection
                at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:198) ~[NetworkSystem.class:?]
                at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) ~[MinecraftServer.class:?]
                at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) ~[MinecraftServer.class:?]
                at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[IntegratedServer.class:?]
                at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]
                at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
                Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
                at mod.common.block.entity.TileEntityAnalyzer.getStackInSlot(TileEntityAnalyzer.java:70) ~[TileEntityAnalyzer.class:?]
                at net.minecraft.inventory.Slot.getStack(Slot.java:88) ~[Slot.class:?]
                at net.minecraft.inventory.Container.getInventory(Container.java:67) ~[Container.class:?]
                at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:53) ~[Container.class:?]
                at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88) ~[FMLNetworkHandler.class:?]
                at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501) ~[EntityPlayer.class:?]
                at mod.common.block.BlockAnalyzer.onBlockActivated(BlockAnalyzer.java:94) ~[BlockAnalyzer.class:?]
                at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:409) ~[ItemInWorldManager.class:?]
                at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:593) ~[NetHandlerPlayServer.class:?]
                at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74) ~[C08PacketPlayerBlockPlacement.class:?]
                at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122) ~[C08PacketPlayerBlockPlacement.class:?]
                at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) ~[NetworkManager.class:?]
                at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) ~[NetworkSystem.class:?]
                … 5 more
                [16:20:48] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Legrandfifou\Pictures\forge\eclipse\.\crash-reports\crash-2015-07-07_16.20.48-server.txt
                [16:20:48] [Server thread/INFO]: Stopping server
                [16:20:48] [Server thread/INFO]: Saving players
                [16:20:48] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: –-- Minecraft Crash Report ----
                // Would you like a cupcake?
                
                Time: 7/07/15 16:20
                Description: Ticking memory connection
                
                java.lang.ArrayIndexOutOfBoundsException: 3
                at mod.common.block.entity.TileEntityAnalyzer.getStackInSlot(TileEntityAnalyzer.java:70)
                at net.minecraft.inventory.Slot.getStack(Slot.java:88)
                at net.minecraft.inventory.Container.getInventory(Container.java:67)
                at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:53)
                at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88)
                at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
                at mod.common.block.BlockAnalyzer.onBlockActivated(BlockAnalyzer.java:94)
                at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:409)
                at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:593)
                at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
                at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
                at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
                at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
                at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
                at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
                at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
                at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
                at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
                
                A detailed walkthrough of the error, its code path and all known details is as follows:
                ---------------------------------------------------------------------------------------
                
                -- Head --
                Stacktrace:
                at mod.common.block.entity.TileEntityAnalyzer.getStackInSlot(TileEntityAnalyzer.java:70)
                at net.minecraft.inventory.Slot.getStack(Slot.java:88)
                at net.minecraft.inventory.Container.getInventory(Container.java:67)
                at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:53)
                at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88)
                at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
                at mod.common.block.BlockAnalyzer.onBlockActivated(BlockAnalyzer.java:94)
                at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:409)
                at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:593)
                at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
                at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
                at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
                
                -- Ticking connection --
                Details:
                Connection: net.minecraft.network.NetworkManager@4c6a43d
                Stacktrace:
                at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
                at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
                at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
                at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
                at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
                at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
                
                -- System Details --
                Details:
                Minecraft Version: 1.7.10
                Operating System: Windows 8.1 (amd64) version 6.3
                Java Version: 1.7.0_75, Oracle Corporation
                Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
                Memory: 749920904 bytes (715 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 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: 12, tallocated: 94
                FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1448 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.1448-1.7.10.jar)
                UCHIJAAAA Forge{10.13.4.1448} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar)
                UCHIJAAAA modminecraft{1.0} [Mod Minecraft] (bin)
                GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
                Profiler Position: N/A (disabled)
                Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                Player Count: 1 / 8; [EntityPlayerMP['Player812'/228, l='New World', x=117,75, y=66,00, z=571,81]]
                Type: Integrated Server (map_client.txt)
                Is Modded: Definitely; Client brand changed to 'fml,forge'
                [16:20:48] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:393]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-07-07_16.20.48-server.txt
                [16:20:48] [Client thread/INFO] [FML]: Waiting for the server to terminate/save.
                [16:20:48] [Server thread/INFO]: Saving worlds
                [16:20:48] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
                [16:20:48] [Server thread/INFO]: Saving chunks for level 'New World'/Nether
                [16:20:48] [Server thread/INFO]: Saving chunks for level 'New World'/The End
                [16:20:48] [Server thread/INFO] [FML]: Unloading dimension 0
                [16:20:48] [Server thread/INFO] [FML]: Unloading dimension -1
                [16:20:48] [Server thread/INFO] [FML]: Unloading dimension 1
                [16:20:48] [Server thread/INFO] [FML]: Applying holder lookups
                [16:20:48] [Server thread/INFO] [FML]: Holder lookups applied
                [16:20:48] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.
                [16:20:48] [Client thread/INFO] [FML]: Server terminated.
                AL lib: (EE) alc_cleanup: 1 device not closed
                

                Oui ce gif est drôle.

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

                  Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
                  at mod.common.block.entity.TileEntityAnalyzer.getStackInSlot(TileEntityAnalyzer.java:70) ~[TileEntityAnalyzer.class:?]
                  Ton tableau est plus petit que le nombre de slot que tu as ajouté.

                  1 réponse Dernière réponse Répondre Citer 1
                  • FlowF Hors-ligne
                    Flow
                    dernière édition par

                    Merci Robin  ! ::D

                    J’ai encore un petit problème avec la texture , voyez par vous même j’ai tout fait comme dans le tuto , et mon inventaire est décalé etc 😕

                    Ma texture

                    Probleme

                    Oui ce gif est drôle.

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

                      Faut changer les valeurs dans la fonction draw.

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

                        @Override
                        protected void drawGuiContainerBackgroundLayer(float partialRenderTick, int x, int y)
                        {

                        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                        this.mc.getTextureManager().bindTexture(texture);
                        int k = (this.width - this.xSize) / 2;
                        int l = (this.height - this.ySize) / 2;
                        this.drawTexturedModalRect(k, l, 0, 46, this.xSize, this.ySize);

                        if(this.tileAnalyzer.isBurning())
                        {
                        int i = this.tileAnalyzer.getCookProgress();
                        this.drawTexturedModalRect(k + 47, l + 46, 0, 2, 100, i);
                        }
                        }

                        Les valeurs , 46 , 47 ?

                        Oui ce gif est drôle.

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

                          oui, mais essaie de comprendre le code d’abord.

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

                            Ah ca na plus rien avoir avec
                            " Examinons cette fonction :
                            x correspond à la coordonnée x du gui (in-game) où s’affichera la texture de la barre de progression.
                            y correspond à la coordonnée y du gui (in-game) où s’affichera la texture de la barre de progression.
                            u correspond à la position x de votre barre de progression sur votre texture (dans les ressources, l’image .png).
                            v correspond à la position y de votre barre de progression sur votre texture (dans les ressources, l’image .png).
                            width correspond à la largeur du morceau de texture que vous voulez afficher.
                            height correspond à la hauteur du morceau de texture que vous voulez afficher." Du coup /: J’ai tout réaligner mais il ne reste plus que l’inventaire en bas qu’il faudrait remonter je vais chercher 🙂

                            Oui ce gif est drôle.

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

                              çà c’est géré au niveau du container lorsque tu rajoutes les slots.

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

                                private void bindPlayerInventory(InventoryPlayer inventory)
                                {
                                int i;
                                for (i = 0; i < 3; ++i)
                                {
                                for (int j = 0; j < 9; ++j)
                                {
                                this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 17 + j * 18, 171 + i * 18));
                                }
                                }

                                for (i = 0; i < 9; ++i)
                                {
                                this.addSlotToContainer(new Slot(inventory, i, 17 + i * 18, 229));
                                }
                                }

                                Ce serait pas ca ?

                                Oui ce gif est drôle.

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

                                  Si :
                                  new Slot(inventory, i, 17 + i * 18, 229)

                                  paramètres :

                                  • inventaire
                                  • index dans l’inventaire
                                  • x
                                  • y

                                  il suffit de modifier les 2 derniers pour avoir ce que tu veux.

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

                                    Nice ca marche nice ! Tout est bien positionné mais devine quoi ! La recette marche pas ca ne fait rien 😕

                                    AnalyzerRecipes

                                    
                                    package mod.common.block;
                                    
                                    import java.util.HashMap;
                                    import java.util.Iterator;
                                    import java.util.Map;
                                    import java.util.Map.Entry;
                                    
                                    import mod.common.item.ItemRegister;
                                    import net.minecraft.item.Item;
                                    import net.minecraft.item.ItemStack;
                                    
                                    @SuppressWarnings("rawtypes")
                                    public class AnalyzerRecipes {
                                    
                                    private static final AnalyzerRecipes smeltingBase = new AnalyzerRecipes(); //Permet d'instancier votre classe car vous le l'instancierez nul part ailleur
                                    private Map smeltingList = new HashMap(); //Ceci permet de mettre vos recettes
                                    
                                    public AnalyzerRecipes()
                                    {
                                    this.addRecipe(ItemRegister.itemADNofFrog, ItemRegister.itemSevewithmosquito, new ItemStack(BlockRegister.BlockBarriere)); //Ajout d'une recette, on fait un bloc de diamant à partie de deux pommes et une flèche
                                    }
                                    
                                    @SuppressWarnings("unchecked")
                                    public void addRecipe(ItemStack stack1, ItemStack stack2, ItemStack stack3) //Cette fonction de comprend que des ItemStack, c'est celle qui ajoute les recettes à la HashMap
                                    {
                                    ItemStack[] stackList = new ItemStack[]{stack1, stack2};
                                    this.smeltingList.put(stackList, stack3);
                                    }
                                    
                                    public void addRecipe(Item item1, Item item2, ItemStack stack) //1er cas
                                    {
                                    this.addRecipe(new ItemStack(item1), new ItemStack(item2), stack);
                                    }
                                    
                                    public ItemStack getSmeltingResult(ItemStack[] stack) //En argument : un tableau avec le contenu des trois slots d'input
                                    {
                                    Iterator iterator = this.smeltingList.entrySet().iterator();
                                    Entry entry;
                                    
                                    do
                                    {
                                    if (!iterator.hasNext()) // Si il n'y a plus de recettes dans la liste
                                    {
                                    return null; //Il n'y a pas de recette correspondante
                                    }
                                    entry = (Entry)iterator.next(); //prend la recette suivante
                                    }
                                    while (!this.isSameKey(stack, (ItemStack[])entry.getKey())); //Check si le tableau passé en argument correspond à celui de la recette, vous avez une erreur ici, on crée la fonction tout de suite.
                                    
                                    return (ItemStack)entry.getValue(); //retourne l'itemstack : resultat de la recette
                                    }
                                    
                                    private boolean isSameKey(ItemStack[] stackList, ItemStack[] stackList2)
                                    {
                                    boolean isSame = false; //Au début ce n'est pas la même
                                    for(int i=0; i<=1; i++) // Pour les 3 items
                                    {
                                    if(stackList*.getItem() == stackList2*.getItem()) //On vérifie si ce sont les même
                                    {
                                    isSame = true; // Si c'est le cas alors isSame vaut true
                                    }
                                    else
                                    {
                                    return false; //Si un seul n'est pas bon, on cherche pas, c'est pas la bonne recette
                                    }
                                    }
                                    return isSame;
                                    }
                                    
                                    public Map getSmeltingList()
                                    {
                                    return this.smeltingList;
                                    }
                                    
                                    public static AnalyzerRecipes smelting()
                                    {
                                    return smeltingBase;
                                    }
                                    }
                                    
                                    

                                    Oui ce gif est drôle.

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

                                      Es-tu sûr que ta méthode pour savoir si le contenu correspond est bien appelée ? Si oui, as-tu bien enregistré le recipe ?

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

                                        J’ai suivi le tutoriel donc normalement tout est fait 😕 Appelé , elle se trouve ou alors ?

                                        Oui ce gif est drôle.

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

                                          Fait un clique droit sur ta fonction et fait “Open call hierarchy”, çà te montrera où ta méthode est appelée, si elle ne l’est pas, appelle là, sinon rajoute un System.out.println pour savoir ce qui ne va pas.

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

                                            Je ne pense pas qu’elle soit appelé , mais dans le tuto j’ai regarder et il n’y aucun endroit ou l’on appelle 😕

                                            Oui ce gif est drôle.

                                            1 réponse Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 7
                                            • 8
                                            • 9
                                            • 10
                                            • 11
                                            • 12
                                            • 9 / 12
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB