MFF

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

    UpdateTick

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    11 Messages 4 Publieurs 2.4k 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.
    • robin4002R Hors-ligne
      robin4002 Moddeurs confirmés Rédacteurs Administrateurs
      dernière édition par

      Il me semble qu’il faut ajouter setTickRandomly(true) dans le constructeur du bloc.

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

        @‘Asmath’:

        bonjour j’ai un probléme : j’ai mis la méthode UpdateTick dans la class d’un block mais rien ne se passe
        voici mon code

        package com.mathiasetampes.algorythme.common;
        
        import java.util.Random;
        
        import net.minecraft.block.Block;
        import net.minecraft.block.material.Material;
        import net.minecraft.creativetab.CreativeTabs;
        import net.minecraft.entity.item.EntityItem;
        import net.minecraft.entity.player.EntityPlayer;
        import net.minecraft.init.Blocks;
        import net.minecraft.init.Items;
        import net.minecraft.item.ItemStack;
        import net.minecraft.tileentity.TileEntity;
        import net.minecraft.util.ChatComponentTranslation;
        import net.minecraft.world.World;
        
        public class Algo extends Block
        {
        public static boolean Intermediaire = false;
        
        protected Algo(Material material)
        {
        super(material);
            this.setCreativeTab(CreativeTabs.tabBlock);
        }
           @Override
           public TileEntity createTileEntity(World world, int metadata)
           {
               return new TileEntityAire();
           }
        
           @Override
           public boolean hasTileEntity(int metadata)
           {
               return true;
           }
           public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
           {
            if(!world.isRemote)
                {
            Intermediaire = Algorythme(world ,x ,y+1 ,z );
                    TileEntity tile = world.getTileEntity(x, y, z);
                    if(tile instanceof TileEntityAire)
                    {
                    TileEntityAire.update();
                    TileEntityAire tileTuto = (TileEntityAire)tile;
                       player.addChatMessage(new ChatComponentTranslation("tile.tutoriel2.number", tileTuto.getNumber()));
                       return true;
                    }
                }
           
             return false;
           }
           
          public boolean Algorythme(World world ,int x , int y , int z)
          {  
           if((world.getBlock(x, y, z) == Blocks.air ))
        {
        for(int i = y; i < 255 ; i++)
        {
             if(world.getBlock(x, i, z) != Blocks.air)
          {
             break;  
          }  
         else if(i == 254)
         {
        return false;
         }
        }
        world.setBlock(x, y, z,algorythme.air2);
        if(Algorythme(world , x+1 ,  y ,  z)==false) return false;
            if(Algorythme(world , x-1 ,  y ,  z)==false) return false;
        if(Algorythme(world , x ,  y+1 ,  z)==false) return false;
        if(Algorythme(world , x ,  y-1 ,  z)==false) return false;
        if(Algorythme(world , x ,  y ,  z+1)==false) return false;
        if(Algorythme(world , x ,  y ,  z-1)==false){ return false; }
        return true;
        }
        return false;  
          }
         
         public void updateTick(World world, int x, int y, int z, Random random)
         {
        System.out.println("lel");
         }
        

        Ajoutes dans cette méthode super.updateTick(world, x, y, z, random);
        et dis moi tout 😉 En tout cas je fais comme ça pour mes entity avec onUpdate et onLivingUpdate et pour mes items avec onUpdate aussi

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

          @‘Julot10085’:

          @‘Asmath’:

          bonjour j’ai un probléme : j’ai mis la méthode UpdateTick dans la class d’un block mais rien ne se passe
          voici mon code

          package com.mathiasetampes.algorythme.common;
          
          import java.util.Random;
          
          import net.minecraft.block.Block;
          import net.minecraft.block.material.Material;
          import net.minecraft.creativetab.CreativeTabs;
          import net.minecraft.entity.item.EntityItem;
          import net.minecraft.entity.player.EntityPlayer;
          import net.minecraft.init.Blocks;
          import net.minecraft.init.Items;
          import net.minecraft.item.ItemStack;
          import net.minecraft.tileentity.TileEntity;
          import net.minecraft.util.ChatComponentTranslation;
          import net.minecraft.world.World;
          
          public class Algo extends Block
          {
          public static boolean Intermediaire = false;
          
          protected Algo(Material material)
          {
          super(material);
              this.setCreativeTab(CreativeTabs.tabBlock);
          }
             @Override
             public TileEntity createTileEntity(World world, int metadata)
             {
                 return new TileEntityAire();
             }
          
             @Override
             public boolean hasTileEntity(int metadata)
             {
                 return true;
             }
             public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
             {
              if(!world.isRemote)
                  {
              Intermediaire = Algorythme(world ,x ,y+1 ,z );
                      TileEntity tile = world.getTileEntity(x, y, z);
                      if(tile instanceof TileEntityAire)
                      {
                      TileEntityAire.update();
                      TileEntityAire tileTuto = (TileEntityAire)tile;
                         player.addChatMessage(new ChatComponentTranslation("tile.tutoriel2.number", tileTuto.getNumber()));
                         return true;
                      }
                  }
             
               return false;
             }
             
            public boolean Algorythme(World world ,int x , int y , int z)
            {  
             if((world.getBlock(x, y, z) == Blocks.air ))
          {
          for(int i = y; i < 255 ; i++)
          {
               if(world.getBlock(x, i, z) != Blocks.air)
            {
               break;  
            }  
           else if(i == 254)
           {
          return false;
           }
          }
          world.setBlock(x, y, z,algorythme.air2);
          if(Algorythme(world , x+1 ,  y ,  z)==false) return false;
              if(Algorythme(world , x-1 ,  y ,  z)==false) return false;
          if(Algorythme(world , x ,  y+1 ,  z)==false) return false;
          if(Algorythme(world , x ,  y-1 ,  z)==false) return false;
          if(Algorythme(world , x ,  y ,  z+1)==false) return false;
          if(Algorythme(world , x ,  y ,  z-1)==false){ return false; }
          return true;
          }
          return false;  
            }
           
           public void updateTick(World world, int x, int y, int z, Random random)
           {
          System.out.println("lel");
           }
          

          Ajoutes dans cette méthode super.updateTick(world, x, y, z, random);
          et dis moi tout 😉 En tout cas je fais comme ça pour mes entity avec onUpdate et onLivingUpdate et pour mes items avec onUpdate aussi

          Le problème étant que ce n’est pas une entitée.

          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

            @‘SCAREX’:

            @‘Julot10085’:

            @‘Asmath’:

            bonjour j’ai un probléme : j’ai mis la méthode UpdateTick dans la class d’un block mais rien ne se passe
            voici mon code

            package com.mathiasetampes.algorythme.common;
            
            import java.util.Random;
            
            import net.minecraft.block.Block;
            import net.minecraft.block.material.Material;
            import net.minecraft.creativetab.CreativeTabs;
            import net.minecraft.entity.item.EntityItem;
            import net.minecraft.entity.player.EntityPlayer;
            import net.minecraft.init.Blocks;
            import net.minecraft.init.Items;
            import net.minecraft.item.ItemStack;
            import net.minecraft.tileentity.TileEntity;
            import net.minecraft.util.ChatComponentTranslation;
            import net.minecraft.world.World;
            
            public class Algo extends Block
            {
            public static boolean Intermediaire = false;
            
            protected Algo(Material material)
            {
            super(material);
                this.setCreativeTab(CreativeTabs.tabBlock);
            }
               @Override
               public TileEntity createTileEntity(World world, int metadata)
               {
                   return new TileEntityAire();
               }
            
               @Override
               public boolean hasTileEntity(int metadata)
               {
                   return true;
               }
               public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
               {
                if(!world.isRemote)
                    {
                Intermediaire = Algorythme(world ,x ,y+1 ,z );
                        TileEntity tile = world.getTileEntity(x, y, z);
                        if(tile instanceof TileEntityAire)
                        {
                        TileEntityAire.update();
                        TileEntityAire tileTuto = (TileEntityAire)tile;
                           player.addChatMessage(new ChatComponentTranslation("tile.tutoriel2.number", tileTuto.getNumber()));
                           return true;
                        }
                    }
               
                 return false;
               }
               
              public boolean Algorythme(World world ,int x , int y , int z)
              {  
               if((world.getBlock(x, y, z) == Blocks.air ))
            {
            for(int i = y; i < 255 ; i++)
            {
                 if(world.getBlock(x, i, z) != Blocks.air)
              {
                 break;  
              }  
             else if(i == 254)
             {
            return false;
             }
            }
            world.setBlock(x, y, z,algorythme.air2);
            if(Algorythme(world , x+1 ,  y ,  z)==false) return false;
                if(Algorythme(world , x-1 ,  y ,  z)==false) return false;
            if(Algorythme(world , x ,  y+1 ,  z)==false) return false;
            if(Algorythme(world , x ,  y-1 ,  z)==false) return false;
            if(Algorythme(world , x ,  y ,  z+1)==false) return false;
            if(Algorythme(world , x ,  y ,  z-1)==false){ return false; }
            return true;
            }
            return false;  
              }
             
             public void updateTick(World world, int x, int y, int z, Random random)
             {
            System.out.println("lel");
             }
            

            Ajoutes dans cette méthode super.updateTick(world, x, y, z, random);
            et dis moi tout 😉 En tout cas je fais comme ça pour mes entity avec onUpdate et onLivingUpdate et pour mes items avec onUpdate aussi

            Le problème étant que ce n’est pas une entitée.

            Oui mais c’est une méthode qui s’update comme ce que je viens de citer dans mon message précédent :
            @‘Julot10085’:

            mes entity avec** onUpdate **et **onLivingUpdate **et pour mes items avec onUpdate aussi

            EDIT : Autant pour moi je pensais que ça marcherait.

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

              çà ne marche pas

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

                @‘Asmath’:

                çà ne marche pas

                Que veux-tu faire avec ? Je ne comprends pas vraiment. Si tu veux, il y a la fonction onNeighborChange qui est appelé dès qu’un bloc adjacent le met à jour.

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

                  je suis stupide vraiment je viens de m’appercevoir que cette commande devais ce trouvés dans le tileEntity et donc çà marche

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

                    en fait je cherche à faire une méthode qui test des condition comme par exemple si le bloc à tel coordonnées est de l’air et cela en permanence pour pouvoir faire les actions en conséquence quasi instantanément donc il faudrait faire une méthode qui s’active à chaque tick ou au moins 2 fois par seconde

                    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

                      Je remet dans non résolu alors ?
                      La fonction onUpdate des tile entity est mit à jour à chaque tick (donc 20 fois / secondes)

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

                        non laisse dans dans résolu c’est bon je n’avais pas vue ton message et maintenant çà marche merci

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

                        MINECRAFT FORGE FRANCE © 2024

                        Powered by NodeBB