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.
    • 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
      • AxaurusA Hors-ligne
        Axaurus
        dernière édition par

        J’ai résolu le problème du WorldType. En fait, mon WorldProvider n’utilisait pas le ChunkProvider. Du coup, ça prenait le même que l’Overworld. Mais j’ai un nouveau problème : je spawn une fois sur deux normalement (sur l’herbe en pleine nature) et une fois sur deux dans une mine ou une crevasse. Du coup, je sais pas comment faire.
        Voilà mon ChunkProvider :

        package thisishalloween.world.frightful;
        
        import java.util.List;
        import java.util.Random;
        import net.minecraft.block.Block;
        import net.minecraft.block.BlockFalling;
        import net.minecraft.entity.EnumCreatureType;
        import net.minecraft.init.Blocks;
        import net.minecraft.util.BlockPos;
        import net.minecraft.util.IProgressUpdate;
        import net.minecraft.util.MathHelper;
        import net.minecraft.world.ChunkCoordIntPair;
        import net.minecraft.world.SpawnerAnimals;
        import net.minecraft.world.World;
        import net.minecraft.world.WorldType;
        import net.minecraft.world.biome.BiomeGenBase;
        import net.minecraft.world.chunk.Chunk;
        import net.minecraft.world.chunk.ChunkPrimer;
        import net.minecraft.world.chunk.IChunkProvider;
        import net.minecraft.world.gen.ChunkProviderSettings;
        import net.minecraft.world.gen.MapGenBase;
        import net.minecraft.world.gen.MapGenCaves;
        import net.minecraft.world.gen.MapGenRavine;
        import net.minecraft.world.gen.NoiseGenerator;
        import net.minecraft.world.gen.NoiseGeneratorOctaves;
        import net.minecraft.world.gen.NoiseGeneratorPerlin;
        import net.minecraft.world.gen.feature.WorldGenDungeons;
        import net.minecraft.world.gen.feature.WorldGenLakes;
        import net.minecraft.world.gen.structure.MapGenMineshaft;
        import net.minecraft.world.gen.structure.MapGenScatteredFeature;
        import net.minecraft.world.gen.structure.MapGenStronghold;
        import net.minecraft.world.gen.structure.MapGenVillage;
        import net.minecraft.world.gen.structure.StructureOceanMonument;
        import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*;
        import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*;
        import net.minecraftforge.common.*;
        import net.minecraftforge.fml.common.eventhandler.Event.*;
        import net.minecraftforge.event.terraingen.*;
        
        public class ChunkProviderFrightful implements IChunkProvider
        {
           /** RNG. */
           private Random rand;
           private NoiseGeneratorOctaves field_147431_j;
           private NoiseGeneratorOctaves field_147432_k;
           private NoiseGeneratorOctaves field_147429_l;
           private NoiseGeneratorPerlin field_147430_m;
           public NoiseGeneratorOctaves noiseGen5;
           public NoiseGeneratorOctaves noiseGen6;
           public NoiseGeneratorOctaves mobSpawnerNoise;
           private World worldObj;
           private final boolean mapFeaturesEnabled;
           private WorldType field_177475_o;
           private final double[] field_147434_q;
           private final float[] parabolicField;
           private ChunkProviderSettings settings;
           private Block field_177476_s;
           private double[] stoneNoise;
           private MapGenBase caveGenerator;
           private MapGenMineshaft mineshaftGenerator;
           private MapGenScatteredFeature scatteredFeatureGenerator;
           /** Holds ravine generator */
           private MapGenBase ravineGenerator;
           private BiomeGenBase[] biomesForGeneration;
           double[] field_147427_d;
           double[] field_147428_e;
           double[] field_147425_f;
           double[] field_147426_g;
        
           public ChunkProviderFrightful(World worldIn, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_)
           {
               this.field_177476_s = Blocks.water;
               this.stoneNoise = new double[256];
               this.caveGenerator = new MapGenCaves();
               this.mineshaftGenerator = new MapGenMineshaft();
               this.scatteredFeatureGenerator = new MapGenScatteredFeature();
               this.ravineGenerator = new MapGenRavine();
               {
                   caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
                   mineshaftGenerator = (MapGenMineshaft)TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT);
                   scatteredFeatureGenerator = (MapGenScatteredFeature)TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE);
                   ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE);
               }
               this.worldObj = worldIn;
               this.mapFeaturesEnabled = p_i45636_4_;
               this.field_177475_o = worldIn.getWorldInfo().getTerrainType();
               this.rand = new Random(p_i45636_2_);
               this.field_147431_j = new NoiseGeneratorOctaves(this.rand, 16);
               this.field_147432_k = new NoiseGeneratorOctaves(this.rand, 16);
               this.field_147429_l = new NoiseGeneratorOctaves(this.rand, 8);
               this.field_147430_m = new NoiseGeneratorPerlin(this.rand, 4);
               this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);
               this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
               this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8);
               this.field_147434_q = new double[825];
               this.parabolicField = new float[25];
        
               for (int j = -2; j <= 2; ++j)
               {
                   for (int k = -2; k <= 2; ++k)
                   {
                       float f = 10.0F / MathHelper.sqrt_float((float)(j * j + k * k) + 0.2F);
                       this.parabolicField[j + 2 + (k + 2) * 5] = f;
                   }
               }
        
               if (p_i45636_5_ != null)
               {
                   this.settings = ChunkProviderSettings.Factory.func_177865_a(p_i45636_5_).func_177864_b();
                   this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water;
               }
        
               NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise};
               noiseGens = TerrainGen.getModdedNoiseGenerators(worldIn, this.rand, noiseGens);
               this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0];
               this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1];
               this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2];
               this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3];
               this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4];
               this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5];
               this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6];
           }
        
           public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_)
           {
               this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, p_180518_1_ * 4 - 2, p_180518_2_ * 4 - 2, 10, 10);
               this.func_147423_a(p_180518_1_ * 4, 0, p_180518_2_ * 4);
        
               for (int k = 0; k < 4; ++k)
               {
                   int l = k * 5;
                   int i1 = (k + 1) * 5;
        
                   for (int j1 = 0; j1 < 4; ++j1)
                   {
                       int k1 = (l + j1) * 33;
                       int l1 = (l + j1 + 1) * 33;
                       int i2 = (i1 + j1) * 33;
                       int j2 = (i1 + j1 + 1) * 33;
        
                       for (int k2 = 0; k2 < 32; ++k2)
                       {
                           double d0 = 0.125D;
                           double d1 = this.field_147434_q[k1 + k2];
                           double d2 = this.field_147434_q[l1 + k2];
                           double d3 = this.field_147434_q[i2 + k2];
                           double d4 = this.field_147434_q[j2 + k2];
                           double d5 = (this.field_147434_q[k1 + k2 + 1] - d1) * d0;
                           double d6 = (this.field_147434_q[l1 + k2 + 1] - d2) * d0;
                           double d7 = (this.field_147434_q[i2 + k2 + 1] - d3) * d0;
                           double d8 = (this.field_147434_q[j2 + k2 + 1] - d4) * d0;
        
                           for (int l2 = 0; l2 < 8; ++l2)
                           {
                               double d9 = 0.25D;
                               double d10 = d1;
                               double d11 = d2;
                               double d12 = (d3 - d1) * d9;
                               double d13 = (d4 - d2) * d9;
        
                               for (int i3 = 0; i3 < 4; ++i3)
                               {
                                   double d14 = 0.25D;
                                   double d16 = (d11 - d10) * d14;
                                   double d15 = d10 - d16;
        
                                   for (int j3 = 0; j3 < 4; ++j3)
                                   {
                                       if ((d15 += d16) > 0.0D)
                                       {
                                           p_180518_3_.setBlockState(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, Blocks.stone.getDefaultState());
                                       }
                                       else if (k2 * 8 + l2 < this.settings.seaLevel)
                                       {
                                           p_180518_3_.setBlockState(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, this.field_177476_s.getDefaultState());
                                       }
                                   }
        
                                   d10 += d12;
                                   d11 += d13;
                               }
        
                               d1 += d5;
                               d2 += d6;
                               d3 += d7;
                               d4 += d8;
                           }
                       }
                   }
               }
           }
        
           public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_)
           {
               ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj);
               MinecraftForge.EVENT_BUS.post(event);
               if (event.getResult() == Result.DENY) return;
        
               double d0 = 0.03125D;
               this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
        
               for (int k = 0; k < 16; ++k)
               {
                   for (int l = 0; l < 16; ++l)
                   {
                       BiomeGenBase biomegenbase = p_180517_4_[l + k * 16];
                       biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_180517_3_, p_180517_1_ * 16 + k, p_180517_2_ * 16 + l, this.stoneNoise[l + k * 16]);
                   }
               }
           }
        
           /**
            * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
            * specified chunk from the map seed and chunk seed
            */
           public Chunk provideChunk(int x, int z)
           {
               this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
               ChunkPrimer chunkprimer = new ChunkPrimer();
               this.setBlocksInChunk(x, z, chunkprimer);
               this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16);
               this.func_180517_a(x, z, chunkprimer, this.biomesForGeneration);
        
               if (this.settings.useCaves)
               {
                   this.caveGenerator.func_175792_a(this, this.worldObj, x, z, chunkprimer);
               }
        
               if (this.settings.useRavines)
               {
                   this.ravineGenerator.func_175792_a(this, this.worldObj, x, z, chunkprimer);
               }
        
               if (this.settings.useMineShafts && this.mapFeaturesEnabled)
               {
                   this.mineshaftGenerator.func_175792_a(this, this.worldObj, x, z, chunkprimer);
               }
        
               Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
               byte[] abyte = chunk.getBiomeArray();
        
               for (int k = 0; k < abyte.length; ++k)
               {
                   abyte[k] = (byte)this.biomesForGeneration[k].biomeID;
               }
        
               chunk.generateSkylightMap();
               return chunk;
           }
        
           private void func_147423_a(int p_147423_1_, int p_147423_2_, int p_147423_3_)
           {
               this.field_147426_g = this.noiseGen6.generateNoiseOctaves(this.field_147426_g, p_147423_1_, p_147423_3_, 5, 5, (double)this.settings.depthNoiseScaleX, (double)this.settings.depthNoiseScaleZ, (double)this.settings.depthNoiseScaleExponent);
               float f = this.settings.coordinateScale;
               float f1 = this.settings.heightScale;
               this.field_147427_d = this.field_147429_l.generateNoiseOctaves(this.field_147427_d, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, (double)(f / this.settings.mainNoiseScaleX), (double)(f1 / this.settings.mainNoiseScaleY), (double)(f / this.settings.mainNoiseScaleZ));
               this.field_147428_e = this.field_147431_j.generateNoiseOctaves(this.field_147428_e, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, (double)f, (double)f1, (double)f);
               this.field_147425_f = this.field_147432_k.generateNoiseOctaves(this.field_147425_f, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, (double)f, (double)f1, (double)f);
               boolean flag1 = false;
               boolean flag = false;
               int l = 0;
               int i1 = 0;
        
               for (int j1 = 0; j1 < 5; ++j1)
               {
                   for (int k1 = 0; k1 < 5; ++k1)
                   {
                       float f2 = 0.0F;
                       float f3 = 0.0F;
                       float f4 = 0.0F;
                       byte b0 = 2;
                       BiomeGenBase biomegenbase = this.biomesForGeneration[j1 + 2 + (k1 + 2) * 10];
        
                       for (int l1 = -b0; l1 <= b0; ++l1)
                       {
                           for (int i2 = -b0; i2 <= b0; ++i2)
                           {
                               BiomeGenBase biomegenbase1 = this.biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10];
                               float f5 = this.settings.biomeDepthOffSet + biomegenbase1.minHeight * this.settings.biomeDepthWeight;
                               float f6 = this.settings.biomeScaleOffset + biomegenbase1.maxHeight * this.settings.biomeScaleWeight;
        
                               float f7 = this.parabolicField[l1 + 2 + (i2 + 2) * 5] / (f5 + 2.0F);
        
                               if (biomegenbase1.minHeight > biomegenbase.minHeight)
                               {
                                   f7 /= 2.0F;
                               }
        
                               f2 += f6 * f7;
                               f3 += f5 * f7;
                               f4 += f7;
                           }
                       }
        
                       f2 /= f4;
                       f3 /= f4;
                       f2 = f2 * 0.9F + 0.1F;
                       f3 = (f3 * 4.0F - 1.0F) / 8.0F;
                       double d7 = this.field_147426_g[i1] / 8000.0D;
        
                       if (d7 < 0.0D)
                       {
                           d7 = -d7 * 0.3D;
                       }
        
                       d7 = d7 * 3.0D - 2.0D;
        
                       if (d7 < 0.0D)
                       {
                           d7 /= 2.0D;
        
                           if (d7 < -1.0D)
                           {
                               d7 = -1.0D;
                           }
        
                           d7 /= 1.4D;
                           d7 /= 2.0D;
                       }
                       else
                       {
                           if (d7 > 1.0D)
                           {
                               d7 = 1.0D;
                           }
        
                           d7 /= 8.0D;
                       }
        
                       ++i1;
                       double d8 = (double)f3;
                       double d9 = (double)f2;
                       d8 += d7 * 0.2D;
                       d8 = d8 * (double)this.settings.baseSize / 8.0D;
                       double d0 = (double)this.settings.baseSize + d8 * 4.0D;
        
                       for (int j2 = 0; j2 < 33; ++j2)
                       {
                           double d1 = ((double)j2 - d0) * (double)this.settings.stretchY * 128.0D / 256.0D / d9;
        
                           if (d1 < 0.0D)
                           {
                               d1 *= 4.0D;
                           }
        
                           double d2 = this.field_147428_e[l] / (double)this.settings.lowerLimitScale;
                           double d3 = this.field_147425_f[l] / (double)this.settings.upperLimitScale;
                           double d4 = (this.field_147427_d[l] / 10.0D + 1.0D) / 2.0D;
                           double d5 = MathHelper.denormalizeClamp(d2, d3, d4) - d1;
        
                           if (j2 > 29)
                           {
                               double d6 = (double)((float)(j2 - 29) / 3.0F);
                               d5 = d5 * (1.0D - d6) + -10.0D * d6;
                           }
        
                           this.field_147434_q[l] = d5;
                           ++l;
                       }
                   }
               }
           }
        
           /**
            * Checks to see if a chunk exists at x, z
            */
           public boolean chunkExists(int x, int z)
           {
               return true;
           }
        
           /**
            * Populates chunk with ores etc etc
            */
           public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_)
           {
               BlockFalling.fallInstantly = true;
               int k = p_73153_2_ * 16;
               int l = p_73153_3_ * 16;
               BlockPos blockpos = new BlockPos(k, 0, l);
               BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos.add(16, 0, 16));
               this.rand.setSeed(this.worldObj.getSeed());
               long i1 = this.rand.nextLong() / 2L * 2L + 1L;
               long j1 = this.rand.nextLong() / 2L * 2L + 1L;
               this.rand.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.worldObj.getSeed());
               boolean flag = false;
               ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_);
        
               MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));
        
               if (this.settings.useMineShafts && this.mapFeaturesEnabled)
               {
                   this.mineshaftGenerator.func_175794_a(this.worldObj, this.rand, chunkcoordintpair);
               }
        
               if (this.settings.useTemples && this.mapFeaturesEnabled)
               {
                   this.scatteredFeatureGenerator.func_175794_a(this.worldObj, this.rand, chunkcoordintpair);
               }
        
               int k1;
               int l1;
               int i2;
        
               if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0
                   && TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAKE))
               {
                   k1 = this.rand.nextInt(16) + 8;
                   l1 = this.rand.nextInt(256);
                   i2 = this.rand.nextInt(16) + 8;
                   (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, blockpos.add(k1, l1, i2));
               }
        
               if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAVA) && !flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes)
               {
                   k1 = this.rand.nextInt(16) + 8;
                   l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
                   i2 = this.rand.nextInt(16) + 8;
        
                   if (l1 < 63 || this.rand.nextInt(this.settings.lavaLakeChance / 8) == 0)
                   {
                       (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, blockpos.add(k1, l1, i2));
                   }
               }
        
               biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(k, 0, l));
               if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ANIMALS))
               {
               SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
               }
               blockpos = blockpos.add(8, 0, 8);
        
               boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ICE);
               for (k1 = 0; doGen && k1 < 16; ++k1)
               {
                   for (l1 = 0; l1 < 16; ++l1)
                   {
                       BlockPos blockpos1 = this.worldObj.getPrecipitationHeight(blockpos.add(k1, 0, l1));
                       BlockPos blockpos2 = blockpos1.down();
        
                       if (this.worldObj.func_175675_v(blockpos2))
                       {
                           this.worldObj.setBlockState(blockpos2, Blocks.ice.getDefaultState(), 2);
                       }
                   }
               }
        
               MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));
        
               BlockFalling.fallInstantly = false;
           }
        
           public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_)
           {
               return false;
           }
        
           /**
            * Two modes of operation: if passed true, save all Chunks in one go.  If passed false, save up to two chunks.
            * Return true if all chunks have been saved.
            */
           public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_)
           {
               return true;
           }
        
           /**
            * Save extra data not associated with any Chunk.  Not saved during autosave, only during world unload.  Currently
            * unimplemented.
            */
           public void saveExtraData() {}
        
           /**
            * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
            */
           public boolean unloadQueuedChunks()
           {
               return false;
           }
        
           /**
            * Returns if the IChunkProvider supports saving.
            */
           public boolean canSave()
           {
               return true;
           }
        
           /**
            * Converts the instance data to a readable string.
            */
           public String makeString()
           {
               return "RandomLevelSource";
           }
        
           public List func_177458_a(EnumCreatureType p_177458_1_, BlockPos p_177458_2_)
           {
               BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(p_177458_2_);
        
               if (this.mapFeaturesEnabled)
               {
                   if (p_177458_1_ == EnumCreatureType.MONSTER && this.scatteredFeatureGenerator.func_175798_a(p_177458_2_))
                   {
                       return this.scatteredFeatureGenerator.getScatteredFeatureSpawnList();
                   }
               }
        
               return biomegenbase.getSpawnableList(p_177458_1_);
           }
        
           public BlockPos getStrongholdGen(World worldIn, String p_180513_2_, BlockPos p_180513_3_)
           {
               return null;
           }
        
           public int getLoadedChunkCount()
           {
               return 0;
           }
        
           public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_)
           {
               if (this.settings.useMineShafts && this.mapFeaturesEnabled)
               {
                   this.mineshaftGenerator.func_175792_a(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
               }
        
               if (this.settings.useTemples && this.mapFeaturesEnabled)
               {
                   this.scatteredFeatureGenerator.func_175792_a(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
               }
           }
        
           public Chunk provideChunk(BlockPos blockPosIn)
           {
               return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4);
           }
        
           public BlockPos findBiomePosition(int x, int z, int range, List biomes, Random random)
           {
               return biomes.contains(this.biomesForGeneration) ? new BlockPos(x - range + random.nextInt(range * 2 + 1), 0, z - range + random.nextInt(range * 2 + 1)) : null;
           }
        }
        

        Pourtant, je me suis inspiré de celui de base pour le refaire et j’ai aussi regarder celui du nether, mais je trouve rien.

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

          Avant, je voulais désactiver la pluie et laisser l’orage. Mais on m’a dit que c’était dur. Et bah j’ai trouvé. Il faut le faire en 2 étapes : désactiver la pluie puis faire spawner des éclairs aléatoirement.
          Pour mon cas, je ne voulais que l’orage uniquement pendant l’apocalypse. Donc, j’ai désactiver la pluie au moment où on déclenche l’apocalypse. Le problème que j’avais, c’était qu’on pouvait désactiver la pluie uniquement pendant un certain temps. Du coup, je me suis dit que si un mec laisse l’apocalypse pendant lontemps, la pluie reviendrai. Et bah non, j’ai mis un calcul qui fait un temps très très long :::
          158 548 958 années 4 heures 8 minutes 14 secondes. Au moins, je suis large 
          ::: Et j’ai testé, quand on désactive l’apocalypse, vu que j’ai dit qu’il pleut, et bah il pleut bien. Et en faisant la commande de la pluie, ça fait rien. Ce qui a fait mon bonheur 😄

          Pour les intéressés (ou juste pour les curieux), voilà comment j’ai fait : ```java
          WorldServer worldserver = MinecraftServer.getServer().worldServers[0];
          WorldInfo worldinfo = worldserver.getWorldInfo();
          worldinfo.setCleanWeatherTime(i);

          
          Me reste plus qu'un seul truc pour finir mon mod : quand le WorldType de l'Overworld est flatgrass, je spawn parfois dans une mine dans ma dimension :-/
          (en réalité, me reste 2 choses en plus : mettre à jour en 1.9 et 1.10 et donner un loot à mon boss)
          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

            Surement un problème de hauteur.
            Faut regarder du côté du téléporteur.

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

              Salut
              Je regarderai quand même quand je serai sur mon ordinateur mais ça paraîtrai bizarre que ça vienne du teleporter : c’est du copier/coller de celui de base, j’ai juste modifier les blocks. Je me suis dit aussi que je pourrais tester d’utiliser le teleporter de base pour aller dans ma dimension puis le mien pour aller dans le nether.

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

                Justement le Téléporter de base te tp à une hauteur qui peut varier. Essaye de trouver l’endroit du Téléporter où la hauteur est choisie et tu me remplace pas world.getTopBlock (ou fonction semblable).

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

                  J’ai regardé et je n’ai rien trouvé. J’ai juste trouvé un truc pour modifier le spawn du joueur, mais ça modifie pas l’emplacement du portail.
                  Mais j’ai quand même réussi à régler sans trouver. J’ai tout simplement enlever les mines et les crevasses de ma dimension. De toute façon, elles serviraient à rien, à part d’une certaine manière pour avoir 2x fois plus de ressource.

                  Par contre, j’ai un autre problème (j’espère le dernier) : quand j’ai désactiver la pluie, la commande pour la mettre (la pluie) ne marchait pas, ce qui était bien. Mais là, elle remarche. Du coup, j’ai pensé à faire en sorte que ça intercepte la commande et ça change. Mais c’est là mon problème : ça ne marche pas.
                  Voilà mon code :

                  @SubscribeEvent
                  public void apocalypseNoRain(CommandEvent event)
                  {
                  System.out.println("command");
                  if(event.command.equals("/weather rain"))
                  {
                  System.out.println("don't rain");
                  event.sender.addChatMessage(new ChatComponentTranslation("msg.apocalypse.weather").setChatStyle((new ChatStyle().setColor(EnumChatFormatting.RED))));
                  
                  WorldServer worldserver = MinecraftServer.getServer().worldServers[0];
                  WorldInfo worldinfo = worldserver.getWorldInfo();
                             worldinfo.setRainTime(0);
                             worldinfo.setThunderTime(0);
                             worldinfo.setRaining(false);
                             worldinfo.setThundering(false);
                  }
                  }
                  
                  

                  Je sais pas du tout si c’est le bon event que j’utilise. Je pense qui si vu qu’elle s’appelle CommandEvent. De plus, quand je fait une commande ça affiche bien le message. C’est la condition qui doit buguer mais j’ai rien trouver d’autre

                  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

                    fais un print de event.command

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

                      À mon avis il faut enlever le slash du début.

                      Moddeur 1.8

                      Développeur Java

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

                        Quand j’affiche la commande, ca me donne la classe de la commande :

                        [17:23:44] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseNoRain:135]: net.minecraft.command.CommandWeather@384edc3b
                        

                        Du coup, j’ai testé comme ça : ```java
                        if(event.command.equals(new CommandWeather()))

                        
                        @Snowy_1803 : j'ai aussi testé d'enlevé le / mais c'est pas mieux
                        1 réponse Dernière réponse Répondre Citer 0
                        • BrokenSwingB Hors-ligne
                          BrokenSwing Moddeurs confirmés Rédacteurs
                          dernière édition par

                          C’est plutôt ;:

                          
                          if(event.command instanceof CommandWeather)
                          
                          
                          1 réponse Dernière réponse Répondre Citer 0
                          • AxaurusA Hors-ligne
                            Axaurus
                            dernière édition par

                            Effectivement, ça marche mieux. Merci 😄

                            Mais j’ai un nouveau problème quand j’ai essayer de faire un truc (décidemment, je les accumule)
                            Plus tôt, j’ai fait en sorte que quand c’est l’apocalypse et que l’entité détecté est un chien, ça le transforme en loup-garou. Tout à l’heure, j’ai décidé de modifier et de faire qu’il ne se transforme qui s’il n’est pas apprivoisé (ce qui est mieux). Mais quoique je fasse, il se transforme quand même. Voilà mon code :

                            @SubscribeEvent
                            public void apocalypseMobReplace(LivingEvent event)
                            {
                            World world = event.entity.worldObj;
                            if(!world.isRemote)
                            {
                            if(ThisisHalloween.apocalypse)
                            {
                            if(event.entity instanceof EntityWolf)
                            {
                            System.out.println("wolf …");
                            EntityWolf wolf = new EntityWolf(world);
                            if(!wolf.isTamed())
                            {
                            System.out.println("... not tamed");
                            EntityWerewolf werewolf = new EntityWerewolf(world);
                            double x = event.entity.posX;
                            double y = event.entity.posY;
                            double z = event.entity.posZ;
                            float rotateX = event.entity.rotationPitch;
                            float rotateY = event.entity.rotationYaw;
                            
                            event.entity.setDead();
                            
                            werewolf.setPositionAndRotation(x, y, z, rotateX, rotateY);
                            world.spawnEntityInWorld(werewolf);
                            }
                            else
                            {
                            System.out.println("... tamed");
                            }
                            }
                            }
                            else
                            {
                            // Apocalypse disable
                            Random rand = new Random();
                            int n = rand.nextInt(3);
                            
                            switch(n)
                            {
                            case 1 :
                            if(event.entity instanceof EntityWerewolf)
                            {
                            event.entity.setDead();
                            break;
                            }
                            case 2 :
                            if(event.entity instanceof EntityWerewolf)
                            {
                            EntityWolf wolf = new EntityWolf(world);
                            double x = event.entity.posX;
                            double y = event.entity.posY;
                            double z = event.entity.posZ;
                            float rotateX = event.entity.rotationPitch;
                            float rotateY = event.entity.rotationYaw;
                            
                            event.entity.setDead();
                            
                            wolf.setPositionAndRotation(x, y, z, rotateX, rotateY);
                            world.spawnEntityInWorld(wolf);
                            break;
                            }
                            }
                            }
                            }
                            }
                            

                            Voilà les logs :

                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:212]: wolf …
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:216]: … not tamed
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:212]: wolf …
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:216]: … not tamed
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:212]: wolf …
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:216]: … not tamed
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:212]: wolf …
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:216]: … not tamed
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:212]: wolf …
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:216]: … not tamed
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:212]: wolf …
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:216]: … not tamed
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:212]: wolf …
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:216]: … not tamed
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:212]: wolf …
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:216]: … not tamed
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:212]: wolf …
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:216]: … not tamed
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:212]: wolf …
                            [18:09:32] [Server thread/INFO] [STDOUT]: [thisishalloween.CommonEventHandler:apocalypseMobReplace:216]: … not tamed
                            ...
                            
                            

                            (J’ai coupé parce que y’a que ça)
                            Apparemment, ça serait la variable isTamed qui fait buguer. J’ai aussi essayer de détecté si le chien a un propriétaire (qui revient au même) mais c’est pareil, ça marche pas.

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

                              Essai ceci :

                              
                              @SubscribeEvent
                              public void apocalypseMobReplace(LivingEvent event)
                              {
                              World world = event.entity.worldObj;
                              if(!world.isRemote)
                              {
                              if(ThisisHalloween.apocalypse)
                              {
                              if(event.entity instanceof EntityWolf)
                              {
                              EntityWolf wolf = (EntityWolf)event.entity;
                              if(!wolf.isTamed())
                              {
                              EntityWerewolf werewolf = new EntityWerewolf(world);
                              double x = wolf.posX;
                              double y = wolf.posY;
                              double z = wolf.posZ;
                              float rotateX = wolf.rotationPitch;
                              float rotateY = wolf.rotationYaw;
                              
                              event.entity.setDead();
                              
                              werewolf.setPositionAndRotation(x, y, z, rotateX, rotateY);
                              world.spawnEntityInWorld(werewolf);
                              }
                              }
                              }
                              else
                              {
                              // Apocalypse disable
                              Random rand = new Random();
                              int n = rand.nextInt(3);
                              
                              if(event.entity instanceof EntityWerewolf) {
                              switch(n)
                              {
                              case 1 :
                              event.entity.setDead();
                              break;
                              case 2 :
                              EntityWolf wolf = new EntityWolf(world);
                              double x = event.entity.posX;
                              double y = event.entity.posY;
                              double z = event.entity.posZ;
                              float rotateX = event.entity.rotationPitch;
                              float rotateY = event.entity.rotationYaw;
                              
                              event.entity.setDead();
                              
                              wolf.setPositionAndRotation(x, y, z, rotateX, rotateY);
                              world.spawnEntityInWorld(wolf);
                              }
                              }
                              }
                              }
                              }
                              
                              
                              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

                                EntityWolf wolf = new EntityWolf(world);

                                Il faut cast EntityWolf à event.entity comme BrokenSwing t’as montré, pas créer une nouvelle instance.

                                Si tu créés une nouvelle instance tu aura une instance de EntityWolf où tout à les valeurs sont par défaut, donc forcement wolf.isTamed() renvoie false.

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

                                  Parfait, ça marche. Merci 😄
                                  Mais je comprend pas pourquoi là ça marche et pas tout à l’heure. Est-ce que c’est parce que tout à l’heure je détectait l’instance d’un chien et ensuite j’instantiai la classe EntityWolf et que là, ça détecte l’instance d’un chien et ensuite ça dit que cet instance c’est un EntityWolf ? (c’est compliqué à dire mais si c’est ça je crois avoir compris)

                                  EDIT : D’après ton message, Robin, je crois que c’est ça

                                  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

                                    Un cast permet d’accéder aux méthodes d’une sous classe.
                                    Par exemple si tu as Entity dans une fonction, si cette entité est un joueur tu ne peux pas accéder aux fonctions et aux variables d’entity player.
                                    Pour ça il faut cast :
                                    EntityPlayer player = (EntityPlayer)entity;
                                    Par contre si entity n’est pas un joueur cela va déclencher une erreur ClassCastException. C’est pour ça qu’il faut d’abord vérifier avec instanceof si entity est un joueur.

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

                                      Ok merci, je crois avoir compris. Comme dit le proverbe, on en apprend tout les jours 😛

                                      EDIT : Tout les problèmes sont résolus et toutes mes questions ont eu des réponses. Il me reste plus qu’à mettre à jour. Du coup, je met ce sujet en résolu au risque d’en recréer un autre si j’ai un problème (j’espère que non) pour mettre à jour ou j’attends pour mettre en résolu ?

                                      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

                                        Comme la version ne sera plus la même il serait mieux de passer en résolu cette discussion.

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

                                        MINECRAFT FORGE FRANCE © 2024

                                        Powered by NodeBB