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

      Il est encore en attente car aucun n’admin n’a prit le temps de le vérifier puis de la valider.

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

        Hello 🙂 Je suis entrain de créer un block type four avec deux slot en input et un slot en output. J’ai également suivi le tutoriel de robin pour le GuiHandler etc mais il était en 1.6.x et je n’arrive pas a l’uptade pour la 1.7.10 voici mon code

        package mod.common.block;
        
        import mod.common.entity.TileEntityAnalyzer;
        import net.minecraft.entity.player.EntityPlayer;
        import net.minecraft.tileentity.TileEntity;
        import net.minecraft.world.World;
        import cpw.mods.fml.common.network.IGuiHandler;
        
        public class GuiHandler implements IGuiHandler
        {
        @Override
        public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
        {
        TileEntity te = world.getTileEntity(x, y, z);
        if(te instanceof TileEntityAnalyzer)
        {
        return new ContainerAnalyzer(player.inventory, (TileEntityAnalyzer)te);
        }
        return null;
        }
        
        @Override
        public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
        {
        TileEntity te = world.getTileEntity(x, y, z);
        if(te instanceof TileEntityAnalyzer)
        {
        return new GuiAnalyzer(player.inventory, (TileEntityAnalyzer)te);
        }
        return null;
        }
        }
        

        J’ai mis le code en rouge pour ce qui apparait en erreur et dans ma classe blockAnalyzer

        [size=smallreturn new ContainerAnalyzer(player.inventory, (TileEntityAnalyzer)te);]
        [font=Monaco, Consolas, Courier, monospacereturn new GuiAnalyzer(player.inventory, (TileEntityAnalyzer)te);]

        package mod.common.block;
        
        import mod.ModMinecraft;
        import mod.common.entity.TileEntityAnalyzer;
        import net.minecraft.block.Block;
        import net.minecraft.block.material.Material;
        import net.minecraft.entity.item.EntityItem;
        import net.minecraft.entity.player.EntityPlayer;
        import net.minecraft.inventory.IInventory;
        import net.minecraft.item.ItemStack;
        import net.minecraft.nbt.NBTTagCompound;
        import net.minecraft.tileentity.TileEntity;
        import net.minecraft.world.World;
        
        public class BlockAnalyzer extends Block
        {
        public BlockAnalyzer()
        {
          super(Material.rock); //Mettez le material qui convient
          this.setResistance(8.0F);
          this.setHarvestLevel("pickaxe", 2); //Outil pour casser le bloc, pour le chiffre : 0=bois, 1=pierre, 2=fer, 3=diamant
          this.setBlockTextureName(ModMinecraft.MODID + ":analyzer.png"); //N'oubliez pas de remplacer "ModTutoriel"
          // … Mettez les attributs complémentaires que vous voulez
        }
        
        @Override
           public TileEntity
        
        //Instancie le TileEntity
           {
               return new TileEntityAnalyzer();
           }
        
           @Override
           public boolean hasTileEntity(int metadata) //Permet de savoir si le bloc a un TileEntity
           {
               return true;
           }
        
           public void breakBlock(World world, int x, int y, int z, Block block, int metadata)
           {
               TileEntity tileentity = world.getTileEntity(x, y, z);
        
               if (tileentity instanceof IInventory)
               {
                IInventory inv = (IInventory)tileentity;
                   for (int i1 = 0; i1 < inv.getSizeInventory(); ++i1)
                   {
                       ItemStack itemstack = inv.getStackInSlot(i1);
        
                       if (itemstack != null)
                       {
                           float f = world.rand.nextFloat() * 0.8F + 0.1F;
                           float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
                           EntityItem entityitem;
        
                           for (float f2 = world.rand.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; world.spawnEntityInWorld(entityitem))
                           {
                               int j1 = world.rand.nextInt(21) + 10;
        
                               if (j1 > itemstack.stackSize)
                               {
                                   j1 = itemstack.stackSize;
                               }
        
                               itemstack.stackSize -= j1;
                               entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
                               float f3 = 0.05F;
                               entityitem.motionX = (double)((float)world.rand.nextGaussian() * f3);
                               entityitem.motionY = (double)((float)world.rand.nextGaussian() * f3 + 0.2F);
                               entityitem.motionZ = (double)((float)world.rand.nextGaussian() * f3);
        
                               if (itemstack.hasTagCompound())
                               {
                                   entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
                               }
                           }
                       }
                   }
        
                   world.func_147453_f(x, y, z, block);
               }
        
               super.breakBlock(world, x, y, z, block, metadata);
           }
        
           public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitx, float hity, float hitz)
           {
               if (world.isRemote)
               {
                   return true;
               }
               else
               {
                player.openGui(ModMinecraft.instance, 0, world, x, y, z);
                   return true;
               }
           }
        }
        
        

        [font=Monaco, Consolas, Courier, monospacecreateNewTileEntity(World world, int metadata)]
        Je crois que j’ai du oublier quelque chose j’ai re vérifier une fois tout mais je n’ai pas trouver 😞

        Merci pour votre aider 😛

        Oui ce gif est drôle.

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

          Essaye quelque chose comme cela dans ton GuiHandler :

          public class GuiHandler implements IGuiHandler
          {
          @Override
          public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
          switch (ID) {
          
          case 0:
          TileEntity tile = world.getTileEntity(x, y, z);
          if(tile instanceof TileEntityAnalyzer)
          {
          return new ContainerAnalyzer((TileEntityAnalyzer)tile, player.inventory);
          }
          }
          
          return null;
          }
          
          @Override
          public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
          switch (ID) {
          
          case 0:
          TileEntity tile = world.getTileEntity(x, y, z);
          if(tile instanceof TileEntityAnalyzer)
          {
          return new GuiAnalyzer((TileEntityAnalyzer)tile, player.inventory);
          }
          }
          
          return null;
          }
          
          }
          

          Sinon, tu dis qu’il y a une erreur sur la méthode createNewTileEntity(), mais elle n’est pas trouvable dans ton code?

          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

            Sur la chaîne Youtube il y a un tutoriel sur les gui pour la 1.7.x

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

              Merci de ta réponse LaserFlip , merci robin je vais aller voir alors 😄

              Bah l’erreur j’ai l’impression d’avoir oublié quelque chose qui créer l’erreur , si je passe sur l’erreur il me propose de supprimer le @Override :s

              Oui ce gif est drôle.

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

                J’ai essayé en enlevant le @override et l’erreur disparaît cependant quand je clique rien ne se passe :S Rien ne s’ouvre etc

                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

                  public TileEntity createTileEntity(World world, int metadata)
                  C’est ça le nom de la fonction.

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

                    Ok l’erreur est enlever mais c’est hyper bizarre j’ai vraiment suivi le tuto a la lettre et tout changer , ( car j’aimerais 2 slot input et 1 output) mais rien ne s’ouvre , je met tout mais pour moi y a pas de probleme 😞

                    BlockAnalyzer

                    package mod.common.block;
                    
                    import mod.ModMinecraft;
                    import mod.common.block.entity.TileEntityAnalyzer;
                    import net.minecraft.block.Block;
                    import net.minecraft.block.material.Material;
                    import net.minecraft.entity.item.EntityItem;
                    import net.minecraft.entity.player.EntityPlayer;
                    import net.minecraft.inventory.IInventory;
                    import net.minecraft.item.ItemStack;
                    import net.minecraft.nbt.NBTTagCompound;
                    import net.minecraft.tileentity.TileEntity;
                    import net.minecraft.world.World;
                    
                    public class BlockAnalyzer extends Block
                    {
                    public BlockAnalyzer()
                    {
                      super(Material.rock); //Mettez le material qui convient
                      this.setResistance(8.0F);
                      this.setHarvestLevel("pickaxe", 2); //Outil pour casser le bloc, pour le chiffre : 0=bois, 1=pierre, 2=fer, 3=diamant
                      this.setBlockTextureName(ModMinecraft.MODID + ":analyzer.png"); //N'oubliez pas de remplacer "ModTutoriel"
                      // … Mettez les attributs complémentaires que vous voulez
                    }
                    
                    @Override
                    public TileEntity createTileEntity(World world, int metadata) //Instancie le TileEntity
                       {
                           return new TileEntityAnalyzer();
                       }
                    
                       @Override
                       public boolean hasTileEntity(int metadata) //Permet de savoir si le bloc a un TileEntity
                       {
                           return true;
                       }
                    
                       public void breakBlock(World world, int x, int y, int z, Block block, int metadata)
                       {
                           TileEntity tileentity = world.getTileEntity(x, y, z);
                    
                           if (tileentity instanceof IInventory)
                           {
                            IInventory inv = (IInventory)tileentity;
                               for (int i1 = 0; i1 < inv.getSizeInventory(); ++i1)
                               {
                                   ItemStack itemstack = inv.getStackInSlot(i1);
                    
                                   if (itemstack != null)
                                   {
                                       float f = world.rand.nextFloat() * 0.8F + 0.1F;
                                       float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
                                       EntityItem entityitem;
                    
                                       for (float f2 = world.rand.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; world.spawnEntityInWorld(entityitem))
                                       {
                                           int j1 = world.rand.nextInt(21) + 10;
                    
                                           if (j1 > itemstack.stackSize)
                                           {
                                               j1 = itemstack.stackSize;
                                           }
                    
                                           itemstack.stackSize -= j1;
                                           entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
                                           float f3 = 0.05F;
                                           entityitem.motionX = (double)((float)world.rand.nextGaussian() * f3);
                                           entityitem.motionY = (double)((float)world.rand.nextGaussian() * f3 + 0.2F);
                                           entityitem.motionZ = (double)((float)world.rand.nextGaussian() * f3);
                    
                                           if (itemstack.hasTagCompound())
                                           {
                                               entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
                                           }
                                       }
                                   }
                               }
                    
                               world.func_147453_f(x, y, z, block);
                           }
                    
                           super.breakBlock(world, x, y, z, block, metadata);
                       }
                    
                       public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitx, float hity, float hitz)
                       {
                           if (world.isRemote)
                           {
                               return true;
                           }
                           else
                           {
                            player.openGui(ModMinecraft.instance, 0, world, x, y, z);
                               return true;
                           }
                       }
                    }
                    
                    

                    AnalyzerReceipes

                    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;
                           }
                    }
                    
                    

                    BlockRegister  (J’enregistre tout mes blocks au même endroits ) 🙂

                    public class BlockRegister
                    {
                    
                       public static Block BlockBarriere;
                       public static Block BlockTronc;
                       public static Block BlockFeuille;
                       public static Block BlockPousse;
                       public static Block BlockAnalyzer;
                       public static Block BlockAmbre;
                    
                       public static void register()
                       {
                        BlockBarriere = new BlockBarriere(Material.rock).setCreativeTab(CreativeTabs.tabBlock).setBlockTextureName(ModMinecraft.MODID + ":blockBarriere");
                           BlockTronc = new BlockTronc().setBlockName("blockTronc").setCreativeTab(CreativeTabs.tabBlock).setHardness(2.0F).setBlockTextureName(ModMinecraft.MODID + ":blockTronc");
                           BlockFeuille = new BlockFeuille().setBlockName("blockFeuille").setCreativeTab(CreativeTabs.tabBlock).setHardness(0.1F).setBlockTextureName(ModMinecraft.MODID + ":blockFeuille");
                           BlockPousse = new BlockPousse().setBlockName("blockPousse").setHardness(0.5F).setBlockTextureName(ModMinecraft.MODID + ":blockPousse");
                           BlockAnalyzer = new BlockAnalyzer().setCreativeTab(CreativeTabs.tabBlock);
                           BlockAmbre = new BlockAmbre().setCreativeTab(CreativeTabs.tabBlock);
                    
                           GameRegistry.registerBlock(BlockAnalyzer, "block_analyzer");
                           GameRegistry.registerBlock(BlockBarriere, "block_barriere");
                           GameRegistry.registerBlock(BlockTronc, "block_tronc");
                           GameRegistry.registerBlock(BlockFeuille, "block_feuille");
                           GameRegistry.registerBlock(BlockPousse, "block_pousse");
                           GameRegistry.registerBlock(BlockAmbre, "block_ambre");
                    
                       }
                    }
                    

                    ContainerAnalyzer

                    package mod.common.block;
                    
                    import mod.common.block.entity.TileEntityAnalyzer;
                    import net.minecraft.entity.player.EntityPlayer;
                    import net.minecraft.entity.player.InventoryPlayer;
                    import net.minecraft.inventory.Container;
                    import net.minecraft.inventory.Slot;
                    import net.minecraft.item.ItemStack;
                    
                    public class ContainerAnalyzer extends Container {
                    
                    private TileEntityAnalyzer tileAnalyzer;
                    
                    public ContainerAnalyzer(TileEntityAnalyzer tile, InventoryPlayer inventory)
                    {
                           this.tileAnalyzer= tile;
                           this.addSlotToContainer(new Slot(tile, 0, 49, 75)); //Lancez votre jeu en debug pour calibrer vos slots
                           this.addSlotToContainer(new Slot(tile, 2, 129, 75));
                           this.addSlotToContainer(new SlotResult(tile, 3, 89, 135)); //Ici c'est un slot que j'ai créer, on le fera après
                           this.bindPlayerInventory(inventory); //Les containers ont été vus dans un tutoriel de robin, merci de d'y référer
                    }
                    
                    @Override
                    public boolean canInteractWith(EntityPlayer player) {
                    return this.tileAnalyzer.isUseableByPlayer(player);
                    }
                    
                    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));
                           }
                    }
                    
                    public ItemStack transferStackInSlot(EntityPlayer player, int quantity)
                       {
                           ItemStack itemstack = null;
                           Slot slot = (Slot)this.inventorySlots.get(quantity);
                    
                           if (slot != null && slot.getHasStack())
                           {
                               ItemStack itemstack1 = slot.getStack();
                               itemstack = itemstack1.copy();
                    
                               if (quantity < this.tileAnalyzer.getSizeInventory())
                               {
                                   if (!this.mergeItemStack(itemstack1, this.tileAnalyzer.getSizeInventory(), this.inventorySlots.size(), true))
                                   {
                                       return null;
                                   }
                               }
                               else if (!this.mergeItemStack(itemstack1, 0, this.tileAnalyzer.getSizeInventory(), false))
                               {
                                   return null;
                               }
                    
                               if (itemstack1.stackSize == 0)
                               {
                                   slot.putStack((ItemStack)null);
                               }
                               else
                               {
                                   slot.onSlotChanged();
                               }
                           }
                    
                           return itemstack;
                       }
                    
                    public void onContainerClosed(EntityPlayer player)
                       {
                           super.onContainerClosed(player);
                           this.tileAnalyzer.closeInventory();
                       }
                    }
                    
                    

                    GuiAnalyzer

                    package mod.common.block;
                    
                    import org.lwjgl.opengl.GL11;
                    
                    import mod.ModMinecraft;
                    import mod.common.block.entity.TileEntityAnalyzer;
                    import net.minecraft.client.gui.inventory.GuiContainer;
                    import net.minecraft.entity.player.InventoryPlayer;
                    import net.minecraft.inventory.IInventory;
                    import net.minecraft.util.ResourceLocation;
                    import net.minecraft.client.resources.I18n;
                    
                    public class GuiAnalyzer extends GuiContainer {
                    
                    private static final ResourceLocation texture = new ResourceLocation(ModMinecraft.MODID,"textures/gui/container/guiMachineTuto.png");
                       @SuppressWarnings("unused")
                    private TileEntityAnalyzer tileAnalyzer;
                       private IInventory playerInv;
                    
                    public GuiAnalyzer(TileEntityAnalyzer tile, InventoryPlayer inventory)
                    {
                    super(new ContainerAnalyzer(tile, inventory));
                           this.tileAnalyzer = tile;
                           this.playerInv = inventory;
                           this.allowUserInput = false;
                           this.ySize = 256;
                           this.xSize = 256;
                    }
                    
                    @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, 0, this.xSize, this.ySize);
                           this.drawTexturedModalRect(0, 0, 176, 14, 100 + 1, 16);
                    
                    }
                    
                    protected void drawGuiContainerForegroundLayer(int x, int y)
                       {
                           this.fontRendererObj.drawString(this.playerInv.hasCustomInventoryName() ? this.playerInv.getInventoryName() : I18n.format(this.playerInv.getInventoryName()), 10, this.ySize - 98, 4210752);
                       }
                    
                    }
                    
                    

                    GuiHandler

                    package mod.common.block;
                    
                    import mod.common.block.entity.TileEntityAnalyzer;
                    import net.minecraft.entity.player.EntityPlayer;
                    import net.minecraft.tileentity.TileEntity;
                    import net.minecraft.world.World;
                    import cpw.mods.fml.common.network.IGuiHandler;
                    
                    public class GuiHandler implements IGuiHandler
                    {
                    @Override
                    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
                    switch (ID) {
                    
                    case 0:
                    TileEntity tile = world.getTileEntity(x, y, z);
                    if(tile instanceof TileEntityAnalyzer)
                    {
                    return new ContainerAnalyzer((TileEntityAnalyzer)tile, player.inventory);
                    }
                    }
                    
                    return null;
                    }
                    
                    @Override
                    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
                    switch (ID) {
                    
                    case 0:
                    TileEntity tile = world.getTileEntity(x, y, z);
                    if(tile instanceof TileEntityAnalyzer)
                    {
                    return new GuiAnalyzer((TileEntityAnalyzer)tile, player.inventory);
                    }
                    }
                    
                    return null;
                    }
                    
                    }
                    

                    SlotResult

                    package mod.common.block;
                    
                    import net.minecraft.entity.player.EntityPlayer;
                    import net.minecraft.inventory.IInventory;
                    import net.minecraft.inventory.Slot;
                    import net.minecraft.item.ItemStack;
                    
                    public class SlotResult extends Slot {
                    
                    public SlotResult(IInventory inventory, int id, int x, int y)
                    {
                    super(inventory, id, x, y);
                    }
                    
                    @Override
                    public boolean isItemValid(ItemStack stack) //Interdit la pose d'items dans le slot
                       {
                           return false;
                       }
                    
                    public ItemStack decrStackSize(int amount)
                       {
                           return super.decrStackSize(amount);
                       }
                    
                    public void onPickupFromSlot(EntityPlayer player, ItemStack stack)
                       {
                           super.onCrafting(stack);
                           super.onPickupFromSlot(player, stack);
                       }
                    
                    }
                    
                    

                    TileEntityAnalyzer

                    package mod.common.block.entity;
                    
                    import mod.common.block.AnalyzerRecipes;
                    import net.minecraft.entity.player.EntityPlayer;
                    import net.minecraft.inventory.IInventory;
                    import net.minecraft.item.ItemStack;
                    import net.minecraft.nbt.NBTTagCompound;
                    import net.minecraft.nbt.NBTTagList;
                    import net.minecraft.tileentity.TileEntity;
                    
                    public class TileEntityAnalyzer extends TileEntity implements IInventory
                    {
                    private ItemStack[] contents = new ItemStack[3]; //0, 1 et 2 sont les inputs et 3 est l'output
                    
                    private int workingTime = 0; //Temps de cuisson actuel
                    private int workingTimeNeeded = 200; //Temps de cuisson nécessaire
                    
                    @Override
                       public void writeToNBT(NBTTagCompound compound)
                       {
                           super.writeToNBT(compound);
                           NBTTagList nbttaglist = new NBTTagList();
                    
                           for (int i = 0; i < this.contents.length; ++i) //pour les slots
                           {
                               if (this.contents* != null)
                               {
                                   NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                                   nbttagcompound1.setByte("Slot", (byte)i);
                                   this.contents*.writeToNBT(nbttagcompound1);
                                   nbttaglist.appendTag(nbttagcompound1);
                               }
                           }
                    
                           compound.setTag("Items", nbttaglist);
                           compound.setShort("workingTime",(short)this.workingTime); //On les enregistrent en short
                           compound.setShort("workingTimeNeeded", (short)this.workingTimeNeeded);
                       }
                    
                    @Override
                       public void readFromNBT(NBTTagCompound compound)
                       {
                           super.readFromNBT(compound);
                    
                           NBTTagList nbttaglist = compound.getTagList("Items", 10);
                           this.contents = new ItemStack[this.getSizeInventory()];
                    
                           for (int i = 0; i < nbttaglist.tagCount(); ++i) //Encore une fois pour les slots
                           {
                               NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
                               int j = nbttagcompound1.getByte("Slot") & 255;
                    
                               if (j >= 0 && j < this.contents.length)
                               {
                                   this.contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
                               }
                           }
                    
                           this.workingTime = compound.getShort("workingTime"); //On lit nos valeurs
                           this.workingTimeNeeded = compound.getShort("workingTimeNeeded");
                       }
                    
                    @Override
                    public int getSizeInventory() { //Tout est dans le nom, retourne la taille de l'inventaire, pour notre bloc c'est quatre
                    return this.contents.length;
                    }
                    
                    @Override
                    public ItemStack getStackInSlot(int slotIndex) { //Renvoie L'itemStack se trouvant dans le slot passé en argument
                    return this.contents[slotIndex];
                    }
                    
                    @Override //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;
                           }
                    }
                    
                    @Override
                    public ItemStack getStackInSlotOnClosing(int slotIndex) {
                    if (this.contents[slotIndex] != null)
                           {
                               ItemStack itemstack = this.contents[slotIndex];
                               this.contents[slotIndex] = null;
                               return itemstack;
                           }
                           else
                           {
                               return null;
                           }
                    }
                    
                    @Override
                    public void setInventorySlotContents(int slotIndex, ItemStack stack) {
                    this.contents[slotIndex] = stack;
                    
                           if (stack != null && stack.stackSize > this.getInventoryStackLimit())
                           {
                               stack.stackSize = this.getInventoryStackLimit();
                           }
                    
                           this.markDirty();
                    }
                    
                    @Override
                    public String getInventoryName() { //J'ai décider qu'on ne pouvait pas mettre de nom custom
                    return "tile.Analyzer";
                    }
                    
                    @Override
                    public boolean hasCustomInventoryName() {
                    return false;
                    }
                    
                    @Override
                    public int getInventoryStackLimit() {
                    return 64;
                    }
                    
                    @Override
                    public boolean isUseableByPlayer(EntityPlayer player) {
                    return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D;
                    }
                    
                    @Override
                    public void openInventory() {
                    
                    }
                    
                    @Override
                    public void closeInventory() {
                    
                    }
                    
                    @Override
                    public boolean isItemValidForSlot(int slot, ItemStack stack) {
                    return slot == 2 ? false : true;
                    }
                    
                    public boolean isBurning()
                       {
                           return this.workingTime > 0;
                       }
                    
                    private boolean canSmelt()
                       {
                           if (this.contents[0] == null || this.contents[1] == null) //Si les trois premiers slots sont vides
                           {
                               return false; //On ne peut pas lancer le processus
                           }
                           else
                           {
                               ItemStack itemstack = AnalyzerRecipes.smelting().getSmeltingResult(new ItemStack[]{this.contents[0], this.contents[1], this.contents[2]}); //Il y a une erreur ici, c'est normal, on y vient après (c'est pour les recettes)
                               if (itemstack == null) return false; //rapport avec les recettes
                               if (this.contents[2] == null) return true; //vérifications du slot d'output
                               if (!this.contents[2].isItemEqual(itemstack)) return false; //ici aussi
                               int result = contents[2].stackSize + itemstack.stackSize;
                               return result <= getInventoryStackLimit() && result <= this.contents[2].getMaxStackSize(); //Et là aussi décidément
                           }
                       }
                    
                    public void updateEntity() //Méthode exécutée à chaque tick
                       {
                        if(this.isBurning() && this.canSmelt()) //Si on "cuit" et que notre recette et toujours bonne, on continue
                        {
                        ++this.workingTime; //incrémentation
                        }
                        if(this.canSmelt() && !this.isBurning()) //Si la recette est bonne mais qu'elle n'est toujours pas lancée, on la lance
                        {
                        this.workingTime = 1; //La méthode isBurning() renverra true maintenant (1>0)
                        }
                        if(this.canSmelt() && this.workingTime == this.workingTimeNeeded) //Si on est arrivé au bout du temps de cuisson et que la recette est toujours bonne
                        {
                        this.smeltItem(); //on "cuit" les items
                        this.workingTime = 0; //et on réinitialise le temps de cuisson
                        }
                           if(!this.canSmelt()) //Si la recette la recette n'est plus bonne
                           {
                                  this.workingTime= 0; //le temps de cuisson est de 0
                           }
                       }
                    
                    public void smeltItem()
                       {
                           if (this.canSmelt())
                           {
                               ItemStack itemstack = AnalyzerRecipes.smelting().getSmeltingResult(new ItemStack[]{this.contents[0], this.contents[1], this.contents[2]}); //On récupère l'output de la recette
                                if (this.contents[2] == null) //Si il y a rien dans le slot d'output
                                {
                                     this.contents[2] = itemstack.copy(); //On met directement l'ItemStack
                                }
                                else if (this.contents[2].getItem() == itemstack.getItem()) //Et si l'item que l'on veut est le même que celui qu'il y a déjà
                                {
                                     this.contents[2].stackSize += itemstack.stackSize; // Alors ont incrémente l'ItemStack
                                }
                    
                                –this.contents[0].stackSize; //On décrémente les slots d'input
                                –this.contents[1].stackSize;
                    
                                if (this.contents[0].stackSize <= 0) //Si les slots sont vides, on remet à null le slot
                                {
                                    this.contents[0] = null;
                                }
                                if (this.contents[1].stackSize <= 0)
                                {
                                    this.contents[1] = null;
                                }
                    
                           }
                       }
                    }
                    
                    

                    J’ai refais le tutoriel deux fois , donc j’ai tout supprimer et refait , je n’arrive a aucune erreur , mon bloc apparait en jeux sous le nom tile.null

                    mais rien ne se passe quand je clic dessus 😕

                    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

                      Classe principale ?

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

                        package mod;
                        
                        import mod.common.CommonProxy;
                        import mod.common.block.BlockRegister;
                        import mod.common.block.entity.RegisterTileEntity;
                        import mod.common.entity.EntityRegister;
                        import mod.common.item.ItemRegister;
                        import mod.common.item.recipe.RecipeRegister;
                        import cpw.mods.fml.common.Mod;
                        import cpw.mods.fml.common.Mod.EventHandler;
                        import cpw.mods.fml.common.Mod.Instance;
                        import cpw.mods.fml.common.SidedProxy;
                        import cpw.mods.fml.common.event.FMLInitializationEvent;
                        import cpw.mods.fml.common.event.FMLPostInitializationEvent;
                        import cpw.mods.fml.common.event.FMLPreInitializationEvent;
                        import cpw.mods.fml.common.registry.GameRegistry;
                        
                        @Mod(modid = ModMinecraft.MODID, name = ModMinecraft.Name, version = ModMinecraft.Version)
                        public class ModMinecraft
                        {
                           public static final String MODID = "modminecraft";
                           public static final String Name = "Mod Minecraft";
                           public static final String Version = "1.0";
                           @Instance("modminecraft")
                           public static ModMinecraft instance;
                        
                           @SidedProxy(clientSide = "mod.client.ClientProxy", serverSide = "mod.common.CommonProxy")
                           public static CommonProxy proxy;
                        
                           @EventHandler
                           public void preInit(FMLPreInitializationEvent event)
                           {
                               BlockRegister.register();
                               ItemRegister.register();
                        
                           }
                        
                           @EventHandler
                           public void init(FMLInitializationEvent event)
                           {
                               RegisterTileEntity.register();
                               RecipeRegister.register();
                        
                               EntityRegister.register();
                        
                               proxy.registerRender();
                               proxy.registerTileEntityRender();
                           }
                        
                           @EventHandler
                           public void postInit(FMLPostInitializationEvent event)
                           {
                        
                           }
                        }
                        

                        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

                          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
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 11
                                            • 12
                                            • 2 / 12
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB