MFF

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

    Bug NBTTag pour Item avec craft

    Planifier Épinglé Verrouillé Déplacé Sans suite
    1.7.10
    42 Messages 3 Publieurs 10.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.
    • DeletedD Hors-ligne
      Deleted
      dernière édition par

      @‘robin4002’:

      Mais pourquoi vouloir utiliser les tag nbt de l’itemstack alors  :huh:

      En fait mes armes seront améliorables (certaines aux clous, d’autres au poison, d’autres pas du tout, d’autres les deux à la fois) c’est à ça que servent les 2 boolean supplémentaires dans le constructeur. Mais de base tous mes nouveaux items sont normaux, je veux juste me servir des NBTTag pour enregistrer si certaines de ces armes ont subi une des 2 améliorations. Tu comprends ou pas ? :huh:

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

        En fait mes armes seront améliorables (certaines aux clous, d’autres au poison, d’autres pas du tout, d’autres les deux à la fois) c’est à ça que servent les 2 boolean supplémentaires dans le constructeur. Mais de base tous mes nouveaux items sont normaux, je veux juste me servir des NBTTag pour enregistrer si certaines de ces armes ont subi une des 2 améliorations. Tu comprends ou pas ? :huh:

        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

          Dans ce cas pourquoi avoir fait plusieurs items ? Un seul suffit non ?

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

            Alors il faut passer par une classe implements IRecipe, voici un code qui devrait t’aider (Dans ce code je me suis fait une API un peu difficile à comprendre, demande si tu as besoin d’aide sur ce code) :

            package fr.scarex.ascalonmod.recipe;
            
            import java.util.Random;
            
            import net.minecraft.block.Block;
            import net.minecraft.init.Blocks;
            import net.minecraft.init.Items;
            import net.minecraft.inventory.InventoryCrafting;
            import net.minecraft.item.Item;
            import net.minecraft.item.ItemStack;
            import net.minecraft.item.crafting.IRecipe;
            import net.minecraft.nbt.NBTTagCompound;
            import net.minecraft.world.World;
            import fr.scarex.ascalonmod.block.AscalonModBlocks;
            import fr.scarex.ascalonmod.item.AscalonModItems;
            
            /**
            * @author SCAREX
            *
            */
            public class KeyRecipe implements IRecipe
            {
            private static final Random RNG = new Random();
            protected ItemStack result;
            protected ExtendedItem[][] matrix;
            protected byte slotIndex;
            
            public KeyRecipe(ItemStack result, byte slotIndex, ExtendedItem[][] matrix) {
            this.result = result;
            this.matrix = matrix;
            this.slotIndex = slotIndex;
            }
            
            public KeyRecipe(CraftMatrix c) {
            this.result = c.result;
            this.slotIndex = c.slot;
            this.matrix = c.matrix;
            }
            
            @Override
            public boolean matches(InventoryCrafting inv, World world) {
            for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
            if (!ExtendedItem.corresponds(this.matrix*[j], inv.getStackInSlot(i * 3 + j))) return false;
            }
            }
            return true;
            }
            
            @Override
            public ItemStack getCraftingResult(InventoryCrafting inv) {
            NBTTagCompound comp = new NBTTagCompound();
            if (slotIndex > 0)
            comp.setInteger("key", inv.getStackInSlot(slotIndex).getTagCompound().getInteger("key"));
            else
            comp.setInteger("key", RNG.nextInt());
            ItemStack stack = result.copy();
            stack.setTagCompound(comp);
            return stack;
            }
            
            @Override
            public int getRecipeSize() {
            return 9;
            }
            
            @Override
            public ItemStack getRecipeOutput() {
            return result.copy();
            }
            
            public static enum CraftMatrix
            {
            KEY(
            new ItemStack(AscalonModItems.ITEM_KEY),
            -1,
            new Item[][] {
            new Item[] {
            Items.iron_ingot,
            Items.iron_ingot,
            null },
            new Item[] {
            null,
            Items.iron_ingot,
            null },
            new Item[] {
            null,
            Items.iron_ingot,
            null } }),
            COPY_KEY(
            new ItemStack(AscalonModItems.ITEM_KEY),
            6,
            new Item[][] {
            new Item[] {
            Items.iron_ingot,
            Items.iron_ingot,
            null },
            new Item[] {
            null,
            Items.iron_ingot,
            null },
            new Item[] {
            AscalonModItems.ITEM_KEY,
            Items.iron_ingot,
            null } }),
            LOCKED_CHEST(
            new ItemStack(AscalonModBlocks.BLOCK_LOCKED_CHEST),
            5,
            new Item[][] {
            new Item[] {
            Items.iron_ingot,
            Items.iron_ingot,
            Items.iron_ingot },
            new Item[] {
            AscalonModItems.ITEM_LOCK,
            Item.getItemFromBlock(Blocks.chest),
            AscalonModItems.ITEM_KEY },
            new Item[] {
            Items.iron_ingot,
            Items.iron_ingot,
            Items.iron_ingot } }),
            LOCKED_DOOR(
            new ItemStack(AscalonModItems.ITEM_SPRUCE_DOOR),
            5,
            new ExtendedItem[][] {
            new ExtendedItem[] {
            new ExtendedItem(Blocks.planks, 1),
            new ExtendedItem(Blocks.planks, 1),
            null },
            new ExtendedItem[] {
            new ExtendedItem(Blocks.planks, 1),
            new ExtendedItem(Blocks.planks, 1),
            new ExtendedItem(AscalonModItems.ITEM_KEY) },
            new ExtendedItem[] {
            new ExtendedItem(Blocks.planks, 1),
            new ExtendedItem(Blocks.planks, 1),
            null } });
            
            public ItemStack result;
            public byte slot;
            public ExtendedItem[][] matrix;
            
            private CraftMatrix(ItemStack stack, int slotIndex, Item[][] matrix) {
            this.result = stack;
            this.slot = (byte) slotIndex;
            this.matrix = ExtendedItem.convertMatrix(matrix);
            }
            
            private CraftMatrix(ItemStack result, int slot, ExtendedItem[][] matrix) {
            this.result = result;
            this.slot = (byte) slot;
            this.matrix = matrix;
            }
            }
            
            public static class ExtendedItem
            {
            private Item item;
            private int metadata;
            
            public ExtendedItem(Item item, int meta) {
            this.item = item;
            this.metadata = meta;
            }
            
            public ExtendedItem(Block block, int metadata) {
            this.item = Item.getItemFromBlock(block);
            this.metadata = metadata;
            }
            
            public ExtendedItem(Item item) {
            this.item = item;
            this.metadata = 0;
            }
            
            public ExtendedItem(Block block) {
            this.item = Item.getItemFromBlock(block);
            this.metadata = 0;
            }
            
            /**
            * @return the item
            */
            public Item getItem() {
            return item;
            }
            
            /**
            * @return the metadata
            */
            public int getMetadata() {
            return metadata;
            }
            
            public static ExtendedItem[][] convertMatrix(Item[][] items) {
            ExtendedItem[][] xItems = new ExtendedItem[3][3];
            for (int i = 0; i < xItems.length; i++) {
            for (int j = 0; j < xItems*.length; j++) {
            xItems*[j] = new ExtendedItem(items*[j]);
            }
            }
            return xItems;
            }
            
            public static boolean corresponds(ExtendedItem item, ItemStack stack) {
            if (stack == null && item != null && item.getItem() != null) return false;
            if (stack != null && (item == null || item.getItem() == null)) return false;
            if (stack != null && item.getItem() != null && (stack.getItem() != item.getItem() || stack.getItemDamage() != item.getMetadata())) return false;
            return true;
            }
            }
            }
            
            

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

              Non les item que je t’ai montré dans mon message 12 sont différents. Ils subiront tous des améliorations. Exemple la grosse hâche qui pourra être amélioré en mode poison, la batte de baseball en mode clou, etc…

              SCAREX, si tu lis ce message j’ai trouvé ces 2 lien pour l’interface mais j’ai du mal à comprendre
              http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2181203-how-to-use-the-irecipe-interface
              http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2230695-irecipe-help
              http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2268796-help-me-use-nbt

              Au niveau de l’enregistrement ça va.
              Pour l méthode matches() c’est juste la méthode où on doit spécifier quels items se trouvent dans quels slots, je pense

              Ok je viens de voir ton message ><

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

                matches -> regarde si les slots correspondent
                getCraftingResult -> retourne un ItemStack correspondant à l’output du craft
                getRecipeSize -> retourne le nombre de slots à utiliser ( 9 = toute la table je crois)
                getRecipeOutput -> l’ItemStack sans modifications, je ne sais pas à quoi çà sert

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

                  Ok je me suis dépatouillé et j’ai enfin réussi. Merci SCAREX au fait ton code a l’air super, dommage que je ne le comprenne pas dans son intégralité 😞

                  J’ai juste une dernière question à quoi sert cette ligne :

                  
                  for (int k1 = 0; k1 < craftingTable.getSizeInventory(); ++k1)
                  
                  

                  Je sais que c’est une boucle et tout…qu’elle est répétée 9 fois puisqu’il y a 9 slot dans l’inventaire mais elle permet de vérifier chaque slot, si c’est bien ça pourquoi la méthode ne s’en charge pas toute seule étant donné que la méthode matches () est une méthode tickée ?

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

                    la méthode matches te demande de verifier si le craft est bon, si tu mets return true, n’importe quoi donnera ton craft. Ici j’utilise une boucle for pour me s’implifier la vie avec les matrix que j’ai mis plus bas : ce sont des array d’Item (ou extended item pour les metadatas). çà rend les choses plus simple.

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

                      Désolé de devoir réouvrir ce sujet mais ça évitera d’en recréer un qui traite le même problème. Je voudrai que si mon Item passé en argument du constructeur, soit inutile si il possède déjà un Tag. En gros on ne peut pas réaliser le craft si par-exemple ma batte de baseball possède déjà le NBT Boolean “wasImprovedInClouMode”. Déjà soit je n’ai toujrous rien compris soit je sais pas , mon premier println n’est même pas appelé (celui de la méthode matches()) alors que mon item possède bien un tag, donc logiquement le stackTagCompound ne devrait pas être null, or c’est le second println qui est appelé.
                      Voici mon code

                      
                      package fr.mrplaigon.dyingcraft.common.customrecipe;
                      
                      import net.minecraft.inventory.InventoryCrafting;
                      import net.minecraft.item.ItemStack;
                      import net.minecraft.item.crafting.IRecipe;
                      import net.minecraft.nbt.NBTTagCompound;
                      import net.minecraft.world.World;
                      import fr.mrplaigon.dyingcraft.common.handler.ItemHandler;
                      import fr.mrplaigon.dyingcraft.common.item.DyingCraftItemSword;
                      
                      public class ImprovementsRecipe implements IRecipe
                      {
                      
                      private DyingCraftItemSword itemImproved;
                      private byte statut;
                      
                      public ImprovementsRecipe(DyingCraftItemSword itemImproved)
                      {
                      this.itemImproved = itemImproved;
                      statut = 0;
                      }
                      
                      @Override
                      public boolean matches(InventoryCrafting craftingTable, World world)
                      {
                      ItemStack itemstack = new ItemStack(itemImproved, 1);
                      
                      if(itemstack.stackTagCompound != null)
                      {
                      System.out.println("stackTagCompound non null");
                      }
                      else
                      {
                      System.out.println("stackTagCompound null");
                      }
                      
                      for (int k1 = 0; k1 < craftingTable.getSizeInventory(); ++k1)
                      {
                      if(itemImproved.isImprovableInClouMode())
                      {
                      if(craftingTable.getStackInSlot(1) != null && craftingTable.getStackInSlot(3) != null && craftingTable.getStackInSlot(4) != null && craftingTable.getStackInSlot(5) != null && craftingTable.getStackInSlot(7) != null)
                      {
                      if(craftingTable.getStackInSlot(1).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(3).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(5).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(7).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(4).getItem() == itemImproved)
                      {
                      statut = 1;
                      return true;
                      }
                      }
                      }
                      if(itemImproved.isImprovableInPoisonMode())
                      {
                      if(craftingTable.getStackInSlot(1) != null && craftingTable.getStackInSlot(3) != null && craftingTable.getStackInSlot(4) != null && craftingTable.getStackInSlot(5) != null && craftingTable.getStackInSlot(7) != null)
                      {
                      if(craftingTable.getStackInSlot(1).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(3).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(5).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(7).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(4).getItem() == itemImproved)
                      {
                      statut = 2;
                      return true;
                      }
                      }
                      }
                      }
                      return false;
                      }
                      
                      @Override
                      public ItemStack getCraftingResult(InventoryCrafting inventorycrafting)
                      {
                      ItemStack itemstack = new ItemStack(itemImproved, 1);
                      NBTTagCompound compound = new NBTTagCompound();
                      // if(statut == 1 && !itemstack.stackTagCompound.hasKey("wasImprovedInClouMode"))
                      // {
                      // compound.setBoolean("wasImprovedInClouMode", true);
                      // return itemstack;
                      // }
                      // if(statut == 1 && itemstack.stackTagCompound.hasKey("wasImprovedInClouMode"))
                      // {
                      // EventHandlerClient.drawCraftPicture(168, 138, new ResourceLocation("dyingcraftmod", "textures/gui/improvements/errorsMessages.png"));
                      // }
                      // else if(statut == 2 && !itemstack.stackTagCompound.hasKey("wasImprovedInPoisonMode"))
                      // {
                      // compound.setBoolean("wasImprovedInPoisonMode", true);
                      // return itemstack;
                      // }
                      if(statut == 1)
                      {
                      compound.setBoolean("wasImprovedInClouMode", true);
                      }
                      else
                      {
                      compound.setBoolean("wasImprovedInPoisonMode", true);
                      }
                      itemstack.setTagCompound(compound);
                      return itemstack;
                      }
                      
                      @Override
                      public int getRecipeSize()
                      {
                      return 9;
                      }
                      
                      @Override
                      public ItemStack getRecipeOutput()
                      {
                      return new ItemStack(itemImproved);
                      }
                      
                      }
                      
                      
                      1 réponse Dernière réponse Répondre Citer 0
                      • SCAREXS Hors-ligne
                        SCAREX
                        dernière édition par

                        Une instance de ta classe = un craft ou un groupe de crafts.

                        Ton matches te donne accès à tous les items de la table de craft, c’est à toi d’aller les chercher au bon endroit et de regarder qu’ils soient bien là.

                        Pense à enregistrer ton recipe avec GameRegistry.addRecipe(new TaClasse()).

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

                          Je vais reformuler
                          J’ai créer une dizaine d’armes toutes extends DyingraftItemSword et je souhaite la chose suivante : Si le joueur a 4 boites de clou et une arme améliorables aux clou alors il place son arme aux centre et l’entour de 4 boites de clou. Ceci fait son arme alors amélioré sera l’arme crafté avec comme NBT ajouté le boolean “wasImprovedInClouMode” passé en true. Cepndant ce que je ne souhaite pas c’est que le joueur remette son arme améliorée aux clous à l’instant même et qu’il la reaméliore. Je souhaite donc qu’une arme avec comme NBT d’actif le boolean “wasImprovedInClouMode”, ne puisse pas être réutilisé dans la table de craft. Mon soucis est que mon premier println n’est pas appelé alors que le second l’est toujorus, lui.
                          SCAREX, j’ai déjà enregistré mon IRecipe, pas de soucis là-dessus.

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

                            Normal, tu crée un nouvel ItemStack, pourquoi ?

                            ItemStack itemstack = new ItemStack(itemImproved, 1);
                            
                            if(itemstack.stackTagCompound != null)
                            {
                            System.out.println("stackTagCompound non null");
                            }
                            else
                            {
                            System.out.println("stackTagCompound null");
                            }
                            

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

                              Pour avoir une instance comment je l’ai autrement sinon ?
                              Non je vais plutôt la créer avec la méthode getStackInRowAndColumn(int i, int y)

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

                                On te donne un InventoryCrafting implements IInventory, donc tu peux utiliser getStackInSlot

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

                                  Ma méthode proposée et la tienne sont équivalentes
                                  C’est bon tout marche à merveille !

                                  EDIT :

                                  Bon je suis de retour (jamais 2 sans 3) mais vraiment je ne penser pas en avori besoin. J’ai crée une méthode pour afficher une image elle marche très bien dans l’event ItemToolTip mais dans la méthode matches (), elle ne veut rien savoir 
                                  Mon code

                                  
                                  @Override
                                  public boolean matches(InventoryCrafting craftingTable, World world) 
                                  {
                                  
                                  for (int k1 = 0; k1 < craftingTable.getSizeInventory(); ++k1)
                                  {
                                  if(itemImproved.isImprovableInClouMode())
                                  {
                                  if(craftingTable.getStackInSlot(1) != null && craftingTable.getStackInSlot(3) != null && craftingTable.getStackInSlot(4) != null && craftingTable.getStackInSlot(5) != null && craftingTable.getStackInSlot(7) != null)
                                  {
                                  ItemStack itemstack = craftingTable.getStackInSlot(4);
                                  if(itemstack.stackTagCompound != null)
                                  {
                                  System.out.println("stackTagCompound non null");
                                  }
                                  else
                                  {
                                  System.out.println("stackTagCompound null");
                                  }
                                  if(craftingTable.getStackInSlot(1).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(3).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(5).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(7).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(4).getItem() == itemImproved && itemstack.stackTagCompound == null)
                                  {
                                  statut = 1;
                                  return true;
                                  }
                                  else if(craftingTable.getStackInSlot(1).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(3).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(5).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(7).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(4).getItem() == itemImproved && itemstack.stackTagCompound != null)
                                  {
                                  drawCraftPicture(30, 16, 0, 0,157, 121, new ResourceLocation("dyingcraftmod", "textures/gui/improvements/errorsMessages.png"));
                                  }
                                  }
                                  }
                                  if(itemImproved.isImprovableInPoisonMode())
                                  {
                                  if(craftingTable.getStackInSlot(1) != null && craftingTable.getStackInSlot(3) != null && craftingTable.getStackInSlot(4) != null && craftingTable.getStackInSlot(5) != null && craftingTable.getStackInSlot(7) != null)
                                  {
                                  ItemStack itemstack = craftingTable.getStackInSlot(4);
                                  if(craftingTable.getStackInSlot(1).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(3).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(5).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(7).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(4).getItem() == itemImproved && itemstack.stackTagCompound == null)
                                  {
                                  statut = 2;
                                  return true;
                                  }
                                  else if(craftingTable.getStackInSlot(1).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(3).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(5).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(7).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(4).getItem() == itemImproved && itemstack.stackTagCompound != null)
                                  {
                                  drawCraftPicture(30, 16, 0, 0, 157, 121, new ResourceLocation("dyingcraftmod", "textures/gui/improvements/errorsMessages.png"));
                                  }
                                  }
                                  }
                                  }
                                  return false;
                                  }
                                  
                                  public void drawCraftPicture(int posX, int posY, int u, int v, int width, int heigth, ResourceLocation craftTextureFile) 
                                  {
                                  GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                                  GL11.glDisable(GL11.GL_LIGHTING);
                                  Minecraft.getMinecraft().getTextureManager().bindTexture(craftTextureFile);
                                  Minecraft.getMinecraft().currentScreen.drawTexturedModalRect(posX, posY, u, v, width, heigth);
                                  }
                                  

                                  Le crash report

                                  –-- Minecraft Crash Report ----
                                  // On the bright side, I bought you a teddy bear!
                                  
                                  Time: 02/07/15 14:57
                                  Description: Ticking memory connection
                                  
                                  java.lang.RuntimeException: No OpenGL context found in the current thread.
                                  at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
                                  at org.lwjgl.opengl.GL11.glColor4f(GL11.java:891)
                                  at fr.mrplaigon.dyingcraft.common.customrecipe.ImprovementsRecipe.drawCraftPicture(ImprovementsRecipe.java:81)
                                  at fr.mrplaigon.dyingcraft.common.customrecipe.ImprovementsRecipe.matches(ImprovementsRecipe.java:55)
                                  at net.minecraft.item.crafting.CraftingManager.findMatchingRecipe(CraftingManager.java:329)
                                  at net.minecraft.inventory.ContainerWorkbench.onCraftMatrixChanged(ContainerWorkbench.java:60)
                                  at net.minecraft.inventory.InventoryCrafting.setInventorySlotContents(InventoryCrafting.java:132)
                                  at net.minecraft.inventory.Slot.putStack(Slot.java:104)
                                  at net.minecraft.inventory.Container.slotClick(Container.java:325)
                                  at net.minecraft.network.NetHandlerPlayServer.processClickWindow(NetHandlerPlayServer.java:955)
                                  at net.minecraft.network.play.client.C0EPacketClickWindow.processPacket(C0EPacketClickWindow.java:41)
                                  at net.minecraft.network.play.client.C0EPacketClickWindow.processPacket(C0EPacketClickWindow.java:113)
                                  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 org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
                                  at org.lwjgl.opengl.GL11.glColor4f(GL11.java:891)
                                  at fr.mrplaigon.dyingcraft.common.customrecipe.ImprovementsRecipe.drawCraftPicture(ImprovementsRecipe.java:81)
                                  at fr.mrplaigon.dyingcraft.common.customrecipe.ImprovementsRecipe.matches(ImprovementsRecipe.java:55)
                                  at net.minecraft.item.crafting.CraftingManager.findMatchingRecipe(CraftingManager.java:329)
                                  at net.minecraft.inventory.ContainerWorkbench.onCraftMatrixChanged(ContainerWorkbench.java:60)
                                  at net.minecraft.inventory.InventoryCrafting.setInventorySlotContents(InventoryCrafting.java:132)
                                  at net.minecraft.inventory.Slot.putStack(Slot.java:104)
                                  at net.minecraft.inventory.Container.slotClick(Container.java:325)
                                  at net.minecraft.network.NetHandlerPlayServer.processClickWindow(NetHandlerPlayServer.java:955)
                                  at net.minecraft.network.play.client.C0EPacketClickWindow.processPacket(C0EPacketClickWindow.java:41)
                                  at net.minecraft.network.play.client.C0EPacketClickWindow.processPacket(C0EPacketClickWindow.java:113)
                                  at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
                                  
                                  -- Ticking connection --
                                  Details:
                                  Connection: net.minecraft.network.NetworkManager@66628065
                                  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 7 (amd64) version 6.1
                                  Java Version: 1.7.0_71, Oracle Corporation
                                  Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
                                  Memory: 838059152 bytes (799 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 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: 0, tallocated: 0
                                  FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.3.1408 4 mods loaded, 4 mods active
                                  mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
                                  FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.3.1408-1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
                                  Forge{10.13.3.1408} [Minecraft Forge] (forgeSrc-1.7.10-10.13.3.1408-1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
                                  dyingcraftmod{1.0.0} [DyingCraft Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
                                  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['Player193'/386, l='Nouveau monde', x=941,46, y=4,00, z=-915,92]]
                                  Type: Integrated Server (map_client.txt)
                                  Is Modded: Definitely; Client brand changed to 'fml,forge'
                                  
                                  1 réponse Dernière réponse Répondre Citer 0
                                  • DeletedD Hors-ligne
                                    Deleted
                                    dernière édition par

                                    EDIT :

                                    Bon je suis de retour (jamais 2 sans 3) mais vraiment je ne penser pas en avori besoin. J’ai crée une méthode pour afficher une image elle marche très bien dans l’event ItemToolTip mais dans la méthode matches (), elle ne veut rien savoir 
                                    Mon code

                                    
                                    @Override
                                     public boolean matches(InventoryCrafting craftingTable, World world) 
                                    {
                                    
                                    for (int k1 = 0; k1 < craftingTable.getSizeInventory(); ++k1)
                                    {
                                    if(itemImproved.isImprovableInClouMode())
                                    {
                                    if(craftingTable.getStackInSlot(1) != null && craftingTable.getStackInSlot(3) != null && craftingTable.getStackInSlot(4) != null && craftingTable.getStackInSlot(5) != null && craftingTable.getStackInSlot(7) != null)
                                    {
                                    ItemStack itemstack = craftingTable.getStackInSlot(4);
                                    if(itemstack.stackTagCompound != null)
                                    {
                                    System.out.println("stackTagCompound non null");
                                    }
                                    else
                                    {
                                    System.out.println("stackTagCompound null");
                                    }
                                    if(craftingTable.getStackInSlot(1).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(3).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(5).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(7).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(4).getItem() == itemImproved && itemstack.stackTagCompound == null)
                                    {
                                    statut = 1;
                                    return true;
                                    }
                                    else if(craftingTable.getStackInSlot(1).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(3).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(5).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(7).getItem() == ItemHandler.boiteClous && craftingTable.getStackInSlot(4).getItem() == itemImproved && itemstack.stackTagCompound != null)
                                    {
                                    drawCraftPicture(30, 16, 0, 0,157, 121, new ResourceLocation("dyingcraftmod", "textures/gui/improvements/errorsMessages.png"));
                                    }
                                    }
                                    }
                                    if(itemImproved.isImprovableInPoisonMode())
                                    {
                                    if(craftingTable.getStackInSlot(1) != null && craftingTable.getStackInSlot(3) != null && craftingTable.getStackInSlot(4) != null && craftingTable.getStackInSlot(5) != null && craftingTable.getStackInSlot(7) != null)
                                    {
                                    ItemStack itemstack = craftingTable.getStackInSlot(4);
                                    if(craftingTable.getStackInSlot(1).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(3).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(5).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(7).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(4).getItem() == itemImproved && itemstack.stackTagCompound == null)
                                    {
                                    statut = 2;
                                    return true;
                                    }
                                    else if(craftingTable.getStackInSlot(1).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(3).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(5).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(7).getItem() == ItemHandler.fiolePoison && craftingTable.getStackInSlot(4).getItem() == itemImproved && itemstack.stackTagCompound != null)
                                    {
                                    drawCraftPicture(30, 16, 0, 0, 157, 121, new ResourceLocation("dyingcraftmod", "textures/gui/improvements/errorsMessages.png"));
                                    }
                                    }
                                    }
                                    }
                                    return false;
                                    }
                                    
                                    public void drawCraftPicture(int posX, int posY, int u, int v, int width, int heigth, ResourceLocation craftTextureFile) 
                                    {
                                    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                                    GL11.glDisable(GL11.GL_LIGHTING);
                                    Minecraft.getMinecraft().getTextureManager().bindTexture(craftTextureFile);
                                    Minecraft.getMinecraft().currentScreen.drawTexturedModalRect(posX, posY, u, v, width, heigth);
                                    }
                                    
                                    

                                    Le crash report

                                    –-- Minecraft Crash Report ----
                                    // On the bright side, I bought you a teddy bear!
                                    
                                    Time: 02/07/15 14:57
                                    Description: Ticking memory connection
                                    
                                    java.lang.RuntimeException: No OpenGL context found in the current thread.
                                    at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
                                    at org.lwjgl.opengl.GL11.glColor4f(GL11.java:891)
                                    at fr.mrplaigon.dyingcraft.common.customrecipe.ImprovementsRecipe.drawCraftPicture(ImprovementsRecipe.java:81)
                                    at fr.mrplaigon.dyingcraft.common.customrecipe.ImprovementsRecipe.matches(ImprovementsRecipe.java:55)
                                    at net.minecraft.item.crafting.CraftingManager.findMatchingRecipe(CraftingManager.java:329)
                                    at net.minecraft.inventory.ContainerWorkbench.onCraftMatrixChanged(ContainerWorkbench.java:60)
                                    at net.minecraft.inventory.InventoryCrafting.setInventorySlotContents(InventoryCrafting.java:132)
                                    at net.minecraft.inventory.Slot.putStack(Slot.java:104)
                                    at net.minecraft.inventory.Container.slotClick(Container.java:325)
                                    at net.minecraft.network.NetHandlerPlayServer.processClickWindow(NetHandlerPlayServer.java:955)
                                    at net.minecraft.network.play.client.C0EPacketClickWindow.processPacket(C0EPacketClickWindow.java:41)
                                    at net.minecraft.network.play.client.C0EPacketClickWindow.processPacket(C0EPacketClickWindow.java:113)
                                    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 org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
                                    at org.lwjgl.opengl.GL11.glColor4f(GL11.java:891)
                                    at fr.mrplaigon.dyingcraft.common.customrecipe.ImprovementsRecipe.drawCraftPicture(ImprovementsRecipe.java:81)
                                    at fr.mrplaigon.dyingcraft.common.customrecipe.ImprovementsRecipe.matches(ImprovementsRecipe.java:55)
                                    at net.minecraft.item.crafting.CraftingManager.findMatchingRecipe(CraftingManager.java:329)
                                    at net.minecraft.inventory.ContainerWorkbench.onCraftMatrixChanged(ContainerWorkbench.java:60)
                                    at net.minecraft.inventory.InventoryCrafting.setInventorySlotContents(InventoryCrafting.java:132)
                                    at net.minecraft.inventory.Slot.putStack(Slot.java:104)
                                    at net.minecraft.inventory.Container.slotClick(Container.java:325)
                                    at net.minecraft.network.NetHandlerPlayServer.processClickWindow(NetHandlerPlayServer.java:955)
                                    at net.minecraft.network.play.client.C0EPacketClickWindow.processPacket(C0EPacketClickWindow.java:41)
                                    at net.minecraft.network.play.client.C0EPacketClickWindow.processPacket(C0EPacketClickWindow.java:113)
                                    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
                                    
                                    -- Ticking connection --
                                    Details:
                                    Connection: net.minecraft.network.NetworkManager@66628065
                                    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 7 (amd64) version 6.1
                                    Java Version: 1.7.0_71, Oracle Corporation
                                    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
                                    Memory: 838059152 bytes (799 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 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: 0, tallocated: 0
                                    FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.3.1408 4 mods loaded, 4 mods active
                                    mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
                                    FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.3.1408-1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
                                    Forge{10.13.3.1408} [Minecraft Forge] (forgeSrc-1.7.10-10.13.3.1408-1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
                                    dyingcraftmod{1.0.0} [DyingCraft Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
                                    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['Player193'/386, l='Nouveau monde', x=941,46, y=4,00, z=-915,92]]
                                    Type: Integrated Server (map_client.txt)
                                    Is Modded: Definitely; Client brand changed to 'fml,forge'
                                    
                                    
                                    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

                                      Tu ne peux pas utiliser openGL à cet endroit.

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

                                        Sa j avais bien compris je sais lire un crash report. Et y a pas de solution, au pire je n utiliserai que la méthode drawRectTextured ()

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

                                          Utilise un tick event.

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

                                            Comment ? Comme tu puis je dans mon TickHandler faore une condition en rapport avec les item présent dans certains slot de la table de craft. La méthode matches () est tickee autant m en servir

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

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB