Jump to content

TheSmiler

Members
  • Posts

    1
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

TheSmiler's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello, am just beginning modding and I am trying to generate new mushrooms with the GeneratorBushFeature(BlockBush) class. The game is starting but chash when I try to generate a world. My mushroom block extends the BlockMushroom class and my generator class is registered with GameRegistry.registerWorldGenerator(new WorldGenMushrooms(),0); here is the generator's cod: package fr.thesmiler.mushroomsmod.world.gen.feature; import java.util.Random; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.GeneratorBushFeature; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.fml.common.IWorldGenerator; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import fr.thesmiler.mushroomsmod.init.MushroomsBlocks; public class WorldGenMushrooms implements IWorldGenerator{ public WorldGenerator mushroomYellowGen; public Random randomGenerator; public BlockPos bp; public WorldGenMushrooms(){ this.mushroomYellowGen = new GeneratorBushFeature(MushroomsBlocks.yellow_mushroom); System.out.println("TEST"); } @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){ generateSurfaceMush(world, random, chunkX*16, chunkZ*16); if(world.provider.getDimensionId()==0){ generateSurfaceMush(world, random, chunkX*16, chunkZ*16); } } public void generateSurfaceMush(World world, Random rand, int chunkX, int chunkZ){ for (int i = 0; i < 50; i++){ if (this.randomGenerator.nextInt(4) == 0){ int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(48); int randPosZ = chunkZ + rand.nextInt(16); BlockPos blockpos2 = world.getHorizon(bp.add(randPosX, randPosY, randPosZ)); mushroomYellowGen.generate(world, rand,blockpos2); System.out.println("test"); } } } } I did removed the comments because they were in Frensh, sorry. Please help me!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.