MFF

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

    Plusieurs questions/problèmes

    Planifier Épinglé Verrouillé Déplacé Résolu 1.8.x
    1.8
    95 Messages 9 Publieurs 15.5k 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.
    • AxaurusA Hors-ligne
      Axaurus
      dernière édition par

      Merci 🙂
      J’y avais pas pensé à rechercher dans les commandes server.___Salut
      J’ai refait des tests pour trouver ce qui buguait dans la dimension. Précédemment, j’avais dit que c’était le WorldProvider ou le WorldChunkManager qui buguait. Maintenant, j’ai la certitude : c’est le WorldProvider qui bug. Plus précisément cette méthode : ```java
          @Override
       public void registerWorldChunkManager()
       {
        System.out.println(“cc”);
        this.worldChunkMgr = new WorldChunkManagerFrightful();
        this.dimensionId = ThisisHalloween.DIMENSIONID;
       }

       Comment je sais ? J'ai tout simplement supprimer la méthode et ça marche correctement. Ce n'est pas le WorldChunkManager qui bug, le voici :```java
      package thisishalloween.world.frightful;
      
      import net.minecraft.world.biome.WorldChunkManager;
      
      public class WorldChunkManagerFrightful extends WorldChunkManager {
      
      }
      

      Comme vous voyez, j’ai tout supprimer. En gros, ça utilise celui de base.

      Je comprend pas tout là. Ca utilise un truc de base et ça ne marche pas, et si j’enlève, ça l’utilise quand même mais ça marche. o_o

      Je vais aller voir partout si d’autre personnes ont eu ce bug. Mais si vous avez une solution (ou même un début de piste), je suis preneur  😉J’ai ENFIN réussi à régler ce problème de dimension. Suffisait de rempacer ```java
         public WorldChunkManagerFrightful(long p_i45744_1
      , WorldType p_i45744_3
      , String p_i45744_4
      )
         {
             this();
             this.field_180301_f = p_i45744_4_;
             GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(p_i45744_1_, p_i45744_3_, p_i45744_4_);
             agenlayer = getModdedBiomeGenerators(p_i45744_3_, p_i45744_1_, agenlayer);
             this.genBiomes = agenlayer[0];
             this.biomeIndexLayer = agenlayer[1];
         }

      public WorldChunkManagerFrightful(World worldIn)
         {
             this(worldIn.getSeed(), worldIn.getWorldInfo().getTerrainType(), worldIn.getWorldInfo().getGeneratorOptions());
         }
      parjava
         public WorldChunkManagerFrightful(long p_i45744_1_, WorldType p_i45744_3_, long p_i45744_4_)
         {
             this();
             GenLayer[] agenlayer = GenLayerFrightful.makeTheWorld(p_i45744_1_);
             this.genBiomes = agenlayer[0];
             this.biomeIndexLayer = agenlayer[1];
         }

      public WorldChunkManagerFrightful(World worldIn)
         {
             this(worldIn.getSeed(), worldIn.getWorldInfo().getTerrainType(), worldIn.getActualHeight());
         }
      et dans le WorldProvider, d'ajuter les paramètres quand on appelle le WorldChuinkManager :java
      this.worldChunkMgr = new WorldChunkManagerFrightful(worldObj.getSeed(), terrainType, dimensionId);

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

        Pour le portail de sortie, il faut voir le code de ton portail et ton Teleporter. Pour le monde plat, c’est normal (mais tu dois pouvoir le changer).

        Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

        AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

        Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
        Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

          Pour le portail, je viens de voir que j’utilisais le Teleporter de base, c’est pour ça. Maintenant, ça créé bien mon portail, malgré qu’il soit éteint (pas les blocks du portail, que la structure). Mais ça, je pense que je vais trouvé, suffit de voir où ça créer la structure et de rajouter les blocks portal. Pour le monde plat, je pensais que ça récupérait le WorldType par le code que j’ai donnée au post de tout à l’heure. J’ai donc enlevé en pensant que ça serait bon, mais ça à rien fait. Du coup, je sais pas du tout où c’est.

          EDIT : J’ai oublié de préciser, mais quand on rentre dans le portail de retour, ça nous tp directement dans l’Overworld (logique) mais ca nous retp direct, et ça fait ça jusqu’à ce qu’on mette pause et qu’on avance. J’ai pas testé en survie, mais même si ça le fait qu’en créatif, c’est pas cool. Pourtant, je comprend pas, y’a bien des temps d’attentes dans le code

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

            Pour le WorldType, c’est le terrainType que tu as ici : ```java
            this.worldChunkMgr = new WorldChunkManagerFrightful(worldObj.getSeed(), terrainType, dimensionId);

            Pour le portail regarde bien si le cooldown est bien respecté, compares au portail du nether ou montres le code si besoin.

            Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

            AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

            Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
            Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

              Pour le cooldown, j’ai réglé. Il était avant la ligne qui téléporte, il fallait le mettre après.
              Le problème, c’est avec le WorldType. J’ai fait ce code : ```java
              if(worldIn.getWorldInfo().getTerrainType() == WorldType.FLAT)
              {
              worldIn.getWorldInfo().setTerrainType(WorldType.DEFAULT);
              }

              Théoriquement, ça devrais marcher. Mais pas du tout :-(
              Je l'ai mis dans ```java
              public WorldChunkManagerFrightful(World worldIn)
              {
              this(worldIn.getSeed(), worldIn.getWorldInfo().getTerrainType(), worldIn.getActualHeight());
              }
              

              Soit ce n’est pas là que ça se met, soit c’est un mauvais code.

              EDIT : Quand ce n’est pas flatgrass et que je vais dans ma dimension, ça me tp soit dans des blocks soit dans l’eau avec le portail au-dessus. Ca m’a rappelé que je vous avais déjà demandé ça l’an dernier. J’ai regarder le topic et on m’a dit que la cause peut être le fait que le portal n’est pas créer, il n’y a que la structure. Mais du coup, je ne sais pas comment je peux faire. Ca doit être dans la méthode makePortal du teleporter je pense. Voilà le teleporter : ```java
              package thisishalloween.world.frightful;

              import com.google.common.collect.Lists;

              import java.util.Iterator;
              import java.util.List;
              import java.util.Random;
              import net.minecraft.block.BlockPortal;
              import net.minecraft.block.state.IBlockState;
              import net.minecraft.entity.Entity;
              import net.minecraft.init.Blocks;
              import net.minecraft.util.BlockPos;
              import net.minecraft.util.EnumFacing;
              import net.minecraft.util.LongHashMap;
              import net.minecraft.util.MathHelper;
              import net.minecraft.world.ChunkCoordIntPair;
              import net.minecraft.world.Teleporter;
              import net.minecraft.world.WorldServer;
              import thisishalloween.CreateBlocks;
              import thisishalloween.block.BlockPortalFrightful;

              public class TeleporterFrightful extends Teleporter
              {
                 private final WorldServer worldServerInstance;
                 /** A private Random() function in Teleporter /
                 private final Random random;
                 /
              * Stores successful portal placement locations for rapid lookup. /
                 private final LongHashMap destinationCoordinateCache = new LongHashMap();
                 /
              *
                  * A list of valid keys for the destinationCoordainteCache. These are based on the X & Z of the players initial
                  * location.
                  */
                 private final List destinationCoordinateKeys = Lists.newArrayList();

              public TeleporterFrightful(WorldServer worldServer)
                 {
                  super(worldServer);
                     this.worldServerInstance = worldServer;
                     this.random = new Random(worldServer.getSeed());
                 }

              public void placeInPortal(Entity entityIn, float rotationYaw)
                 {
                     if (this.worldServerInstance.provider.getDimensionId() != 1)
                     {
                         if (!this.placeInExistingPortal(entityIn, rotationYaw))
                         {            
                             this.makePortal(entityIn);
                             this.placeInExistingPortal(entityIn, rotationYaw);
                         }
                     }
                     else
                     {
                         int i = MathHelper.floor_double(entityIn.posX);
                         int j = MathHelper.floor_double(entityIn.posY) - 1;
                         int k = MathHelper.floor_double(entityIn.posZ);
                         byte b0 = 1;
                         byte b1 = 0;

              for (int l = -2; l <= 2; ++l)
                         {
                             for (int i1 = -2; i1 <= 2; ++i1)
                             {
                                 for (int j1 = -1; j1 < 3; ++j1)
                                 {
                                     int k1 = i + i1 * b0 + l * b1;
                                     int l1 = j + j1;
                                     int i2 = k + i1 * b1 - l * b0;
                                     boolean flag = j1 < 0;
                                     this.worldServerInstance.setBlockState(new BlockPos(k1, l1, i2), flag ? Blocks.nether_brick.getDefaultState() : Blocks.air.getDefaultState());
                                 }
                             }
                         }

              entityIn.setLocationAndAngles((double)i, (double)j, (double)k, entityIn.rotationYaw, 0.0F);
                         entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D;
                     }
                 }

              public boolean placeInExistingPortal(Entity entityIn, float p_180620_2_)
                 {
                     boolean flag = true;
                     double d0 = -1.0D;
                     int i = MathHelper.floor_double(entityIn.posX);
                     int j = MathHelper.floor_double(entityIn.posZ);
                     boolean flag1 = true;
                     Object object = BlockPos.ORIGIN;
                     long k = ChunkCoordIntPair.chunkXZ2Int(i, j);

              if (this.destinationCoordinateCache.containsItem(k))
                     {
                         TeleporterFrightful.PortalPosition portalposition = (TeleporterFrightful.PortalPosition)this.destinationCoordinateCache.getValueByKey(k);
                         d0 = 0.0D;
                         object = portalposition;
                         portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime();
                         flag1 = false;
                     }
                     else
                     {
                         BlockPos blockpos4 = new BlockPos(entityIn);

              for (int l = -128; l <= 128; ++l)
                         {
                             BlockPos blockpos1;

              for (int i1 = -128; i1 <= 128; ++i1)
                             {
                                 for (BlockPos blockpos = blockpos4.add(l, this.worldServerInstance.getActualHeight() - 1 - blockpos4.getY(), i1); blockpos.getY() >= 0; blockpos = blockpos1)
                                 {
                                     blockpos1 = blockpos.down();

              if (this.worldServerInstance.getBlockState(blockpos).getBlock() == CreateBlocks.portalFrightful)
                                     {
                                         while (this.worldServerInstance.getBlockState(blockpos1 = blockpos.down()).getBlock() == CreateBlocks.portalFrightful)
                                         {
                                             blockpos = blockpos1;
                                         }

              double d1 = blockpos.distanceSq(blockpos4);

              if (d0 < 0.0D || d1 < d0)
                                         {
                                             d0 = d1;
                                             object = blockpos;
                                         }
                                     }
                                 }
                             }
                         }
                     }

              if (d0 >= 0.0D)
                     {
                         if (flag1)
                         {
                             this.destinationCoordinateCache.add(k, new TeleporterFrightful.PortalPosition((BlockPos)object, this.worldServerInstance.getTotalWorldTime()));
                             this.destinationCoordinateKeys.add(Long.valueOf(k));
                         }

              double d4 = (double)((BlockPos)object).getX() + 0.5D;
                         double d5 = (double)((BlockPos)object).getY() + 0.5D;
                         double d6 = (double)((BlockPos)object).getZ() + 0.5D;
                         EnumFacing enumfacing = null;

              if (this.worldServerInstance.getBlockState(((BlockPos)object).west()).getBlock() == CreateBlocks.portalFrightful)
                         {
                             enumfacing = EnumFacing.NORTH;
                         }

              if (this.worldServerInstance.getBlockState(((BlockPos)object).east()).getBlock() == CreateBlocks.portalFrightful)
                         {
                             enumfacing = EnumFacing.SOUTH;
                         }

              if (this.worldServerInstance.getBlockState(((BlockPos)object).north()).getBlock() == CreateBlocks.portalFrightful)
                         {
                             enumfacing = EnumFacing.EAST;
                         }

              if (this.worldServerInstance.getBlockState(((BlockPos)object).south()).getBlock() == CreateBlocks.portalFrightful)
                         {
                             enumfacing = EnumFacing.WEST;
                         }

              EnumFacing enumfacing1 = EnumFacing.getHorizontal(entityIn.getTeleportDirection());

              if (enumfacing != null)
                         {
                             EnumFacing enumfacing2 = enumfacing.rotateYCCW();
                             BlockPos blockpos2 = ((BlockPos)object).offset(enumfacing);
                             boolean flag2 = this.func_180265_a(blockpos2);
                             boolean flag3 = this.func_180265_a(blockpos2.offset(enumfacing2));

              if (flag3 && flag2)
                             {
                                 object = ((BlockPos)object).offset(enumfacing2);
                                 enumfacing = enumfacing.getOpposite();
                                 enumfacing2 = enumfacing2.getOpposite();
                                 BlockPos blockpos3 = ((BlockPos)object).offset(enumfacing);
                                 flag2 = this.func_180265_a(blockpos3);
                                 flag3 = this.func_180265_a(blockpos3.offset(enumfacing2));
                             }

              float f6 = 0.5F;
                             float f1 = 0.5F;

              if (!flag3 && flag2)
                             {
                                 f6 = 1.0F;
                             }
                             else if (flag3 && !flag2)
                             {
                                 f6 = 0.0F;
                             }
                             else if (flag3)
                             {
                                 f1 = 0.0F;
                             }

              d4 = (double)((BlockPos)object).getX() + 0.5D;
                             d5 = (double)((BlockPos)object).getY() + 0.5D;
                             d6 = (double)((BlockPos)object).getZ() + 0.5D;
                             d4 += (double)((float)enumfacing2.getFrontOffsetX() * f6 + (float)enumfacing.getFrontOffsetX() * f1);
                             d6 += (double)((float)enumfacing2.getFrontOffsetZ() * f6 + (float)enumfacing.getFrontOffsetZ() * f1);
                             float f2 = 0.0F;
                             float f3 = 0.0F;
                             float f4 = 0.0F;
                             float f5 = 0.0F;

              if (enumfacing == enumfacing1)
                             {
                                 f2 = 1.0F;
                                 f3 = 1.0F;
                             }
                             else if (enumfacing == enumfacing1.getOpposite())
                             {
                                 f2 = -1.0F;
                                 f3 = -1.0F;
                             }
                             else if (enumfacing == enumfacing1.rotateY())
                             {
                                 f4 = 1.0F;
                                 f5 = -1.0F;
                             }
                             else
                             {
                                 f4 = -1.0F;
                                 f5 = 1.0F;
                             }

              double d2 = entityIn.motionX;
                             double d3 = entityIn.motionZ;
                             entityIn.motionX = d2 * (double)f2 + d3 * (double)f5;
                             entityIn.motionZ = d2 * (double)f4 + d3 * (double)f3;
                             entityIn.rotationYaw = p_180620_2_ - (float)(enumfacing1.getHorizontalIndex() * 90) + (float)(enumfacing.getHorizontalIndex() * 90);
                         }
                         else
                         {
                             entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D;
                         }

              entityIn.setLocationAndAngles(d4, d5, d6, entityIn.rotationYaw, entityIn.rotationPitch);
                         return true;
                     }
                     else
                     {
                         return false;
                     }
                 }

              private boolean func_180265_a(BlockPos p_180265_1_)
                 {
                     return !this.worldServerInstance.isAirBlock(p_180265_1_) || !this.worldServerInstance.isAirBlock(p_180265_1_.up());
                 }

              public boolean makePortal(Entity p_85188_1_)
                 {
                     byte b0 = 16;
                     double d0 = -1.0D;
                     int i = MathHelper.floor_double(p_85188_1_.posX);
                     int j = MathHelper.floor_double(p_85188_1_.posY);
                     int k = MathHelper.floor_double(p_85188_1_.posZ);
                     int l = i;
                     int i1 = j;
                     int j1 = k;
                     int k1 = 0;
                     int l1 = this.random.nextInt(4);
                     int i2;
                     double d1;
                     int k2;
                     double d2;
                     int i3;
                     int j3;
                     int k3;
                     int l3;
                     int i4;
                     int j4;
                     int k4;
                     int l4;
                     int i5;
                     double d3;
                     double d4;

              for (i2 = i - b0; i2 <= i + b0; ++i2)
                     {
                         d1 = (double)i2 + 0.5D - p_85188_1_.posX;

              for (k2 = k - b0; k2 <= k + b0; ++k2)
                         {
                             d2 = (double)k2 + 0.5D - p_85188_1_.posZ;
                             label271:

              for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; –i3)
                             {
                                 if (this.worldServerInstance.isAirBlock(new BlockPos(i2, i3, k2)))
                                 {
                                     while (i3 > 0 && this.worldServerInstance.isAirBlock(new BlockPos(i2, i3 - 1, k2)))
                                     {
                                         --i3;
                                     }

              for (j3 = l1; j3 < l1 + 4; ++j3)
                                     {
                                         k3 = j3 % 2;
                                         l3 = 1 - k3;

              if (j3 % 4 >= 2)
                                         {
                                             k3 = -k3;
                                             l3 = -l3;
                                         }

              for (i4 = 0; i4 < 3; ++i4)
                                         {
                                             for (j4 = 0; j4 < 4; ++j4)
                                             {
                                                 for (k4 = -1; k4 < 4; ++k4)
                                                 {
                                                     l4 = i2 + (j4 - 1) * k3 + i4 * l3;
                                                     i5 = i3 + k4;
                                                     int j5 = k2 + (j4 - 1) * l3 - i4 * k3;

              if (k4 < 0 && !this.worldServerInstance.getBlockState(new BlockPos(l4, i5, j5)).getBlock().getMaterial().isSolid() || k4 >= 0 && !this.worldServerInstance.isAirBlock(new BlockPos(l4, i5, j5)))
                                                     {
                                                         continue label271;
                                                     }
                                                 }
                                             }
                                         }

              d3 = (double)i3 + 0.5D - p_85188_1_.posY;
                                         d4 = d1 * d1 + d3 * d3 + d2 * d2;

              if (d0 < 0.0D || d4 < d0)
                                         {
                                             d0 = d4;
                                             l = i2;
                                             i1 = i3;
                                             j1 = k2;
                                             k1 = j3 % 4;
                                         }
                                     }
                                 }
                             }
                         }
                     }

              if (d0 < 0.0D)
                     {
                         for (i2 = i - b0; i2 <= i + b0; ++i2)
                         {
                             d1 = (double)i2 + 0.5D - p_85188_1_.posX;

              for (k2 = k - b0; k2 <= k + b0; ++k2)
                             {
                                 d2 = (double)k2 + 0.5D - p_85188_1_.posZ;
                                 label219:

              for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3)
                                 {
                                     if (this.worldServerInstance.isAirBlock(new BlockPos(i2, i3, k2)))
                                     {
                                         while (i3 > 0 && this.worldServerInstance.isAirBlock(new BlockPos(i2, i3 - 1, k2)))
                                         {
                                             --i3;
                                         }

              for (j3 = l1; j3 < l1 + 2; ++j3)
                                         {
                                             k3 = j3 % 2;
                                             l3 = 1 - k3;

              for (i4 = 0; i4 < 4; ++i4)
                                             {
                                                 for (j4 = -1; j4 < 4; ++j4)
                                                 {
                                                     k4 = i2 + (i4 - 1) * k3;
                                                     l4 = i3 + j4;
                                                     i5 = k2 + (i4 - 1) * l3;

              if (j4 < 0 && !this.worldServerInstance.getBlockState(new BlockPos(k4, l4, i5)).getBlock().getMaterial().isSolid() || j4 >= 0 && !this.worldServerInstance.isAirBlock(new BlockPos(k4, l4, i5)))
                                                     {
                                                         continue label219;
                                                     }
                                                 }
                                             }

              d3 = (double)i3 + 0.5D - p_85188_1_.posY;
                                             d4 = d1 * d1 + d3 * d3 + d2 * d2;

              if (d0 < 0.0D || d4 < d0)
                                             {
                                                 d0 = d4;
                                                 l = i2;
                                                 i1 = i3;
                                                 j1 = k2;
                                                 k1 = j3 % 2;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }

              int k5 = l;
                     int j2 = i1;
                     k2 = j1;
                     int l5 = k1 % 2;
                     int l2 = 1 - l5;

              if (k1 % 4 >= 2)
                     {
                         l5 = -l5;
                         l2 = -l2;
                     }

              if (d0 < 0.0D)
                     {
                         i1 = MathHelper.clamp_int(i1, 70, this.worldServerInstance.getActualHeight() - 10);
                         j2 = i1;

              for (i3 = -1; i3 <= 1; ++i3)
                         {
                             for (j3 = 1; j3 < 3; ++j3)
                             {
                                 for (k3 = -1; k3 < 3; ++k3)
                                 {
                                     l3 = k5 + (j3 - 1) * l5 + i3 * l2;
                                     i4 = j2 + k3;
                                     j4 = k2 + (j3 - 1) * l2 - i3 * l5;
                                     boolean flag = k3 < 0;
                                     this.worldServerInstance.setBlockState(new BlockPos(l3, i4, j4), flag ? Blocks.nether_brick.getDefaultState() : Blocks.air.getDefaultState());
                                 }
                             }
                         }
                     }

              IBlockState iblockstate = CreateBlocks.portalFrightful.getDefaultState().withProperty(BlockPortalFrightful.AXIS, l5 != 0 ? EnumFacing.Axis.X : EnumFacing.Axis.Z);

              for (j3 = 0; j3 < 4; ++j3)
                     {
                         for (k3 = 0; k3 < 4; ++k3)
                         {
                             for (l3 = -1; l3 < 4; ++l3)
                             {
                                 i4 = k5 + (k3 - 1) * l5;
                                 j4 = j2 + l3;
                                 k4 = k2 + (k3 - 1) * l2;
                                 boolean flag1 = k3 == 0 || k3 == 3 || l3 == -1 || l3 == 3;
                                 this.worldServerInstance.setBlockState(new BlockPos(i4, j4, k4), flag1 ? Blocks.nether_brick.getDefaultState() : iblockstate, 2);
                             }
                         }

              for (k3 = 0; k3 < 4; ++k3)
                         {
                             for (l3 = -1; l3 < 4; ++l3)
                             {
                                 i4 = k5 + (k3 - 1) * l5;
                                 j4 = j2 + l3;
                                 k4 = k2 + (k3 - 1) * l2;
                                 this.worldServerInstance.notifyNeighborsOfStateChange(new BlockPos(i4, j4, k4), this.worldServerInstance.getBlockState(new BlockPos(i4, j4, k4)).getBlock());
                             }
                         }
                     }

              return true;
                 }

              /**
                  * called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a
                  * WorldServer.getTotalWorldTime() value.
                  */
                 public void removeStalePortalLocations(long p_85189_1_)
                 {
                     if (p_85189_1_ % 100L == 0L)
                     {
                         Iterator iterator = this.destinationCoordinateKeys.iterator();
                         long j = p_85189_1_ - 600L;

              while (iterator.hasNext())
                         {
                             Long olong = (Long)iterator.next();
                             TeleporterFrightful.PortalPosition portalposition = (TeleporterFrightful.PortalPosition)this.destinationCoordinateCache.getValueByKey(olong.longValue());

              if (portalposition == null || portalposition.lastUpdateTime < j)
                             {
                                 iterator.remove();
                                 this.destinationCoordinateCache.remove(olong.longValue());
                             }
                         }
                     }
                 }

              public class PortalPosition extends BlockPos
                 {
                     /** The worldtime at which this PortalPosition was last verified */
                     public long lastUpdateTime;

              public PortalPosition(BlockPos pos, long p_i45747_3_)
                     {
                         super(pos.getX(), pos.getY(), pos.getZ());
                         this.lastUpdateTime = p_i45747_3_;
                     }
                 }
              }

              J'ignore complètement comment je peux faire :interrogation:
              Par ailleurs, (petit détail assez inutile) j'ai aussi changé la citrouille par la nether brick pour la structure du portail.
              1 réponse Dernière réponse Répondre Citer 0
              • AymericRedA Hors-ligne
                AymericRed
                dernière édition par

                Pour le téléporter, j’ai pas trop le temps, mais essaye de prendre celui vanilla en modifiant les blocs (si pas déjà fait).
                Pour le WorldType, tu avais dit que tu utilisais l’autre constructeur.

                Envoyé de mon RAINBOW LITE 4G en utilisant Tapatalk

                Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                  Salut
                  Pour le teleporter, j’ai reprise celui vanilla en remplaçant les blocks, et ça fait comme avant : la structure apparaît mais pas le portail.
                  Pour le WorldType, je l’ai mis dans le constructeur que j’utilise et ça ne marche tout simplement pas. J’ai fait afficher des messages, mais aucun signe d’eux. Du coup, je sais pas si c’est la bonne condition que j’utilise___J’ai essayer une nouvelle fois de remplacer mon teleporter par celui de base (copier/coller) mais cette fois j’ai procédé différemment : au lieu de changer directement l’obsidienne par la nether brick et changer le portail par le mien, j’ai essayer de changer un seul après l’autre. J’ai d’abord essayer de changer l’obsidienne par la nether brick et j’ai lancé le jeu : le portail (celui de base) ne spawn pas (ce qui pêut être prévisible vu qu’il doit être entouré d’obsi) ; seulement la structure. J’ai ensuite remis l’obsidienne et changer le portail par le mien. Mais il ne spawn pas. Du coup, le problème ne doit pas être dans le teleporter mais plutôt dans le blockPortal. Je vais regarder et je reviens vers vous.

                  Sinon, quand j’ai voulu ajouter un item (custom) à un mob (custom), ça ne marche pas. En soit, ça marche mais ça me fait la texture manquante. Or, quand je tient l’item en main, elle apparaît bien, que je soit en 1ère ou en 3ème personne. J’ai essayer avec un autre de mes item (toujours custom) et pareil, texture manquante. Par contre, quand je met un item de base (par exemple une épée), ça marche parfaitement bien. J’ai comparé les json et ils sont similaires, seul l’emplacement de la texture change. Du coup, je sais pas comment faire 😕

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

                    Salut
                    J’ai regardé dans le forum et personne n’a eu ce problème (la dimension qui prend le même WorldType que l’Overworld et portail éteint quand on arrive dans la dimension pour la 1ère fois).
                    J’ai dû faire un truc qui a foiré, même si j’ai pas touché à grand chose.
                    Pour l’item dans la main, j’ai abandonné, je ferai l’année prochaine.

                    Sinon, j’ai encore un autre trucs à vous demander et après promis j’arrête de vous embêter avec ce mod (je l’aurai fini, juste à le mettre à jour) :
                    Comment je peux faire pour ajouter l’orage sans qu’il ne pleuve ?

                    Merci d’avance

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

                      Pour le WorldType, c’est normal que ça garde celui de l’overworld mais tu devrais pouvoir le changer. Pour le problème de portail, j’avais eu ce même problème, mais je ne me souviens malheuresement plus comment je l’avais corrigé, je sais j’avais pris le Teleporter du nether et changé les blocks, mais j’avais aussi changé autre chose (avant le lancement de la tp quand on est dans le portail), montre le code de ton Teleporter, de ton block et de ton portail, je comparerais avec les miens.

                      Pour l’item en main je ne sais pas…
                      Et pour l’orage sans eau, ça devrait être possible mais pas simplement (à moins qu’il y ait un event de rendu de pluie…).

                      Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                      AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                      Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                      Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                        Pour le WorldType, je ne sais pas comment le changer. Pourtant en 1.7, ça utilisait le WorldType DEFAULT. Je ne comprend pas pourquoi là, ça utilise le même que l’Overworld. Je veux bien que y’ait beaucoup de chose qui ont changé en 1.8, mais quand même …

                        Voilà mon teleporter :

                        package thisishalloween.world.frightful;
                        
                        import com.google.common.collect.Lists;
                        import java.util.Iterator;
                        import java.util.List;
                        import java.util.Random;
                        import net.minecraft.block.BlockPortal;
                        import net.minecraft.block.state.IBlockState;
                        import net.minecraft.entity.Entity;
                        import net.minecraft.init.Blocks;
                        import net.minecraft.util.BlockPos;
                        import net.minecraft.util.EnumFacing;
                        import net.minecraft.util.LongHashMap;
                        import net.minecraft.util.MathHelper;
                        import net.minecraft.world.ChunkCoordIntPair;
                        import net.minecraft.world.Teleporter;
                        import net.minecraft.world.WorldServer;
                        import thisishalloween.CreateBlocks;
                        
                        public class TeleporterFrightful extends Teleporter
                        {
                           private final WorldServer worldServerInstance;
                           private final Random random;
                           private final LongHashMap destinationCoordinateCache = new LongHashMap();
                           private final List destinationCoordinateKeys = Lists.newArrayList();
                        
                           public TeleporterFrightful(WorldServer worldIn)
                           {
                            super(worldIn);
                               this.worldServerInstance = worldIn;
                               this.random = new Random(worldIn.getSeed());
                           }
                        
                           public void placeInPortal(Entity entityIn, float rotationYaw)
                           {
                               if (this.worldServerInstance.provider.getDimensionId() != 1)
                               {
                                   if (!this.placeInExistingPortal(entityIn, rotationYaw))
                                   {
                                       this.makePortal(entityIn);
                                       this.placeInExistingPortal(entityIn, rotationYaw);
                                   }
                               }
                               else
                               {
                                   int i = MathHelper.floor_double(entityIn.posX);
                                   int j = MathHelper.floor_double(entityIn.posY) - 1;
                                   int k = MathHelper.floor_double(entityIn.posZ);
                                   byte b0 = 1;
                                   byte b1 = 0;
                        
                                   for (int l = -2; l <= 2; ++l)
                                   {
                                       for (int i1 = -2; i1 <= 2; ++i1)
                                       {
                                           for (int j1 = -1; j1 < 3; ++j1)
                                           {
                                               int k1 = i + i1 * b0 + l * b1;
                                               int l1 = j + j1;
                                               int i2 = k + i1 * b1 - l * b0;
                                               boolean flag = j1 < 0;
                                               this.worldServerInstance.setBlockState(new BlockPos(k1, l1, i2), flag ? Blocks.nether_brick.getDefaultState() : Blocks.air.getDefaultState());
                                           }
                                       }
                                   }
                                   entityIn.setLocationAndAngles((double)i, (double)j, (double)k, entityIn.rotationYaw, 0.0F);
                                   entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D;
                               }
                           }
                        
                           public boolean placeInExistingPortal(Entity entityIn, float p_180620_2_)
                           {
                               boolean flag = true;
                               double d0 = -1.0D;
                               int i = MathHelper.floor_double(entityIn.posX);
                               int j = MathHelper.floor_double(entityIn.posZ);
                               boolean flag1 = true;
                               Object object = BlockPos.ORIGIN;
                               long k = ChunkCoordIntPair.chunkXZ2Int(i, j);
                        
                               if (this.destinationCoordinateCache.containsItem(k))
                               {
                                   TeleporterFrightful.PortalPosition portalposition = (TeleporterFrightful.PortalPosition)this.destinationCoordinateCache.getValueByKey(k);
                                   d0 = 0.0D;
                                   object = portalposition;
                                   portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime();
                                   flag1 = false;
                               }
                               else
                               {
                                   BlockPos blockpos4 = new BlockPos(entityIn);
                        
                                   for (int l = -128; l <= 128; ++l)
                                   {
                                       BlockPos blockpos1;
                        
                                       for (int i1 = -128; i1 <= 128; ++i1)
                                       {
                                           for (BlockPos blockpos = blockpos4.add(l, this.worldServerInstance.getActualHeight() - 1 - blockpos4.getY(), i1); blockpos.getY() >= 0; blockpos = blockpos1)
                                           {
                                               blockpos1 = blockpos.down();
                        
                                               if (this.worldServerInstance.getBlockState(blockpos).getBlock() == CreateBlocks.portalFrightful)
                                               {
                                                   while (this.worldServerInstance.getBlockState(blockpos1 = blockpos.down()).getBlock() == CreateBlocks.portalFrightful)
                                                   {
                                                       blockpos = blockpos1;
                                                   }
                        
                                                   double d1 = blockpos.distanceSq(blockpos4);
                        
                                                   if (d0 < 0.0D || d1 < d0)
                                                   {
                                                       d0 = d1;
                                                       object = blockpos;
                                                   }
                                               }
                                           }
                                       }
                                   }
                               }
                        
                               if (d0 >= 0.0D)
                               {
                                   if (flag1)
                                   {
                                       this.destinationCoordinateCache.add(k, new TeleporterFrightful.PortalPosition((BlockPos)object, this.worldServerInstance.getTotalWorldTime()));
                                       this.destinationCoordinateKeys.add(Long.valueOf(k));
                                   }
                        
                                   double d4 = (double)((BlockPos)object).getX() + 0.5D;
                                   double d5 = (double)((BlockPos)object).getY() + 0.5D;
                                   double d6 = (double)((BlockPos)object).getZ() + 0.5D;
                                   EnumFacing enumfacing = null;
                        
                                   if (this.worldServerInstance.getBlockState(((BlockPos)object).west()).getBlock() == CreateBlocks.portalFrightful)
                                   {
                                       enumfacing = EnumFacing.NORTH;
                                   }
                        
                                   if (this.worldServerInstance.getBlockState(((BlockPos)object).east()).getBlock() == CreateBlocks.portalFrightful)
                                   {
                                       enumfacing = EnumFacing.SOUTH;
                                   }
                        
                                   if (this.worldServerInstance.getBlockState(((BlockPos)object).north()).getBlock() == CreateBlocks.portalFrightful)
                                   {
                                       enumfacing = EnumFacing.EAST;
                                   }
                        
                                   if (this.worldServerInstance.getBlockState(((BlockPos)object).south()).getBlock() == CreateBlocks.portalFrightful)
                                   {
                                       enumfacing = EnumFacing.WEST;
                                   }
                        
                                   EnumFacing enumfacing1 = EnumFacing.getHorizontal(entityIn.getTeleportDirection());
                        
                                   if (enumfacing != null)
                                   {
                                       EnumFacing enumfacing2 = enumfacing.rotateYCCW();
                                       BlockPos blockpos2 = ((BlockPos)object).offset(enumfacing);
                                       boolean flag2 = this.func_180265_a(blockpos2);
                                       boolean flag3 = this.func_180265_a(blockpos2.offset(enumfacing2));
                        
                                       if (flag3 && flag2)
                                       {
                                           object = ((BlockPos)object).offset(enumfacing2);
                                           enumfacing = enumfacing.getOpposite();
                                           enumfacing2 = enumfacing2.getOpposite();
                                           BlockPos blockpos3 = ((BlockPos)object).offset(enumfacing);
                                           flag2 = this.func_180265_a(blockpos3);
                                           flag3 = this.func_180265_a(blockpos3.offset(enumfacing2));
                                       }
                        
                                       float f6 = 0.5F;
                                       float f1 = 0.5F;
                        
                                       if (!flag3 && flag2)
                                       {
                                           f6 = 1.0F;
                                       }
                                       else if (flag3 && !flag2)
                                       {
                                           f6 = 0.0F;
                                       }
                                       else if (flag3)
                                       {
                                           f1 = 0.0F;
                                       }
                        
                                       d4 = (double)((BlockPos)object).getX() + 0.5D;
                                       d5 = (double)((BlockPos)object).getY() + 0.5D;
                                       d6 = (double)((BlockPos)object).getZ() + 0.5D;
                                       d4 += (double)((float)enumfacing2.getFrontOffsetX() * f6 + (float)enumfacing.getFrontOffsetX() * f1);
                                       d6 += (double)((float)enumfacing2.getFrontOffsetZ() * f6 + (float)enumfacing.getFrontOffsetZ() * f1);
                                       float f2 = 0.0F;
                                       float f3 = 0.0F;
                                       float f4 = 0.0F;
                                       float f5 = 0.0F;
                        
                                       if (enumfacing == enumfacing1)
                                       {
                                           f2 = 1.0F;
                                           f3 = 1.0F;
                                       }
                                       else if (enumfacing == enumfacing1.getOpposite())
                                       {
                                           f2 = -1.0F;
                                           f3 = -1.0F;
                                       }
                                       else if (enumfacing == enumfacing1.rotateY())
                                       {
                                           f4 = 1.0F;
                                           f5 = -1.0F;
                                       }
                                       else
                                       {
                                           f4 = -1.0F;
                                           f5 = 1.0F;
                                       }
                        
                                       double d2 = entityIn.motionX;
                                       double d3 = entityIn.motionZ;
                                       entityIn.motionX = d2 * (double)f2 + d3 * (double)f5;
                                       entityIn.motionZ = d2 * (double)f4 + d3 * (double)f3;
                                       entityIn.rotationYaw = p_180620_2_ - (float)(enumfacing1.getHorizontalIndex() * 90) + (float)(enumfacing.getHorizontalIndex() * 90);
                                   }
                                   else
                                   {
                                       entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D;
                                   }
                        
                                   entityIn.setLocationAndAngles(d4, d5, d6, entityIn.rotationYaw, entityIn.rotationPitch);
                                   return true;
                               }
                               else
                               {
                                   return false;
                               }
                           }
                        
                           private boolean func_180265_a(BlockPos p_180265_1_)
                           {
                               return !this.worldServerInstance.isAirBlock(p_180265_1_) || !this.worldServerInstance.isAirBlock(p_180265_1_.up());
                           }
                        
                           public boolean makePortal(Entity p_85188_1_)
                           {
                               byte b0 = 16;
                               double d0 = -1.0D;
                               int i = MathHelper.floor_double(p_85188_1_.posX);
                               int j = MathHelper.floor_double(p_85188_1_.posY);
                               int k = MathHelper.floor_double(p_85188_1_.posZ);
                               int l = i;
                               int i1 = j;
                               int j1 = k;
                               int k1 = 0;
                               int l1 = this.random.nextInt(4);
                               int i2;
                               double d1;
                               int k2;
                               double d2;
                               int i3;
                               int j3;
                               int k3;
                               int l3;
                               int i4;
                               int j4;
                               int k4;
                               int l4;
                               int i5;
                               double d3;
                               double d4;
                        
                               for (i2 = i - b0; i2 <= i + b0; ++i2)
                               {
                                   d1 = (double)i2 + 0.5D - p_85188_1_.posX;
                        
                                   for (k2 = k - b0; k2 <= k + b0; ++k2)
                                   {
                                       d2 = (double)k2 + 0.5D - p_85188_1_.posZ;
                                       label271:
                        
                                       for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3)
                                       {
                                           if (this.worldServerInstance.isAirBlock(new BlockPos(i2, i3, k2)))
                                           {
                                               while (i3 > 0 && this.worldServerInstance.isAirBlock(new BlockPos(i2, i3 - 1, k2)))
                                               {
                                                   --i3;
                                               }
                        
                                               for (j3 = l1; j3 < l1 + 4; ++j3)
                                               {
                                                   k3 = j3 % 2;
                                                   l3 = 1 - k3;
                        
                                                   if (j3 % 4 >= 2)
                                                   {
                                                       k3 = -k3;
                                                       l3 = -l3;
                                                   }
                        
                                                   for (i4 = 0; i4 < 3; ++i4)
                                                   {
                                                       for (j4 = 0; j4 < 4; ++j4)
                                                       {
                                                           for (k4 = -1; k4 < 4; ++k4)
                                                           {
                                                               l4 = i2 + (j4 - 1) * k3 + i4 * l3;
                                                               i5 = i3 + k4;
                                                               int j5 = k2 + (j4 - 1) * l3 - i4 * k3;
                        
                                                               if (k4 < 0 && !this.worldServerInstance.getBlockState(new BlockPos(l4, i5, j5)).getBlock().getMaterial().isSolid() || k4 >= 0 && !this.worldServerInstance.isAirBlock(new BlockPos(l4, i5, j5)))
                                                               {
                                                                   continue label271;
                                                               }
                                                           }
                                                       }
                                                   }
                        
                                                   d3 = (double)i3 + 0.5D - p_85188_1_.posY;
                                                   d4 = d1 * d1 + d3 * d3 + d2 * d2;
                        
                                                   if (d0 < 0.0D || d4 < d0)
                                                   {
                                                       d0 = d4;
                                                       l = i2;
                                                       i1 = i3;
                                                       j1 = k2;
                                                       k1 = j3 % 4;
                                                   }
                                               }
                                           }
                                       }
                                   }
                               }
                        
                               if (d0 < 0.0D)
                               {
                                   for (i2 = i - b0; i2 <= i + b0; ++i2)
                                   {
                                       d1 = (double)i2 + 0.5D - p_85188_1_.posX;
                        
                                       for (k2 = k - b0; k2 <= k + b0; ++k2)
                                       {
                                           d2 = (double)k2 + 0.5D - p_85188_1_.posZ;
                                           label219:
                        
                                           for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3)
                                           {
                                               if (this.worldServerInstance.isAirBlock(new BlockPos(i2, i3, k2)))
                                               {
                                                   while (i3 > 0 && this.worldServerInstance.isAirBlock(new BlockPos(i2, i3 - 1, k2)))
                                                   {
                                                       --i3;
                                                   }
                        
                                                   for (j3 = l1; j3 < l1 + 2; ++j3)
                                                   {
                                                       k3 = j3 % 2;
                                                       l3 = 1 - k3;
                        
                                                       for (i4 = 0; i4 < 4; ++i4)
                                                       {
                                                           for (j4 = -1; j4 < 4; ++j4)
                                                           {
                                                               k4 = i2 + (i4 - 1) * k3;
                                                               l4 = i3 + j4;
                                                               i5 = k2 + (i4 - 1) * l3;
                        
                                                               if (j4 < 0 && !this.worldServerInstance.getBlockState(new BlockPos(k4, l4, i5)).getBlock().getMaterial().isSolid() || j4 >= 0 && !this.worldServerInstance.isAirBlock(new BlockPos(k4, l4, i5)))
                                                               {
                                                                   continue label219;
                                                               }
                                                           }
                                                       }
                        
                                                       d3 = (double)i3 + 0.5D - p_85188_1_.posY;
                                                       d4 = d1 * d1 + d3 * d3 + d2 * d2;
                        
                                                       if (d0 < 0.0D || d4 < d0)
                                                       {
                                                           d0 = d4;
                                                           l = i2;
                                                           i1 = i3;
                                                           j1 = k2;
                                                           k1 = j3 % 2;
                                                       }
                                                   }
                                               }
                                           }
                                       }
                                   }
                               }
                        
                               int k5 = l;
                               int j2 = i1;
                               k2 = j1;
                               int l5 = k1 % 2;
                               int l2 = 1 - l5;
                        
                               if (k1 % 4 >= 2)
                               {
                                   l5 = -l5;
                                   l2 = -l2;
                               }
                        
                               if (d0 < 0.0D)
                               {
                                   i1 = MathHelper.clamp_int(i1, 70, this.worldServerInstance.getActualHeight() - 10);
                                   j2 = i1;
                        
                                   for (i3 = -1; i3 <= 1; ++i3)
                                   {
                                       for (j3 = 1; j3 < 3; ++j3)
                                       {
                                           for (k3 = -1; k3 < 3; ++k3)
                                           {
                                               l3 = k5 + (j3 - 1) * l5 + i3 * l2;
                                               i4 = j2 + k3;
                                               j4 = k2 + (j3 - 1) * l2 - i3 * l5;
                                               boolean flag = k3 < 0;
                                               this.worldServerInstance.setBlockState(new BlockPos(l3, i4, j4), flag ? Blocks.nether_brick.getDefaultState() : Blocks.air.getDefaultState());
                                           }
                                       }
                                   }
                               }
                        
                               IBlockState iblockstate = CreateBlocks.portalFrightful.getDefaultState().withProperty(BlockPortal.AXIS, l5 != 0 ? EnumFacing.Axis.X : EnumFacing.Axis.Z);
                        
                               for (j3 = 0; j3 < 4; ++j3)
                               {
                                   for (k3 = 0; k3 < 4; ++k3)
                                   {
                                       for (l3 = -1; l3 < 4; ++l3)
                                       {
                                           i4 = k5 + (k3 - 1) * l5;
                                           j4 = j2 + l3;
                                           k4 = k2 + (k3 - 1) * l2;
                                           boolean flag1 = k3 == 0 || k3 == 3 || l3 == -1 || l3 == 3;
                                           this.worldServerInstance.setBlockState(new BlockPos(i4, j4, k4), flag1 ? Blocks.nether_brick.getDefaultState() : iblockstate, 2);
                                       }
                                   }
                        
                                   for (k3 = 0; k3 < 4; ++k3)
                                   {
                                       for (l3 = -1; l3 < 4; ++l3)
                                       {
                                           i4 = k5 + (k3 - 1) * l5;
                                           j4 = j2 + l3;
                                           k4 = k2 + (k3 - 1) * l2;
                                           this.worldServerInstance.notifyNeighborsOfStateChange(new BlockPos(i4, j4, k4), this.worldServerInstance.getBlockState(new BlockPos(i4, j4, k4)).getBlock());
                                       }
                                   }
                               }
                        
                               return true;
                           }
                        
                           /**
                            * called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a
                            * WorldServer.getTotalWorldTime() value.
                            */
                           public void removeStalePortalLocations(long p_85189_1_)
                           {
                               if (p_85189_1_ % 100L == 0L)
                               {
                                   Iterator iterator = this.destinationCoordinateKeys.iterator();
                                   long j = p_85189_1_ - 600L;
                        
                                   while (iterator.hasNext())
                                   {
                                       Long olong = (Long)iterator.next();
                                       TeleporterFrightful.PortalPosition portalposition = (TeleporterFrightful.PortalPosition)this.destinationCoordinateCache.getValueByKey(olong.longValue());
                        
                                       if (portalposition == null || portalposition.lastUpdateTime < j)
                                       {
                                           iterator.remove();
                                           this.destinationCoordinateCache.remove(olong.longValue());
                                       }
                                   }
                               }
                           }
                        
                           public class PortalPosition extends BlockPos
                           {
                               /** The worldtime at which this PortalPosition was last verified */
                               public long lastUpdateTime;
                               private static final String __OBFID = "CL_00000154";
                        
                               public PortalPosition(BlockPos pos, long p_i45747_3_)
                               {
                                   super(pos.getX(), pos.getY(), pos.getZ());
                                   this.lastUpdateTime = p_i45747_3_;
                               }
                           }
                        }
                        

                        le portal :

                        package thisishalloween.block;
                        
                        import java.util.Random;
                        
                        import net.minecraft.block.Block;
                        import net.minecraft.block.BlockBreakable;
                        import net.minecraft.block.material.Material;
                        import net.minecraft.block.properties.IProperty;
                        import net.minecraft.block.properties.PropertyEnum;
                        import net.minecraft.block.state.BlockState;
                        import net.minecraft.block.state.IBlockState;
                        import net.minecraft.entity.Entity;
                        import net.minecraft.entity.EntityList;
                        import net.minecraft.entity.player.EntityPlayerMP;
                        import net.minecraft.init.Blocks;
                        import net.minecraft.item.Item;
                        import net.minecraft.item.ItemMonsterPlacer;
                        import net.minecraft.server.MinecraftServer;
                        import net.minecraft.util.AxisAlignedBB;
                        import net.minecraft.util.BlockPos;
                        import net.minecraft.util.EnumFacing;
                        import net.minecraft.util.EnumParticleTypes;
                        import net.minecraft.util.EnumWorldBlockLayer;
                        import net.minecraft.world.IBlockAccess;
                        import net.minecraft.world.Teleporter;
                        import net.minecraft.world.World;
                        import net.minecraft.world.WorldServer;
                        import net.minecraftforge.common.DimensionManager;
                        import net.minecraftforge.fml.relauncher.Side;
                        import net.minecraftforge.fml.relauncher.SideOnly;
                        import thisishalloween.CreateBlocks;
                        import thisishalloween.ThisisHalloween;
                        import thisishalloween.world.frightful.TeleporterFrightful;
                        
                        public class BlockPortalFrightful extends BlockBreakable
                        {
                        public static final PropertyEnum AXIS = PropertyEnum.create("axis", EnumFacing.Axis.class, new EnumFacing.Axis[] {EnumFacing.Axis.X, EnumFacing.Axis.Z});
                        
                        public BlockPortalFrightful()
                        {
                        super(Material.portal, false);
                        this.setDefaultState(this.blockState.getBaseState().withProperty(AXIS, EnumFacing.Axis.X));
                        this.setTickRandomly(true);
                        }
                        
                        public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
                        {
                        super.updateTick(worldIn, pos, state, rand);
                        
                        if (worldIn.provider.isSurfaceWorld() && worldIn.getGameRules().getGameRuleBooleanValue("doMobSpawning") && rand.nextInt(2000) < worldIn.getDifficulty().getDifficultyId())
                        {
                        int i = pos.getY();
                        BlockPos blockpos1;
                        
                        for (blockpos1 = pos; !World.doesBlockHaveSolidTopSurface(worldIn, blockpos1) && blockpos1.getY() > 0; blockpos1 = blockpos1.down())
                        {
                        ;
                        }
                        
                        if (i > 0 && !worldIn.getBlockState(blockpos1.up()).getBlock().isNormalCube())
                        {
                        Entity entity = ItemMonsterPlacer.spawnCreature(worldIn, 57, (double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 1.1D, (double)blockpos1.getZ() + 0.5D);
                        
                        if (entity != null)
                        {
                        entity.timeUntilPortal = entity.getPortalCooldown();
                        }
                        }
                        }
                        }
                        
                        public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
                        {
                        return null;
                        }
                        
                        public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
                        {
                        EnumFacing.Axis axis = (EnumFacing.Axis)worldIn.getBlockState(pos).getValue(AXIS);
                        float f = 0.125F;
                        float f1 = 0.125F;
                        
                        if (axis == EnumFacing.Axis.X)
                        {
                        f = 0.5F;
                        }
                        
                        if (axis == EnumFacing.Axis.Z)
                        {
                        f1 = 0.5F;
                        }
                        
                        this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
                        }
                        
                        public static int getMetaForAxis(EnumFacing.Axis axis)
                        {
                        return axis == EnumFacing.Axis.X ? 1 : (axis == EnumFacing.Axis.Z ? 2 : 0);
                        }
                        
                        public boolean isFullCube()
                        {
                        return false;
                        }
                        
                        public boolean func_176548_d(World worldIn, BlockPos p_176548_2_)
                        {
                        BlockPortalFrightful.Size size = new BlockPortalFrightful.Size(worldIn, p_176548_2_, EnumFacing.Axis.X);
                        
                        if (size.func_150860_b() && size.field_150864_e == 0)
                        {
                        size.func_150859_c();
                        return true;
                        }
                        else
                        {
                        BlockPortalFrightful.Size size1 = new BlockPortalFrightful.Size(worldIn, p_176548_2_, EnumFacing.Axis.Z);
                        
                        if (size1.func_150860_b() && size1.field_150864_e == 0)
                        {
                        size1.func_150859_c();
                        return true;
                        }
                        else
                        {
                        return false;
                        }
                        }
                        }
                        
                        /**
                        * Called when a neighboring block changes.
                        */
                        public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
                        {
                        EnumFacing.Axis axis = (EnumFacing.Axis)state.getValue(AXIS);
                        BlockPortalFrightful.Size size;
                        
                        if (axis == EnumFacing.Axis.X)
                        {
                        size = new BlockPortalFrightful.Size(worldIn, pos, EnumFacing.Axis.X);
                        
                        if (!size.func_150860_b() || size.field_150864_e < size.field_150868_h * size.field_150862_g)
                        {
                        worldIn.setBlockState(pos, Blocks.air.getDefaultState());
                        }
                        }
                        else if (axis == EnumFacing.Axis.Z)
                        {
                        size = new BlockPortalFrightful.Size(worldIn, pos, EnumFacing.Axis.Z);
                        
                        if (!size.func_150860_b() || size.field_150864_e < size.field_150868_h * size.field_150862_g)
                        {
                        worldIn.setBlockState(pos, Blocks.air.getDefaultState());
                        }
                        }
                        }
                        
                        @SideOnly(Side.CLIENT)
                        public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
                        {
                        EnumFacing.Axis axis = null;
                        IBlockState iblockstate = worldIn.getBlockState(pos);
                        
                        if (worldIn.getBlockState(pos).getBlock() == this)
                        {
                        axis = (EnumFacing.Axis)iblockstate.getValue(AXIS);
                        
                        if (axis == null)
                        {
                        return false;
                        }
                        
                        if (axis == EnumFacing.Axis.Z && side != EnumFacing.EAST && side != EnumFacing.WEST)
                        {
                        return false;
                        }
                        
                        if (axis == EnumFacing.Axis.X && side != EnumFacing.SOUTH && side != EnumFacing.NORTH)
                        {
                        return false;
                        }
                        }
                        
                        boolean flag = worldIn.getBlockState(pos.west()).getBlock() == this && worldIn.getBlockState(pos.west(2)).getBlock() != this;
                        boolean flag1 = worldIn.getBlockState(pos.east()).getBlock() == this && worldIn.getBlockState(pos.east(2)).getBlock() != this;
                        boolean flag2 = worldIn.getBlockState(pos.north()).getBlock() == this && worldIn.getBlockState(pos.north(2)).getBlock() != this;
                        boolean flag3 = worldIn.getBlockState(pos.south()).getBlock() == this && worldIn.getBlockState(pos.south(2)).getBlock() != this;
                        boolean flag4 = flag || flag1 || axis == EnumFacing.Axis.X;
                        boolean flag5 = flag2 || flag3 || axis == EnumFacing.Axis.Z;
                        return flag4 && side == EnumFacing.WEST ? true : (flag4 && side == EnumFacing.EAST ? true : (flag5 && side == EnumFacing.NORTH ? true : flag5 && side == EnumFacing.SOUTH));
                        }
                        
                        /**
                        * Returns the quantity of items to drop on block destruction.
                        */
                        public int quantityDropped(Random random)
                        {
                        return 0;
                        }
                        
                        /**
                        * Called When an Entity Collided with the Block
                        */
                        @Override
                        public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
                        {
                        if (entityIn.ridingEntity == null && entityIn.riddenByEntity == null && entityIn.timeUntilPortal <= 0)
                        {
                        int id = ThisisHalloween.DIMENSIONID;
                        
                        if (entityIn.dimension == id)
                        {
                        id = 0;
                        }
                        
                        if (entityIn instanceof EntityPlayerMP) {
                        EntityPlayerMP player = (EntityPlayerMP) entityIn;
                        MinecraftServer mcServer = MinecraftServer.getServer();
                        
                        if (player.timeUntilPortal > 0)
                        {
                        player.timeUntilPortal = 200;
                        }
                        else if (player.dimension != ThisisHalloween.DIMENSIONID)
                        {
                        
                        mcServer.getConfigurationManager().transferPlayerToDimension(player, ThisisHalloween.DIMENSIONID, new TeleporterFrightful(mcServer.worldServerForDimension(thisishalloween.ThisisHalloween.DIMENSIONID)));
                        player.timeUntilPortal = 100;
                        }
                        else
                        {
                        
                        mcServer.getConfigurationManager().transferPlayerToDimension(player, 0, new TeleporterFrightful(mcServer.worldServerForDimension(0)));
                        player.timeUntilPortal = 100;
                        }
                        }
                        else {
                        travelToDimension(entityIn, id);
                        }
                        }
                        }
                        
                        private void travelToDimension(Entity entity, int id)
                        {
                        if (!entity.worldObj.isRemote && !entity.isDead)
                        {
                        entity.worldObj.theProfiler.startSection("changeDimension");
                        MinecraftServer minecraftserver = MinecraftServer.getServer();
                        int j = entity.dimension;
                        WorldServer worldserver = minecraftserver.worldServerForDimension(j);
                        WorldServer worldserver1 = minecraftserver.worldServerForDimension(id);
                        entity.dimension = id;
                        
                        if (j == 1 && id == 1) {
                        worldserver1 = minecraftserver.worldServerForDimension(0);
                        entity.dimension = 0;
                        }
                        
                        entity.worldObj.removeEntity(entity);
                        entity.isDead = false;
                        entity.worldObj.theProfiler.startSection("reposition");
                        minecraftserver.getConfigurationManager().transferEntityToWorld(entity, j, worldserver, worldserver1, new Teleporter(worldserver1));
                        entity.worldObj.theProfiler.endStartSection("reloading");
                        Entity entity1 = EntityList.createEntityByName(EntityList.getEntityString(entity), worldserver1);
                        
                        if (entity1 != null) {
                        entity1.copyDataFromOld(entity);
                        
                        if (j == 1 && id == 1) {
                        BlockPos spawnPoint = worldserver1.getSpawnPoint();
                        spawnPoint = entity.worldObj.getTopSolidOrLiquidBlock(spawnPoint);
                        entity1.setLocationAndAngles(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(), entity1.rotationYaw, entity1.rotationPitch);
                        }
                        
                        worldserver1.spawnEntityInWorld(entity1);
                        }
                        
                        entity.isDead = true;
                        entity.worldObj.theProfiler.endSection();
                        worldserver.resetUpdateEntityTick();
                        worldserver1.resetUpdateEntityTick();
                        entity.worldObj.theProfiler.endSection();
                        }
                        }
                        
                        public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_)
                        {
                        transferEntityToWorld(entityIn, thisishalloween.ThisisHalloween.DIMENSIONID, DimensionManager.getWorld(0), DimensionManager.getWorld(thisishalloween.ThisisHalloween.DIMENSIONID));
                        }
                        /**
                        * Convert the given metadata into a BlockState for this Block
                        */
                        public IBlockState getStateFromMeta(int meta)
                        {
                        return this.getDefaultState().withProperty(AXIS, (meta & 3) == 2 ? EnumFacing.Axis.Z : EnumFacing.Axis.X);
                        }
                        
                        @SideOnly(Side.CLIENT)
                        public EnumWorldBlockLayer getBlockLayer()
                        {
                        return EnumWorldBlockLayer.TRANSLUCENT;
                        }
                        
                        @SideOnly(Side.CLIENT)
                        public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
                        {
                        if (rand.nextInt(100) == 0)
                        {
                        worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "portal.portal", 0.5F, rand.nextFloat() * 0.4F + 0.8F, false);
                        }
                        
                        for (int i = 0; i < 4; ++i)
                        {
                        double d0 = (double)((float)pos.getX() + rand.nextFloat());
                        double d1 = (double)((float)pos.getY() + rand.nextFloat());
                        double d2 = (double)((float)pos.getZ() + rand.nextFloat());
                        double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
                        double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
                        double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
                        int j = rand.nextInt(2) * 2 - 1;
                        
                        if (worldIn.getBlockState(pos.west()).getBlock() != this && worldIn.getBlockState(pos.east()).getBlock() != this)
                        {
                        d0 = (double)pos.getX() + 0.5D + 0.25D * (double)j;
                        d3 = (double)(rand.nextFloat() * 2.0F * (float)j);
                        }
                        else
                        {
                        d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)j;
                        d5 = (double)(rand.nextFloat() * 2.0F * (float)j);
                        }
                        
                        worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]);
                        }
                        }
                        
                        /**
                        * Convert the BlockState into the correct metadata value
                        */
                        public int getMetaFromState(IBlockState state)
                        {
                        return getMetaForAxis((EnumFacing.Axis)state.getValue(AXIS));
                        }
                        
                        @SideOnly(Side.CLIENT)
                        public Item getItem(World worldIn, BlockPos pos)
                        {
                        return null;
                        }
                        
                        protected BlockState createBlockState()
                        {
                        return new BlockState(this, new IProperty[] {AXIS});
                        }
                        
                        public static class Size
                        {
                        private final World world;
                        private final EnumFacing.Axis axis;
                        private final EnumFacing field_150866_c;
                        private final EnumFacing field_150863_d;
                        private int field_150864_e = 0;
                        private BlockPos field_150861_f;
                        private int field_150862_g;
                        private int field_150868_h;
                        
                        public Size(World worldIn, BlockPos p_i45694_2_, EnumFacing.Axis p_i45694_3_)
                        {
                        this.world = worldIn;
                        this.axis = p_i45694_3_;
                        
                        if (p_i45694_3_ == EnumFacing.Axis.X)
                        {
                        this.field_150863_d = EnumFacing.EAST;
                        this.field_150866_c = EnumFacing.WEST;
                        }
                        else
                        {
                        this.field_150863_d = EnumFacing.NORTH;
                        this.field_150866_c = EnumFacing.SOUTH;
                        }
                        
                        for (BlockPos blockpos1 = p_i45694_2_; p_i45694_2_.getY() > blockpos1.getY() - 21 && p_i45694_2_.getY() > 0 && this.func_150857_a(worldIn.getBlockState(p_i45694_2_.down()).getBlock()); p_i45694_2_ = p_i45694_2_.down())
                        {
                        ;
                        }
                        
                        int i = this.func_180120_a(p_i45694_2_, this.field_150863_d) - 1;
                        
                        if (i >= 0)
                        {
                        this.field_150861_f = p_i45694_2_.offset(this.field_150863_d, i);
                        this.field_150868_h = this.func_180120_a(this.field_150861_f, this.field_150866_c);
                        
                        if (this.field_150868_h < 2 || this.field_150868_h > 21)
                        {
                        this.field_150861_f = null;
                        this.field_150868_h = 0;
                        }
                        }
                        
                        if (this.field_150861_f != null)
                        {
                        this.field_150862_g = this.func_150858_a();
                        }
                        }
                        
                        protected int func_180120_a(BlockPos p_180120_1_, EnumFacing p_180120_2_)
                        {
                        int i;
                        
                        for (i = 0; i < 22; ++i)
                        {
                        BlockPos blockpos1 = p_180120_1_.offset(p_180120_2_, i);
                        
                        if (!this.func_150857_a(this.world.getBlockState(blockpos1).getBlock()) || this.world.getBlockState(blockpos1.down()).getBlock() != Blocks.obsidian)
                        {
                        break;
                        }
                        }
                        
                        Block block = this.world.getBlockState(p_180120_1_.offset(p_180120_2_, i)).getBlock();
                        return block == Blocks.nether_brick ? i : 0;
                        }
                        
                        protected int func_150858_a()
                        {
                        int i;
                        label56:
                        
                        for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g)
                        {
                        for (i = 0; i < this.field_150868_h; ++i)
                        {
                        BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i).up(this.field_150862_g);
                        Block block = this.world.getBlockState(blockpos).getBlock();
                        
                        if (!this.func_150857_a(block))
                        {
                        break label56;
                        }
                        
                        if (block == CreateBlocks.portalFrightful)
                        {
                        ++this.field_150864_e;
                        }
                        
                        if (i == 0)
                        {
                        block = this.world.getBlockState(blockpos.offset(this.field_150863_d)).getBlock();
                        
                        if (block != Blocks.nether_brick)
                        {
                        break label56;
                        }
                        }
                        else if (i == this.field_150868_h - 1)
                        {
                        block = this.world.getBlockState(blockpos.offset(this.field_150866_c)).getBlock();
                        
                        if (block != Blocks.nether_brick)
                        {
                        break label56;
                        }
                        }
                        }
                        }
                        
                        for (i = 0; i < this.field_150868_h; ++i)
                        {
                        if (this.world.getBlockState(this.field_150861_f.offset(this.field_150866_c, i).up(this.field_150862_g)).getBlock() != Blocks.nether_brick)
                        {
                        this.field_150862_g = 0;
                        break;
                        }
                        }
                        
                        if (this.field_150862_g <= 21 && this.field_150862_g >= 3)
                        {
                        return this.field_150862_g;
                        }
                        else
                        {
                        this.field_150861_f = null;
                        this.field_150868_h = 0;
                        this.field_150862_g = 0;
                        return 0;
                        }
                        }
                        
                        protected boolean func_150857_a(Block p_150857_1_)
                        {
                        return p_150857_1_.getMaterial() == Material.air || p_150857_1_ == CreateBlocks.portalFrightful;
                        }
                        
                        public boolean func_150860_b()
                        {
                        return this.field_150861_f != null && this.field_150868_h >= 2 && this.field_150868_h <= 21 && this.field_150862_g >= 3 && this.field_150862_g <= 21;
                        }
                        
                        public void func_150859_c()
                        {
                        for (int i = 0; i < this.field_150868_h; ++i)
                        {
                        BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i);
                        
                        for (int j = 0; j < this.field_150862_g; ++j)
                        {
                        this.world.setBlockState(blockpos.up(j), CreateBlocks.portalFrightful.getDefaultState().withProperty(BlockPortalFrightful.AXIS, this.axis), 2);
                        }
                        }
                        }
                        }
                        }
                        

                        Je n’est pas compris quel block tu veux. Si tu parles de la structure, c’est la nether brick mais on pourra pas la modifier

                        Pour l’eau, je vais regarder du côté des event alors

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

                          Je vais regarder pour ton code, le bloc en fait j’en ait pas besoin et pour l’event, si il existe, c’est surement un event de rendu, et comme type ça sera Rain (par exemple RenderGameOverlayEvent a plusieurs sous-types).

                          Alors j’ai comparé ton code au mien, et (sans rentrer dans les détails) il n’y pas de différence, as-tu essayé d’aller dans le nether ?

                          Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                          AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                          Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                          Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                            Désolé du temps de la réponse, je viens de voir que t’avais édité le message (et j’étais pas chez moi je suis rentrer y’a une heure).
                            Par là, tu veux dire aller dans le nether en utilisant mon portail ? (je pense que oui)
                            C’est pareil, le portal reste éteint. Du coup, je me retrouve dans des blocks.
                            Mais c’est bizarre, tu me dis que t’as comparé mon code avec le tien, et c’est pareil alors que toi ça marche et pas moi. Une autre classe doit avoir un rapport alors, mais quoi (et comment vu que rien n’est appelé ?)

                            Pour l’orage sans pluie, il n’y a pas d’évent ou truc en rapport avec (du moins, je n’en ai pas trouvé). C’est dommage, ça aurait pu faire bien pour un mod apocalypse. Peut-être pour l’année prochaine si je trouve 🙂

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

                              Non je voulais que tu utilises le portail vanilla pour voir si ça ne venait pas de Mc, mais essayer avec le tien est bien aussi. Ce bug est quand même bizarre, sinon je peux te proposer de me donner les fichiers de ta classe de ton portail et ton teleporter que je testerais pour aller dans ma dimension.
                              Pour l’orage j’essaierai de voir comment mc gère ça.

                              Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                              AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                              Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                              Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                                Désolé j’ai mal compris, je viens de tester d’aller dans le Nether et dans ma dimension avec le teleporter d’origine, et ça marche bien, le portail est bien créé.
                                Je veux bien que tu teste mes classes si ça ne t’embête pas  😉   Je les ai mis en pièce jointe

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

                                  Ok je test ce soir ou demain 😉

                                  Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                                  AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                                  Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                                  Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                                    Ok merci 😉
                                    En attendant, je vais chercher pour mes autres problèmes (changer le WorldType et, si j’ai le temps et le courage, voir pour activer l’orage sans la pluie)

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

                                      Alors après tests et debug, je reviens avec une solution fonctionnelle.
                                      Le problème est que les blocks du portails s’auto-détruisent si le portail n’est pas complet, la solution est donc de créer une boolean qui ser sur true pendant la téléportation, ensuite, dans onNeighborBlockChange, il faut empêcher la destruction du block si la boolean est sur true puis avant chaque appel au teleporter, mettre la boolean sur true et la remettre sur false juste après l’appel au teleporter, j’ai testé et ça marche. Quelque chose de semblable doit être hardcodé quelque part dans Minecraft

                                      PS : dans ta fonction travelToDimension, tu utilises le Teleporter vanilla au lieu du tien.

                                      Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                                      AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                                      Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                                      Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

                                      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

                                        ou juste faire un world.setBlockState(pos, state, 0) pour éviter que les blocs autour soit refresh.
                                        Il y a deux fonctions, world.setBlockState(pos, state) et world.setBlockState(pos, state, flag).
                                        La première fait simplement un world.setBlockState(pos, state, 3).
                                        Il y a 4 flags possible :

                                        • 0 : rien du tout
                                        • 1 : notifie l’ajout du bloc côté serveur (appel les fonctions onNeighborBlockChange des blocs qui sont autours)
                                        • 2 : notifie l’ajout du bloc côté client (rafraîchi le chunk)
                                        • 4 : force le bloc a être re-rendu (jamais vu de différence avec le 2)
                                          les flags peuvent s’additionner, donc 3 = 1 + 2.
                                        1 réponse Dernière réponse Répondre Citer 0
                                        • AxaurusA Hors-ligne
                                          Axaurus
                                          dernière édition par

                                          Salut
                                          J’ai testé la méthode d’Aymeric et elle marche très bien. Je n’ai pas testé ta méthode, Robin, mais je présume qu’elle devrait marcher. En tout cas, merci à toi pour ces explications des flag. Et merci aussi à Aymeric pour son aide. Par contre, quand j’ai voulu mettre le code ici, j’ai vu que j’ai fait qu’avant le tp, ça mettait la boolean à false et ça la mettait à true après le tp. J’ai inverser les deux pour faire comme tu m’as dit (true avant le teleporter et false après), mais ça marche pas.

                                          Je met le code pour ceux qui en aurait besoin :
                                          L’appel au teleporter :

                                          ThisisHalloween.portal = false;
                                          mcServer.getConfigurationManager().transferPlayerToDimension(player, ThisisHalloween.DIMENSIONID, new TeleporterFrightful(mcServer.worldServerForDimension(ThisisHalloween.DIMENSIONID)));
                                          player.timeUntilPortal = 100;
                                          ThisisHalloween.portal = true;
                                          

                                          onNeighborBlockChange :

                                          public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
                                          {
                                          EnumFacing.Axis axis = (EnumFacing.Axis)state.getValue(AXIS);
                                          BlockPortalFrightful.Size size;
                                          
                                          if (axis == EnumFacing.Axis.X)
                                          {
                                          size = new BlockPortalFrightful.Size(worldIn, pos, EnumFacing.Axis.X);
                                          
                                          if (!size.func_150860_b() || size.field_150864_e < size.field_150868_h * size.field_150862_g)
                                          {
                                          if(ThisisHalloween.portal)
                                          {
                                          worldIn.setBlockState(pos, Blocks.air.getDefaultState());
                                          }
                                          }
                                          }
                                          else if (axis == EnumFacing.Axis.Z)
                                          {
                                          size = new BlockPortalFrightful.Size(worldIn, pos, EnumFacing.Axis.Z);
                                          
                                          if (!size.func_150860_b() || size.field_150864_e < size.field_150868_h * size.field_150862_g)
                                          {
                                          if(ThisisHalloween.portal)
                                          {
                                          worldIn.setBlockState(pos, Blocks.air.getDefaultState());
                                          }
                                          }
                                          }
                                          }
                                          

                                          Maintenant, me reste plus qu’à chercher pourquoi Frightful (ma dimension) prend le WorldType de l’Overworld alors qu’avant non, ça prenait le DEFAULT.

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

                                            Pour la boolean, c’est normal, dans la fonction onNeigtborBlockChange, j’avais mis des ! devant la boolean.

                                            Envoyé via mobile

                                            Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                                            AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                                            Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                                            Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB