MFF

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

    Challenge - Pièce fermée

    Planifier Épinglé Verrouillé Déplacé Concours
    31 Messages 7 Publieurs 1.7k 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.
    • sosohS Hors-ligne
      sosoh
      dernière édition par

      La RAM du Pc xD x)

      Developpeur d'Hogsmod, un mod implémentant le Monde d'Harry Potter dans Minecraft!

      1 réponse Dernière réponse Répondre Citer 0
      • RedRelayR Hors-ligne
        RedRelay Moddeurs confirmés
        dernière édition par

        Tu n’es pas obliger de tous les charger en même temps.
        Lorsque tu as check tout les chunk adjacent du chunk A, tu peux décharger le chunk A.
        Il faudrait vraiment un nombre gigantesque de chunk pour que la RAM sature.

        –------------------------------------------------------------------------------------
        Si tu trouves mon intervention pertinente, n'hésite pas a m…

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

          @‘Blackout’:

          Tu n’es pas obliger de tous les charger en même temps.
          Lorsque tu as check tout les chunk adjacent du chunk A, tu peux décharger le chunk A.
          Il faudrait vraiment un nombre gigantesque de chunk pour que la RAM sature.

          As-tu déjà essayé de générer des chunks ? Si oui, tu devrais savoir que ça prend une quantité de RAM folle, de plus, il faudra désynchroniser le code dans un tick handler ou ça fera crasher ton serveur.

          Ensuite, moi je pense qu’une pièce de 310^(9) par 256 par 310^(9) est une pièce ouverte.

          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
          • RedRelayR Hors-ligne
            RedRelay Moddeurs confirmés
            dernière édition par

            Si les chunks n’ont toujours pas été généré, c’est considéré comme du vide, donc pièce ouverte 😉
            Tu peux faire le traitement avec seulement 5 chunks chargé a la fois, il suffit de décharger ceux qui ne servent plus pour le calcul.
            Aucunement besoin de créer un tick handler, il suffit de lancer le traitement dans un nouveau thread et de protéger les accès concurrentiel le mieux possible.

            Mais bon dans la grande majeure partie des cas, les salles ne seront jamais aussi grande.
            Le but est de faire un système qui n’est pas limité par la taille, mais par les performance de la machine et avec un algorithme optimisé.

            –------------------------------------------------------------------------------------
            Si tu trouves mon intervention pertinente, n'hésite pas a m…

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

              @‘Blackout’:

              Si les chunks n’ont toujours pas été généré, c’est considéré comme du vide, donc pièce ouverte 😉
              Tu peux faire le traitement avec seulement 5 chunks chargé a la fois, il suffit de décharger ceux qui ne servent plus pour le calcul.
              Aucunement besoin de créer un tick handler, il suffit de lancer le traitement dans un nouveau thread et de protéger les accès concurrentiel le mieux possible.

              Mais bon dans la grande majeure partie des cas, les salles ne seront jamais aussi grande.
              Le but est de faire un système qui n’est pas limité par la taille, mais par les performance de la machine et avec un algorithme optimisé.

              J’ai fait quelques essais et il s’avère que lorsque l’on appelle la méthode getBlockState (je code en 1.8) dans la classe World cette méthode va automatiquement charger/générer les chunks donc j’aimerais savoir quoi faire lorsque le chunk n’est pas chargé, soit charger le chunk et continuer l’algorithme ou considérer la pièce comme ouverte ?

              A part ce dernier problème, tout avance comme il faut pour l’instant 😉 .

              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

                bonjour j’annonce que je vais moi aussi rentrer dans la compétition et petit précision s’il vous plait : le block sera t’il au sol , dans le sol ou à n’importe quel endroit de la piece. sinon juste une question cet algorythme est pour le mod settlements non ?


                le code avance bien mais j’ai un petit problème : étant donne qu’il faut testé les block un seule fois j’ai recourd à un tableau , probleme , si j’ai recours à un tableau il faut qu’il soit individuelle a chaque block car sinon si je met deux block dans la meme piece il n’y en aura qu’un qui fonctionnera . donc précise : le code appartiendra a un block à part entiere ou ce code fera partis d’un autre block qui testera tout les block pour connaitre les piece .

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

                  Bah comment qu’il fonctionne l’Airlock de Galacticraft? 😄

                  Mes mods :

                  • Cookie Ore (1.7.10)

                  Mod en cours : **E…

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

                    j’en sais rien mais moi j’ai fini la chose en partant du principe qu’une piece de 320 par je ne sais combien par 320 était un piece ouverte du coup pas besoin de charger les chunk

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

                      j’en sais rien mais moi j’ai fini contacter moi par mp 😛

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

                        bon apres environ 1 mois d’attente je poste le code
                        :::
                        classe principlale

                        package com.mathiasetampes.algorythme.common;
                        
                        import net.minecraft.block.Block;
                        import net.minecraft.block.material.Material;
                        import net.minecraftforge.common.MinecraftForge;
                        import com.mathiasetampes.algorythme.proxy.CommonProxy;
                        import cpw.mods.fml.common.FMLCommonHandler;
                        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 = "algorythme",name="Algorytme",version="1.0.0")
                        
                        public class algorythme
                        {
                        
                        @Instance("algorythme")
                        public static algorythme instance;
                        public static final String MODID = "villagePNJ";
                        
                        @SidedProxy(clientSide = "com.mathiasetampes.algorythme.proxy.ClientProxy", serverSide = "com.mathiasetampes.algorythme.proxy.CommonProxy")
                        public static CommonProxy proxy;
                        public static Block algo;
                        
                        @EventHandler
                        public void preInit(FMLPreInitializationEvent event)
                        {
                        algo = new Algo(Material.rock).setBlockName("Algo").setBlockTextureName("modtutoriel:block_tutoriel");
                        GameRegistry.registerBlock(algo, "block_tutoriel");
                               GameRegistry.registerTileEntity(TileEntityAire.class, "algorythme:TileEntityAire");
                        }
                        
                        @EventHandler
                        public void init(FMLInitializationEvent event)
                        {
                        proxy.registerRender();
                        FMLCommonHandler.instance().bus().register(new AllEvent());
                        MinecraftForge.EVENT_BUS.register(new AllEvent());
                        }
                        
                        @EventHandler
                        public void postInit(FMLPostInitializationEvent event)
                        {
                        
                        }
                        }
                        

                        classe du block

                        package com.mathiasetampes.algorythme.common;
                        
                        import java.util.Random;
                        import com.mojang.realmsclient.dto.PlayerInfo;
                        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 int Intermediaire = 0;
                        public String marqueur[][][] = new String[320][256][320];
                        public int xDepart,zDepart = 0 ;
                        public boolean Interieur,Erreur = false;
                        public EntityPlayer playerV;
                        
                        protected Algo(Material material)
                        {
                        super(material);
                            this.setCreativeTab(CreativeTabs.tabBlock);
                            this.setTickRandomly(true);
                            for(int i = 0; i< 320; i++)
                            {
                           for(int j = 0; j< 256; j++)
                           {
                           for(int k = 0; k< 320; k++)
                           {
                           marqueur*[j][k] = "";
                           }
                           }
                            }
                        }
                        public void updateTick(World world, int x, int y, int z, Random random ) //
                           {
                        world.scheduleBlockUpdate(x, y, z, algorythme.algo, 120);
                        if((Intermediaire==15 || Intermediaire==25)&& Erreur==true)
                        {
                          AlgorythmeVide(world ,x , y , z,x , y , z);
                          Erreur = false;
                        }
                        else if(Interieur == true && marqueur[xDepart-playerV.getPlayerCoordinates().posX+160][playerV.getPlayerCoordinates().posY][zDepart-playerV.getPlayerCoordinates().posZ+160].contains(Ids(world,x,y,z))==false &&(Intermediaire!=15 && Intermediaire!=25))//Ids(world,x,y,z)
                            {
                              Interieur = false ;
                              System.out.println(playerV.getPlayerCoordinates().posX);
                              playerV.addChatMessage(new ChatComponentTranslation("tile.chat.1"));
                              AlgorythmeVide(world ,  x , y , z ,x,y,z);
                            }
                           }
                         @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)
                                {
                                xDepart = x;
                            zDepart = z;
                            Intermediaire = Algorythme(world ,x ,y ,z,x , y , z);
                            playerV = player;
                                    if(Intermediaire==5){player.addChatMessage(new ChatComponentTranslation("tile.chat.2"));}
                                    else if(Intermediaire==25){player.addChatMessage(new ChatComponentTranslation("tile.chat.3"));}
                                    else if(Intermediaire==35){player.addChatMessage(new ChatComponentTranslation("tile.chat.4"));}
                                    else if(Intermediaire==15){player.addChatMessage(new ChatComponentTranslation("tile.chat.5"));}
                                    return true;    
                                }    
                             return false;
                           }
                        
                         public int Algorythme(World world ,int x , int y , int z,int xSrc,int ySrc,int zSrc)
                          {  
                           if(xDepart-x+160<320 && xDepart-x+160 > 0 && zDepart-z+160<320 && zDepart-z+160 > 0)
                           {
                           if((world.getBlock(x, y, z) == Blocks.air || world.getBlock(x, y, z) == algorythme.algo)&& marqueur[xDepart-x+160][y][zDepart-z+160].contains(Ids(world,xSrc,ySrc,zSrc))== false)
                        {
                        for(int i = y; i < 256 ; i++)
                        {
                             if(world.getBlock(x, i, z) != Blocks.air && world.getBlock(x, i, z) != algorythme.algo)
                          {
                            break;  
                          }  
                         if(i == 254)
                         {
                        Erreur = true ;
                        System.out.println("extérieur");
                        return 25;
                         }
                        }
                        marqueur[xDepart-x+160][y][zDepart-z+160]=marqueur[xDepart-x+160][y][zDepart-z+160]+Ids(world ,xSrc, ySrc , zSrc);
                            System.out.println("x="+x+" y="+y+" z="+z );
                        if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc)==25){return 25;} else if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc )==15){return 15;}
                            if(Algorythme(world , x ,  y+1 ,  z,xSrc ,  ySrc ,  zSrc)==25){return 25;} else if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc )==15){return 15;}
                        if(Algorythme(world , x+1 ,  y ,  z,xSrc ,  ySrc ,  zSrc)==25){return 25;} else if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc )==15){return 15;}
                            if(Algorythme(world , x-1 ,  y ,  z,xSrc ,  ySrc ,  zSrc)==25){return 25;} else if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc )==15){return 15;}
                        if(Algorythme(world , x ,  y ,  z+1,xSrc ,  ySrc ,  zSrc)==25){return 25;} else if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc )==15){return 15;}
                        if(Algorythme(world , x ,  y ,  z-1,xSrc ,  ySrc ,  zSrc)==25){return 25;} else if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc )==15){return 15;}
                        Interieur = true ;
                        return 5;
                        }
                        Erreur = true ;
                        return 35;
                          }
                           return 15;
                         }
                         public void AlgorythmeVide(World world ,int x , int y , int z,int xSrc,int ySrc,int zSrc)
                         {  
                          if((world.getBlock(x, y, z) == Blocks.air || world.getBlock(x, y, z) == algorythme.algo)&& marqueur[xDepart-x+160][y][zDepart-z+160].contains(Ids(world,xSrc,ySrc,zSrc))== true)
                        {
                        marqueur[xDepart-x+160][y][zDepart-z+160] = marqueur[xDepart-x+160][y][zDepart-z+160].replace(Ids(world ,xSrc, ySrc , zSrc) ,""); //peut etre un bug à cause de Ids qui est un string et non un cahr sequence
                        AlgorythmeVide(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc);
                            AlgorythmeVide(world , x ,  y+1 ,  z,xSrc ,  ySrc ,  zSrc);
                        AlgorythmeVide(world , x+1 ,  y ,  z,xSrc ,  ySrc ,  zSrc);
                            AlgorythmeVide(world , x-1 ,  y ,  z,xSrc ,  ySrc ,  zSrc);
                        AlgorythmeVide(world , x ,  y ,  z+1,xSrc ,  ySrc ,  zSrc);
                        AlgorythmeVide(world , x ,  y ,  z-1,xSrc ,  ySrc ,  zSrc);
                        
                        return;
                        }
                        return;
                        }
                           public void onBlockAdded(World world, int x, int y, int z)
                        {
                        super.onBlockAdded(world, x, y, z);
                        world.scheduleBlockUpdate(x, y, z, algorythme.algo, 15);
                        }
                           public String Ids(World world , int x ,int y ,int z)
                           {
                            TileEntity te = world.getTileEntity(x, y, z); // Obtient le tile entité du bloc
                        if(te instanceof TileEntityAire)
                         {
                          TileEntityAire tileTuto = (TileEntityAire)te;
                          return ","+tileTuto.getIdsString();
                         }
                        return "";
                           }
                        }
                        

                        classe de la tileEntity

                        package com.mathiasetampes.algorythme.common;
                        
                        import net.minecraft.nbt.NBTTagCompound;
                        import net.minecraft.tileentity.TileEntity;
                        
                        public class TileEntityAire extends TileEntity
                        {
                        public int ids;
                        public String str = "";
                        
                        @Override
                           public void readFromNBT(NBTTagCompound compound)
                           {
                               super.readFromNBT(compound);
                               this.ids = compound.getInteger("Ids");
                           }
                        
                           @Override
                           public void writeToNBT(NBTTagCompound compound)
                           {
                               super.writeToNBT(compound);
                               compound.setInteger("Ids", this.ids);
                           }
                           public void UpIds(int i)
                           {
                            this.ids=i;
                            return;
                           }
                           public int getIds()
                           {
                            return this.ids;
                           }
                           public String getIdsString()
                           {
                            str="";
                            str=str+ids;
                            return this.str;
                           }
                        }
                        

                        classe des events

                        package com.mathiasetampes.algorythme.common;
                        
                        import cpw.mods.fml.common.eventhandler.SubscribeEvent;
                        import cpw.mods.fml.common.gameevent.TickEvent;
                        import net.minecraft.block.Block;
                        import net.minecraft.tileentity.TileEntity;
                        import net.minecraftforge.event.entity.EntityJoinWorldEvent;
                        import net.minecraftforge.event.world.BlockEvent;
                        import net.minecraftforge.event.world.BlockEvent.PlaceEvent;
                        
                        public class AllEvent
                        {
                           int TabIds[] = new int[50];
                        @SubscribeEvent
                        public void PlaceEvent(PlaceEvent event)
                        {
                            TileEntity te = event.world.getTileEntity(event.x, event.y, event.z); // Obtient le tile entité du bloc
                            if(te instanceof TileEntityAire)
                            {
                            for(int i = 0;i<50;i++)
                             {
                            TileEntityAire tileTuto = (TileEntityAire)te;
                            if(TabIds*!=1)
                            {
                                tileTuto.UpIds(i);
                                TabIds* = 1;
                                break;
                            }
                             }
                            }
                        }
                        public void BreakEvent(BlockEvent.BreakEvent event)
                        {
                        TileEntity te = event.world.getTileEntity(event.x, event.y, event.z); // Obtient le tile entité du bloc
                            if(te instanceof TileEntityAire)
                            {
                             TileEntityAire tileTuto = (TileEntityAire)te;
                             TabIds[tileTuto.getIds()] = 0;
                            }
                        }
                        }
                        

                        :::

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

                          @‘Asmath’:

                          bon apres environ 1 mois d’attente je poste le code

                          :::
                          classe principlale

                          package com.mathiasetampes.algorythme.common;
                          
                          import net.minecraft.block.Block;
                          import net.minecraft.block.material.Material;
                          import net.minecraftforge.common.MinecraftForge;
                          import com.mathiasetampes.algorythme.proxy.CommonProxy;
                          import cpw.mods.fml.common.FMLCommonHandler;
                          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 = "algorythme",name="Algorytme",version="1.0.0")
                          
                          public class algorythme
                          {
                          
                          @Instance("algorythme")
                          public static algorythme instance;
                          public static final String MODID = "villagePNJ";
                          
                          @SidedProxy(clientSide = "com.mathiasetampes.algorythme.proxy.ClientProxy", serverSide = "com.mathiasetampes.algorythme.proxy.CommonProxy")
                          public static CommonProxy proxy;
                          public static Block algo;
                          
                          @EventHandler
                          public void preInit(FMLPreInitializationEvent event)
                          {
                          algo = new Algo(Material.rock).setBlockName("Algo").setBlockTextureName("modtutoriel:block_tutoriel");
                          GameRegistry.registerBlock(algo, "block_tutoriel");
                                 GameRegistry.registerTileEntity(TileEntityAire.class, "algorythme:TileEntityAire");
                          }
                          
                          @EventHandler
                          public void init(FMLInitializationEvent event)
                          {
                          proxy.registerRender();
                          FMLCommonHandler.instance().bus().register(new AllEvent());
                          MinecraftForge.EVENT_BUS.register(new AllEvent());
                          }
                          
                          @EventHandler
                          public void postInit(FMLPostInitializationEvent event)
                          {
                          
                          }
                          }
                          

                          classe du block

                          package com.mathiasetampes.algorythme.common;
                          
                          import java.util.Random;
                          import com.mojang.realmsclient.dto.PlayerInfo;
                          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 int Intermediaire = 0;
                          public String marqueur[][][] = new String[320][256][320];
                          public int xDepart,zDepart = 0 ;
                          public boolean Interieur,Erreur = false;
                          public EntityPlayer playerV;
                          
                          protected Algo(Material material)
                          {
                          super(material);
                              this.setCreativeTab(CreativeTabs.tabBlock);
                              this.setTickRandomly(true);
                              for(int i = 0; i< 320; i++)
                              {
                             for(int j = 0; j< 256; j++)
                             {
                             for(int k = 0; k< 320; k++)
                             {
                             marqueur*[j][k] = "";
                             }
                             }
                              }
                          }
                          public void updateTick(World world, int x, int y, int z, Random random ) //
                             {
                          world.scheduleBlockUpdate(x, y, z, algorythme.algo, 120);
                          if((Intermediaire==15 || Intermediaire==25)&& Erreur==true)
                          {
                            AlgorythmeVide(world ,x , y , z,x , y , z);
                            Erreur = false;
                          }
                          else if(Interieur == true && marqueur[xDepart-playerV.getPlayerCoordinates().posX+160][playerV.getPlayerCoordinates().posY][zDepart-playerV.getPlayerCoordinates().posZ+160].contains(Ids(world,x,y,z))==false &&(Intermediaire!=15 && Intermediaire!=25))//Ids(world,x,y,z)
                              {
                                Interieur = false ;
                                System.out.println(playerV.getPlayerCoordinates().posX);
                                playerV.addChatMessage(new ChatComponentTranslation("tile.chat.1"));
                                AlgorythmeVide(world ,  x , y , z ,x,y,z);
                              }
                             }
                           @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)
                                  {
                                  xDepart = x;
                              zDepart = z;
                              Intermediaire = Algorythme(world ,x ,y ,z,x , y , z);
                              playerV = player;
                                      if(Intermediaire==5){player.addChatMessage(new ChatComponentTranslation("tile.chat.2"));}
                                      else if(Intermediaire==25){player.addChatMessage(new ChatComponentTranslation("tile.chat.3"));}
                                      else if(Intermediaire==35){player.addChatMessage(new ChatComponentTranslation("tile.chat.4"));}
                                      else if(Intermediaire==15){player.addChatMessage(new ChatComponentTranslation("tile.chat.5"));}
                                      return true;    
                                  }    
                               return false;
                             }
                             
                           public int Algorythme(World world ,int x , int y , int z,int xSrc,int ySrc,int zSrc)
                            {  
                             if(xDepart-x+160<320 && xDepart-x+160 > 0 && zDepart-z+160<320 && zDepart-z+160 > 0)
                             {
                             if((world.getBlock(x, y, z) == Blocks.air || world.getBlock(x, y, z) == algorythme.algo)&& marqueur[xDepart-x+160][y][zDepart-z+160].contains(Ids(world,xSrc,ySrc,zSrc))== false)
                          {
                          for(int i = y; i < 256 ; i++)
                          {
                               if(world.getBlock(x, i, z) != Blocks.air && world.getBlock(x, i, z) != algorythme.algo)
                            {
                              break;  
                            }  
                           if(i == 254)
                           {
                          Erreur = true ;
                          System.out.println("extérieur");
                          return 25;
                           }
                          }
                          marqueur[xDepart-x+160][y][zDepart-z+160]=marqueur[xDepart-x+160][y][zDepart-z+160]+Ids(world ,xSrc, ySrc , zSrc);
                              System.out.println("x="+x+" y="+y+" z="+z );
                          if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc)==25){return 25;} else if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc )==15){return 15;}
                              if(Algorythme(world , x ,  y+1 ,  z,xSrc ,  ySrc ,  zSrc)==25){return 25;} else if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc )==15){return 15;}
                          if(Algorythme(world , x+1 ,  y ,  z,xSrc ,  ySrc ,  zSrc)==25){return 25;} else if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc )==15){return 15;}
                              if(Algorythme(world , x-1 ,  y ,  z,xSrc ,  ySrc ,  zSrc)==25){return 25;} else if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc )==15){return 15;}
                          if(Algorythme(world , x ,  y ,  z+1,xSrc ,  ySrc ,  zSrc)==25){return 25;} else if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc )==15){return 15;}
                          if(Algorythme(world , x ,  y ,  z-1,xSrc ,  ySrc ,  zSrc)==25){return 25;} else if(Algorythme(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc )==15){return 15;}
                          Interieur = true ;
                          return 5;
                          }
                          Erreur = true ;
                          return 35;
                            }
                             return 15;
                           }
                           public void AlgorythmeVide(World world ,int x , int y , int z,int xSrc,int ySrc,int zSrc)
                           {  
                            if((world.getBlock(x, y, z) == Blocks.air || world.getBlock(x, y, z) == algorythme.algo)&& marqueur[xDepart-x+160][y][zDepart-z+160].contains(Ids(world,xSrc,ySrc,zSrc))== true)
                          {
                          marqueur[xDepart-x+160][y][zDepart-z+160] = marqueur[xDepart-x+160][y][zDepart-z+160].replace(Ids(world ,xSrc, ySrc , zSrc) ,""); //peut etre un bug à cause de Ids qui est un string et non un cahr sequence
                          AlgorythmeVide(world , x ,  y-1 ,  z,xSrc ,  ySrc ,  zSrc);
                              AlgorythmeVide(world , x ,  y+1 ,  z,xSrc ,  ySrc ,  zSrc);
                          AlgorythmeVide(world , x+1 ,  y ,  z,xSrc ,  ySrc ,  zSrc);
                              AlgorythmeVide(world , x-1 ,  y ,  z,xSrc ,  ySrc ,  zSrc);
                          AlgorythmeVide(world , x ,  y ,  z+1,xSrc ,  ySrc ,  zSrc);
                          AlgorythmeVide(world , x ,  y ,  z-1,xSrc ,  ySrc ,  zSrc);
                          
                          return;
                          }
                          return;
                          }
                             public void onBlockAdded(World world, int x, int y, int z)
                          {
                          super.onBlockAdded(world, x, y, z);
                          world.scheduleBlockUpdate(x, y, z, algorythme.algo, 15);
                          }
                             public String Ids(World world , int x ,int y ,int z)
                             {
                              TileEntity te = world.getTileEntity(x, y, z); // Obtient le tile entité du bloc
                          if(te instanceof TileEntityAire)
                           {
                            TileEntityAire tileTuto = (TileEntityAire)te;
                            return ","+tileTuto.getIdsString();
                           }
                          return "";
                             }
                          }
                          

                          classe de la tileEntity

                          package com.mathiasetampes.algorythme.common;
                          
                          import net.minecraft.nbt.NBTTagCompound;
                          import net.minecraft.tileentity.TileEntity;
                          
                          public class TileEntityAire extends TileEntity
                          {
                          public int ids;
                          public String str = "";
                          
                          @Override
                             public void readFromNBT(NBTTagCompound compound)
                             {
                                 super.readFromNBT(compound);
                                 this.ids = compound.getInteger("Ids");
                             }
                          
                             @Override
                             public void writeToNBT(NBTTagCompound compound)
                             {
                                 super.writeToNBT(compound);
                                 compound.setInteger("Ids", this.ids);
                             }
                             public void UpIds(int i)
                             {
                              this.ids=i;
                              return;
                             }
                             public int getIds()
                             {
                              return this.ids;
                             }
                             public String getIdsString()
                             {
                              str="";
                              str=str+ids;
                              return this.str;
                             }
                          }
                          

                          classe des events

                          package com.mathiasetampes.algorythme.common;
                          
                          import cpw.mods.fml.common.eventhandler.SubscribeEvent;
                          import cpw.mods.fml.common.gameevent.TickEvent;
                          import net.minecraft.block.Block;
                          import net.minecraft.tileentity.TileEntity;
                          import net.minecraftforge.event.entity.EntityJoinWorldEvent;
                          import net.minecraftforge.event.world.BlockEvent;
                          import net.minecraftforge.event.world.BlockEvent.PlaceEvent;
                          
                          public class AllEvent
                          {
                             int TabIds[] = new int[50];
                          @SubscribeEvent
                          public void PlaceEvent(PlaceEvent event)
                          {
                              TileEntity te = event.world.getTileEntity(event.x, event.y, event.z); // Obtient le tile entité du bloc
                              if(te instanceof TileEntityAire)
                              {
                              for(int i = 0;i<50;i++)
                               {
                              TileEntityAire tileTuto = (TileEntityAire)te;
                              if(TabIds*!=1)
                              {
                                  tileTuto.UpIds(i);
                                  TabIds* = 1;
                                  break;
                              }
                               }
                              }
                          }
                          public void BreakEvent(BlockEvent.BreakEvent event)
                          {
                          TileEntity te = event.world.getTileEntity(event.x, event.y, event.z); // Obtient le tile entité du bloc
                              if(te instanceof TileEntityAire)
                              {
                               TileEntityAire tileTuto = (TileEntityAire)te;
                               TabIds[tileTuto.getIds()] = 0;
                              }
                          }
                          }
                          

                          :::

                          Désolé de dire çà mais c’est l’un des codes les moins propres que j’ai jamais vu ! (“on recherche la propreté du code”)
                          De plus je suis pas sûr que on code respecte les consignes : “Non aucune taille limite” or si j’ai bien compris ton code (ce qui n’est pas sûr), ton code est limité par ton array de string (new String[320][256][320]).

                          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

                            oui la taille est limiter par l’array de mon string mais franchement une maison de 320 sur 320 c’est pas une maison apres on peut augmenter mais tu lagueras et pour la propreté je travaille dessus mais c’est pas ma spécialité la propreté :s

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

                              @‘Asmath’:

                              oui la taille est limiter par l’array de mon string mais franchement une maison de 320 sur 320  c’est pas une maison apres on peut augmenter mais tu lagueras et pour la propreté je travaille dessus mais c’est pas ma spécialité la propreté :s

                              D’après ce que j’ai vu, le plus gros problème étant que tu ne respectes pas la convention java, le second étant que if (boolean == true) est la même chose que if(boolean) et if (boolean == false) est égal à if (!boolean)

                              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

                                meric de cette aide precieuse

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

                                  @‘Asmath’:

                                  meric de cette aide precieuse

                                  pour la convention java :
                                  -les variables commencent par une minuscule;
                                  -les fonctions commencent par une minuscule;
                                  -les classe par une majuscule.
                                  mais chez toi, des fois les variables commencent par une minuscule, des fois par une majuscule, même chose pour les méthodes.

                                  <<dois-je mettre=“” une=“” majuscule=“” ?<br=“”>-Random.nextBoolean()
                                  -ah ok>></dois-je>

                                  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

                                    sinon si tu veux le block pour un mod tu peut aller ici https://www.youtube.com/watch?v=23rTg1eRoYM

                                    1 réponse Dernière réponse Répondre Citer 0
                                    • RedRelayR Hors-ligne
                                      RedRelay Moddeurs confirmés
                                      dernière édition par

                                      Dsl de cette réponse tardive, j’ai très peu de temps en ce moment 😕
                                      Comme l’a dit Scarex, il ne doit pas y avoir de limite. Ensuite rien qu’a première vu, ton code a quelques soucis.
                                      Un bloc ne doit pas avoir d’attribut xDepart, vu qu’il n’y a qu’une seule instance de la classe Block chargé en mémoire.

                                      Concernant le bloc de départ, il peut se trouver n’importe ou.
                                      Pour le mod settlement, c’était prévu a long long terme d’y incorporer un algo de la sorte.

                                      –------------------------------------------------------------------------------------
                                      Si tu trouves mon intervention pertinente, n'hésite pas a m…

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

                                        d’accord avec un amis qui programme je suis en train de faire un seconde version du mod plus propre et plus efficace pour les limites je suis encore en train de reflechir mais il me faut une confirmtion : droit ou non d’utiliser un fichier texte pour stoker l’information

                                        1 réponse Dernière réponse Répondre Citer 0
                                        • RedRelayR Hors-ligne
                                          RedRelay Moddeurs confirmés
                                          dernière édition par

                                          Oui tu as le droit d’utiliser le disque dur, mais le fichier texte, a mon avis ce n’est pas le plus efficace.

                                          –------------------------------------------------------------------------------------
                                          Si tu trouves mon intervention pertinente, n'hésite pas a m…

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

                                            oui effectivement mon ami vient de me parler des hashtable et c’est bien plus pratique

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

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB