MFF

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

    TreeGeneration

    Planifier Épinglé Verrouillé Déplacé Non résolu Sans suite
    1.12.2
    6 Messages 3 Publieurs 451 Vues 3 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.
    • T Hors-ligne
      TionebBen3119
      dernière édition par

      Bonjour a tous cela fait un moment que j’ai fais une pause dans le codage. J’ai décidé de reprendre, j’avais commencé un mod et souhaite le continuer. J’ai créé un biome ainsi qu’une génération d’arbre malheureusement le tronc ne se trouve pas dans la bonne position : 00699dc8-4e12-498d-a409-601e6a44d0a7-image.png
      De plus Ils n’apparaissent qu’à la limite du biome et non a l’interieur de celui ci
      Voici mon code pour la generation (j’ai deja essaye de modifier la rotation du block sans succès) :

      package com.ben.heaven.world;
      
      import java.util.Random;
      
      import com.ben.heaven.init.BlocksMod;
      import com.ben.heaven.world.biomes.MagicBiome;
      
      import net.minecraft.block.BlockFlower;
      import net.minecraft.block.BlockFlower.EnumFlowerType;
      import net.minecraft.init.Blocks;
      import net.minecraft.util.Rotation;
      import net.minecraft.util.math.BlockPos;
      import net.minecraft.world.World;
      import net.minecraft.world.chunk.IChunkProvider;
      import net.minecraft.world.gen.IChunkGenerator;
      import net.minecraft.world.gen.feature.WorldGenFlowers;
      import net.minecraft.world.gen.feature.WorldGenTrees;
      import net.minecraft.world.gen.feature.WorldGenerator;
      import net.minecraftforge.fml.common.IWorldGenerator;
      
      public class WorldGenNaturalHeaven implements IWorldGenerator 
      	{	
      	private WorldGenTrees pink_magic_tree = new WorldGenTrees(false, 8,
      			BlocksMod.pink_magic_tree_trunk.getDefaultState().withRotation(Rotation.COUNTERCLOCKWISE_90), BlocksMod.pink_magic_tree_leaves.getDefaultState(),
      			false);
      			 
      			
      	@Override
      	public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
      			IChunkProvider chunkProvider) {
      		switch (world.provider.getDimension()) {
      		case 0:
      			if (world.getBiomeForCoordsBody(new BlockPos(chunkX * 16, 70, chunkZ * 16)) instanceof MagicBiome)
      				populate(pink_magic_tree, world, random, chunkX, chunkZ, 2, 3);
      			break;
      		case -1: 
      			break;
      		case 1:
      			break;
      		}
      	}
      
      	private void gen(WorldGenerator generator, World world, Random random, int chunkX, int chunkZ, int chancesToSpawn,
      			int minHeight, int maxHeight) {
      		if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)
      			throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
      
      		int heightDiff = maxHeight - minHeight + 1;
      		for (int i = 0; i < chancesToSpawn; i++) {
      			int x = chunkX * 16 + random.nextInt(16);
      			int y = minHeight + random.nextInt(heightDiff);
      			int z = chunkZ * 16 + random.nextInt(16);
      			generator.generate(world, random, new BlockPos(x, y, z));
      		}
      	}
      
      	private void populate(WorldGenerator generator, World world, Random random, int chunkX, int chunkZ,
      			int amountPerChunk, int chancesToSpawn) {
      		for (int i = 0; i < amountPerChunk; i++) {
      			int x = chunkX * 16 + random.nextInt(16);
      			int z = chunkZ * 16 + random.nextInt(16);
      			int y = world.getChunkFromChunkCoords(x >> 4, z >> 4).getHeight(new BlockPos(x & 15, 0, z & 15)) - 1;
      			generator.generate(world, random, new BlockPos(x, y, z));
      		}
      	}
      }
      

      et pour mon biome

      package com.ben.heaven.world.biomes;
      
      import java.util.Random;
      
      import com.ben.heaven.init.BlocksMod;
      import com.ben.heaven.world.WorldGenNaturalHeaven;
      
      import net.minecraft.entity.monster.EntityCreeper;
      import net.minecraft.entity.monster.EntitySkeleton;
      import net.minecraft.entity.monster.EntityZombie;
      import net.minecraft.entity.monster.EntityZombieVillager;
      import net.minecraft.world.biome.Biome;
      
      public class MagicBiome extends Biome 
      {
      	public static final WorldGenNaturalHeaven Tree = new WorldGenNaturalHeaven(); 
      	
      	public MagicBiome()
      	{
      		super(new BiomeProperties("Magic").setBaseHeight(1.5F).setHeightVariation(1.2F).setTemperature(0.6F).setRainDisabled().setWaterColor(61135));
      		
      		topBlock = BlocksMod.magic_grass.getDefaultState();
      		fillerBlock = BlocksMod.magic_dirt.getDefaultState();
      		
      		
      		this.decorator.treesPerChunk = 4;
      		
      		this.spawnableCaveCreatureList.clear();
      		this.spawnableCreatureList.clear();
      		this.spawnableMonsterList.clear();
      		this.spawnableWaterCreatureList.clear();
      		
      		this.spawnableCreatureList.add(new SpawnListEntry(EntityZombie.class, 10, 1, 1));
      		this.spawnableCreatureList.add(new SpawnListEntry(EntityZombieVillager.class, 10, 1, 1));
      		this.spawnableCreatureList.add(new SpawnListEntry(EntitySkeleton.class, 10, 1, 1));
      		this.spawnableCreatureList.add(new SpawnListEntry(EntityCreeper.class, 10, 1, 1));
      		
      	}
      	
      	public WorldGenNaturalHeaven getRandomFeature(Random random)
      	{
      		return Tree;
      	}
      }
      
      
      U 1 réponse Dernière réponse Répondre Citer 0
      • U Hors-ligne
        UtopiePhysique @TionebBen3119
        dernière édition par

        @tionebben3119 Tu as vérifier au niveau de ta rotation ? J’ai connu le problème (pas sur une génération mais juste en posant des blocs). Mais ça remonte à très longtemps …

        T 1 réponse Dernière réponse Répondre Citer 0
        • T Hors-ligne
          TionebBen3119 @UtopiePhysique
          dernière édition par

          @utopiephysique Bonjour au niveau de la pose des blocks j’avais également eut le problème, mais j’ai trouvé comment le régler. En revanche pour la génération je ne trouve pas

          FeedBackF 1 réponse Dernière réponse Répondre Citer 0
          • FeedBackF Hors-ligne
            FeedBack @TionebBen3119
            dernière édition par

            @tionebben3119 bah t’as donné une property “facing” au block ? si oui, ca devrait marcher.
            et vu que tu dis que ca ne marche pas meme quand on le pose c’est que ca a mal été enregistré

            T 2 réponses Dernière réponse Répondre Citer 0
            • T Hors-ligne
              TionebBen3119 @FeedBack
              dernière édition par

              @feedback non non quand je le pose j’ai réussis juste a la generation

              1 réponse Dernière réponse Répondre Citer 0
              • T Hors-ligne
                TionebBen3119 @FeedBack
                dernière édition par

                @feedback par contre le facing je ne suis pas sur

                1 réponse Dernière réponse Répondre Citer 0
                • robin4002R robin4002 a déplacé ce sujet de Support pour les moddeurs sur
                • 1 / 1
                • Premier message
                  Dernier message
                Design by Woryk
                ContactMentions Légales

                MINECRAFT FORGE FRANCE © 2024

                Powered by NodeBB