net.minecraft.world.gen.IChunkGenerator Java Examples

The following examples show how to use net.minecraft.world.gen.IChunkGenerator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorldGenManagerForIntraportals.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider)
{
	int x = random.nextInt(16) + 16*chunkX;
	int z = random.nextInt(16) + 16*chunkZ;
	int y = random.nextInt(world.getActualHeight()-10) + 5;
	BlockPos checkPos = new BlockPos(x,y,z);
	if (random.nextInt(100) == 0
			&& world.getBlockState(checkPos).getBlock() == Blocks.AIR
			&& world.getBlockState(checkPos.up()).getBlock() == Blocks.AIR
			&& world.getBlockState(checkPos.down()).getBlock() == Blocks.AIR)
	{
		world.setBlockState(checkPos, SubmodIntradimensionalPortals.intradimensional_portal_base.getDefaultState());
		//world.setBlockState(checkPos.up(), SubmodIntradimensionalPortals.intradimensional_portal_glowy_air.getDefaultState());
		//world.setBlockState(checkPos.down(), SubmodIntradimensionalPortals.intradimensional_portal_glowy_air.getDefaultState());
	}
}
 
Example #2
Source File: WorldGenPlacer.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	if (random.nextInt(ToroQuestConfiguration.structureSpawnChance) != 0 || world.provider.getDimension() != 0) {
		return;
	}

	int roll = random.nextInt(5);

	switch (roll) {
	case 0:
		genMonolith(world, random, chunkX, chunkZ);
		break;
	case 1:
		genBastionsLair(world, random, chunkX, chunkZ);
		break;
	case 2:
		genMageTower(world, random, chunkX, chunkZ);
		break;
	case 3:
		genThroneRoom(world, random, chunkX, chunkZ);
		break;
	case 4:
		genGraveyard(world, random, chunkX, chunkZ);
		break;
	}
}
 
Example #3
Source File: ValkyrienSkiesWorldGen.java    From Valkyrien-Skies with Apache License 2.0 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
    IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (ValkyrienSkiesWorld.OREGEN_ENABLED && VSConfig.valkyriumSpawnRate > 0) {
        if (this.genValkyriumOre == null) {
            this.genValkyriumOre = new WorldGenMinable(
                ValkyrienSkiesWorld.INSTANCE.valkyriumOre.getDefaultState(), 8);
        }
        switch (world.provider.getDimension()) {
            case 0: //Overworld
                this.runValkyriumGenerator(this.genValkyriumOre, world, random, chunkX, chunkZ, VSConfig.valkyriumSpawnRate,
                    0, 25);
                // runDungeonGenerator(world, random, chunkX, chunkZ, 1);
                break;
            case -1: //Nvalkyrium
                break;
            case 1: //End
                break;
        }
    }
}
 
Example #4
Source File: WorldGeneratorSignals.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
    // TODO when adding worldgen, resolve the note at https://github.com/MineMaarten/Signals/pull/80 regarding the possibility of rails not being included in the network.
    if(chunkX == 0) {
        int x = chunkX * 16 + 8;
        int y = 4;
        int startZ = chunkZ * 16;
        for(int z = startZ; z < startZ + 16; z++) {
            world.setBlockState(new BlockPos(x, y, z), Blocks.STONE.getDefaultState(), 0);
            world.setBlockState(new BlockPos(x, y + 1, z), Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, EnumRailDirection.NORTH_SOUTH), 0);
            if(z % 256 == 0) {
                world.setBlockState(new BlockPos(x + 1, y + 1, z), ModBlocks.BLOCK_SIGNAL.getDefaultState().withProperty(BlockSignalBase.FACING, EnumFacing.NORTH), 0);

            }
        }
    }
}
 
Example #5
Source File: WorldGenAbandonedBase.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (ConfigHolder.abandonedBaseRarity == 0 ||
        world.getWorldType() == WorldType.FLAT ||
        world.provider.getDimensionType() != DimensionType.OVERWORLD ||
        !world.getWorldInfo().isMapFeaturesEnabled()) {
        return; //do not generate in flat worlds, or in non-surface worlds
    }
    BlockPos randomPos = new BlockPos(chunkX * 16 + 8, 0, chunkZ * 16 + 8);

    if (random.nextInt(ConfigHolder.abandonedBaseRarity) == 0) {
        int variantNumber = random.nextInt(3);
        Rotation rotation = Rotation.values()[random.nextInt(Rotation.values().length)];
        ResourceLocation templateId = new ResourceLocation(GTValues.MODID, "abandoned_base/abandoned_base_1_" + variantNumber);
        Template template = TemplateManager.getBuiltinTemplate(world, templateId);
        BlockPos originPos = template.getZeroPositionWithTransform(randomPos, Mirror.NONE, rotation);
        originPos = TemplateManager.calculateAverageGroundLevel(world, originPos, template.getSize());
        template.addBlocksToWorld(world, originPos, new PlacementSettings().setRotation(rotation));
    }
}
 
Example #6
Source File: CustomizableOreGen.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
		IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {

	Predicate<IBlockState> predicate = null;
	if(DimensionManager.getInstance().isDimensionCreated(world.provider.getDimension()))
	{
		IBlockState state = ((DimensionProperties)DimensionManager.getInstance().getDimensionProperties(world.provider.getDimension())).getStoneBlock();
		if(state != null)
			predicate = new CustomPredicate(state);
	}
	
	for(int i = 0; i < numPerChunk; i++) {
		int coordX = 16*chunkX + random.nextInt(16);
		int coordY = heightLevel + random.nextInt(difference);
		int coordZ = 16*chunkZ + random.nextInt(16);

		if(predicate != null)
			new WorldGenMinable(oreToGen, clumpSize, predicate).generate(world, random, new BlockPos(coordX, coordY, coordZ));
		else
			new WorldGenMinable(oreToGen, clumpSize).generate(world, random, new BlockPos(coordX, coordY, coordZ));
	}

}
 
Example #7
Source File: WorldGenVanilla.java    From Sakura_mod with MIT License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,IChunkProvider chunkProvider) {
    int x = chunkX * 16;
    int z = chunkZ * 16;
    
    Biome biome = world.getBiomeForCoordsBody(new BlockPos(x, 0, z));
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.DEAD)
    		||BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY)) {
      return;
    }

	if (random.nextFloat() < SakuraConfig.vanilla_weight / 4000.0F)
    {
      int posX = x + world.rand.nextInt(16) + 8;
      int posZ = z + world.rand.nextInt(16) + 8;
      BlockPos newPos = WorldUtil.findGround(world, new BlockPos(posX, 0, posZ), true, true, true);
      if ((newPos != null) && (BlockLoader.VANILLA_SPLINT.canPlaceBlockAt(world, newPos))) {
        world.setBlockState(newPos, BlockLoader.VANILLACROP.getDefaultState(), 2);
      }
    }
}
 
Example #8
Source File: WorldGenPepper.java    From Sakura_mod with MIT License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,IChunkProvider chunkProvider) {
    int x = chunkX * 16;
    int z = chunkZ * 16;
    
    Biome biome = world.getBiomeForCoordsBody(new BlockPos(x, 0, z));
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.DEAD)
    		||BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY)) {
      return;
    }

	if (random.nextFloat() < SakuraConfig.pepper_weight / 4000.0F) {
      int posX = x  + world.rand.nextInt(16) + 8;
      int posZ = z  + world.rand.nextInt(16) + 8;
      BlockPos newPos = WorldUtil.findGround(world, new BlockPos(posX, 0, posZ), true, true, true);
      if ((newPos != null) && (BlockLoader.PEPPER_SPLINT.canPlaceBlockAt(world, newPos))) {
        world.setBlockState(newPos, BlockLoader.PEPPERCROP.getDefaultState(), 2);
      }
    }
}
 
Example #9
Source File: WorldGenBambooShot.java    From Sakura_mod with MIT License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,IChunkProvider chunkProvider) {
    int x = chunkX * 16;
    int z = chunkZ * 16;
    
    Biome biome = world.getBiomeForCoordsBody(new BlockPos(x, 0, z));
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.DEAD)
    		||BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY)) {
      return;
    }
    
       if (random.nextFloat() < SakuraConfig.bambooshot_weight / 4000.0F)
    {
      int posX = x+ world.rand.nextInt(16) + 8;
      int posZ = z+ world.rand.nextInt(16) + 8;
      BlockPos newPos = WorldUtil.findGround(world, new BlockPos(posX, 0, posZ), true, true, true);
      if ((newPos != null) && (BlockLoader.BAMBOOSHOOT.canBlockStay(world, newPos))) {
        world.setBlockState(newPos, BlockLoader.BAMBOOSHOOT.getDefaultState(), 2);
      }
    }
}
 
Example #10
Source File: SoyGenerator.java    From TofuCraftReload with MIT License 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    int x = chunkX * 16;
    int z = chunkZ * 16;

    Biome biome = world.getBiomeForCoordsBody(new BlockPos(x, 0, z));
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.DEAD)
            || BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY)) {
        return;
    }

    if (random.nextFloat() < 70 / 4000.0F) {
        int posX = x + world.rand.nextInt(16) + 8;
        int posZ = z + world.rand.nextInt(16) + 8;
        BlockPos newPos = WorldUtil.findGround(world, new BlockPos(posX, 0, posZ), true, true, true);
        if ((newPos != null) && (BlockLoader.SOYBEAN.canPlaceBlockAt(world, newPos))) {
            world.setBlockState(newPos, BlockLoader.SOYBEAN.getDefaultState().withProperty(BlockSoybean.AGE, random.nextInt(4)), 2);
        }
    }
}
 
Example #11
Source File: WorldProviderSurfaceVoid.java    From YUNoMakeGoodMap with Apache License 2.0 5 votes vote down vote up
@Override
public IChunkGenerator createChunkGenerator()
{
    if (YUNoMakeGoodMap.instance.shouldBeVoid(world))
        return new ChunkGeneratorFlatVoid(world);
    return super.createChunkGenerator();
}
 
Example #12
Source File: WorldProviderHellVoid.java    From YUNoMakeGoodMap with Apache License 2.0 5 votes vote down vote up
@Override
public IChunkGenerator createChunkGenerator()
{
    if (YUNoMakeGoodMap.instance.shouldBeVoid(world))
        return new ChunkGeneratorHellVoid(world, YUNoMakeGoodMap.instance.shouldGenerateNetherFortress(world), world.getSeed());

    return new ChunkGeneratorHell(world, YUNoMakeGoodMap.instance.shouldGenerateNetherFortress(world), world.getSeed());
}
 
Example #13
Source File: StructureRegistry.java    From OpenModsLib with MIT License 5 votes vote down vote up
private static <T extends IChunkGenerator> void tryVisit(IStructureVisitor visitor, IChunkGenerator generator, IStructureGenProvider<T> p) {
	final Class<T> generatorCls = p.getGeneratorCls();
	if (generatorCls.isInstance(generator)) {
		final T castGenerator = generatorCls.cast(generator);
		for (String struct : p.listStructureNames(castGenerator))
			visitor.visit(generator, struct);
	}
}
 
Example #14
Source File: WorldProviderPlanet.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public IChunkGenerator createChunkGenerator() {
	if(DimensionManager.getInstance().getDimensionProperties(world.provider.getDimension()).getGenType() == 1)
	{
		return new ChunkProviderCavePlanet(this.world, false, this.world.getSeed(),world.getWorldInfo().getGeneratorOptions());
	}
	else
		return new ChunkProviderPlanet(this.world, this.world.getSeed(), false, world.getWorldInfo().getGeneratorOptions());
}
 
Example #15
Source File: OreGenerator.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
		IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	
	OreGenEvent event = new OreGenEvent.GenerateMinable(world, random, this, new BlockPos(chunkX,0,chunkZ), EventType.CUSTOM);
	MinecraftForge.ORE_GEN_BUS.post(event);
	if(event.getResult() != Result.DENY) {
		if(Configuration.generateCopper) {
			generate(world, MaterialRegistry.getMaterialFromName("Copper"), Configuration.copperPerChunk, Configuration.copperClumpSize, chunkX, chunkZ, random);
		}

		if(Configuration.generateTin) {
			generate(world, MaterialRegistry.getMaterialFromName("Tin"), Configuration.tinPerChunk, Configuration.tinClumpSize, chunkX, chunkZ, random);
		}
		if(Configuration.generateRutile) {
			generate(world, MaterialRegistry.getMaterialFromName("Rutile"), Configuration.rutilePerChunk, Configuration.rutileClumpSize, chunkX, chunkZ, random);
		}
		if(Configuration.generateAluminum) {
			generate(world, MaterialRegistry.getMaterialFromName("Aluminum"), Configuration.aluminumPerChunk, Configuration.aluminumClumpSize, chunkX, chunkZ, random);
		}
		if(Configuration.generateIridium) {
			generate(world, MaterialRegistry.getMaterialFromName("Iridium"), Configuration.IridiumPerChunk, Configuration.IridiumClumpSize, chunkX, chunkZ, random);
		}

		if(Configuration.generateDilithium) {
			int dilithiumChance = Configuration.dilithiumPerChunk;
			if(world.provider instanceof WorldProviderPlanet) {
				dilithiumChance = DimensionProperties.AtmosphereTypes.getAtmosphereTypeFromValue(DimensionManager.getInstance().getDimensionProperties(world.provider.getDimension()).getAtmosphereDensity()) == DimensionProperties.AtmosphereTypes.NONE ? Configuration.dilithiumPerChunkMoon : Configuration.dilithiumPerChunk;;
			}
			
			for(int i = 0; i < dilithiumChance; i++) {
				int coordX = 16*chunkX + random.nextInt(16);
				int coordY = random.nextInt(64);
				int coordZ = 16*chunkZ + random.nextInt(16);

				new WorldGenMinable(MaterialRegistry.getMaterialFromName("Dilithium").getBlock().getDefaultState(), Configuration.dilithiumClumpSize).generate(world, random, new BlockPos(coordX, coordY, coordZ));
			}
		}
	}
}
 
Example #16
Source File: StructureRegistry.java    From OpenModsLib with MIT License 5 votes vote down vote up
private void visitStructures(WorldServer world, IStructureVisitor visitor) {
	ChunkProviderServer provider = world.getChunkProvider();
	IChunkGenerator inner = provider.chunkGenerator;

	if (inner != null) {
		for (IStructureGenProvider<?> p : providers)
			tryVisit(visitor, inner, p);
	}
}
 
Example #17
Source File: MixinChunk.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Inject(method = "populate(Lnet/minecraft/world/chunk/IChunkProvider;Lnet/minecraft/world/gen/IChunkGenerator;)V", at = @At("HEAD"), cancellable = true)
public void prePopulateChunk(IChunkProvider provider, IChunkGenerator generator,
    CallbackInfo callbackInfo) {
    if (PhysicsChunkManager.isLikelyShipChunk(this.x, this.z)) {
        callbackInfo.cancel();
    }
}
 
Example #18
Source File: TofuOreGenerator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (world.provider instanceof WorldProviderSurface) {
        this.generateOre(world, random, chunkX << 4, chunkZ << 4);

    }
}
 
Example #19
Source File: WorldProviderTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Returns a new chunk provider register generates chunks for this world
 */
@Override
public IChunkGenerator createChunkGenerator()
{
   /* long newSeed = Utils.getSeedForTofuWorld(this.world);*/
    return new ChunkProviderTofu(this.world, this.world.getSeed());
}
 
Example #20
Source File: WorldGenOre.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if (world.provider.getDimension() != dimension)
    {
        return;
    }

    BlockPos chunkPos = new BlockPos(chunkX * 16, 0, chunkZ * 16);

    if (maxHeight < minHeight)
    {
        int i = minHeight;
        minHeight = maxHeight;
        maxHeight = i;
    } else if (maxHeight == minHeight)
    {
        if (minHeight < 255)
        {
            ++maxHeight;
        } else
        {
            --minHeight;
        }
    }

    for (int j = 0; j < count; ++j)
    {
        BlockPos blockpos = chunkPos.add(random.nextInt(16), random.nextInt(maxHeight - minHeight) + minHeight, random.nextInt(16));
        gen.generate(world, random, blockpos);
    }
}
 
Example #21
Source File: WorldGenIronSand.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
	public void generate(Random rand, int chunkX, int chunkZ, World worldIn, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
		  for (int i = 0; i < block_count; i++) {
	            int rX = (chunkX  * 16) + rand.nextInt(16) + 8;
	            int rY = 48 + rand.nextInt(19);
	            int rZ = (chunkZ  * 16) + rand.nextInt(16) + 8;
	            BlockPos pos = new BlockPos(rX, rY, rZ);
	            IBlockState stateAt = worldIn.getBlockState(pos);
	            if(!stateAt.getBlock().equals(Blocks.SAND)) {
	                continue;
	            }

	            boolean canSpawn = false;
	            for (int yy = 0; yy < 2; yy++) {
	                BlockPos check = pos.offset(EnumFacing.UP, yy);
	                IBlockState bs = worldIn.getBlockState(check);
	                Block block = bs.getBlock();
	                if(worldIn.getBiome(pos) instanceof BiomeBeach|| worldIn.getBiome(pos) instanceof BiomeRiver)
	                if((worldIn.isAirBlock(pos.up())||block instanceof BlockLiquid && bs.getMaterial() == Material.WATER)) {
	                    canSpawn = true;
	                    break;
	                }
	            }
	            if(!canSpawn)
	                continue;
	            worldIn.setBlockState(pos, BlockLoader.IRON_SAND.getDefaultState());
//	            SakuraMain.logger.info(String.format("Iron Sand in: %d %d %d", pos.getX(),pos.getY(),pos.getZ()));
	        }
	}
 
Example #22
Source File: GTWorldGen.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {
	Biome biomegenbase = world.getBiome(new BlockPos(chunkX * 16 + 16, 128, chunkZ * 16 + 16));
	// Any Biome
	GTOreGenerator.generateBasicVein(GTBlocks.oreIridium, GTConfig.generation.iridiumGenerate, GTConfig.generation.iridiumSize, GTConfig.generation.iridiumWeight, 0, 128, Blocks.STONE, world, random, chunkX, chunkZ);
	// Jungle Biomes
	if (BiomeDictionary.hasType(biomegenbase, Type.JUNGLE)) {
		GTOreGenerator.generateBasicVein(GTBlocks.oreSheldonite, GTConfig.generation.sheldoniteGenerate, GTConfig.generation.sheldoniteSize, GTConfig.generation.sheldoniteWeight, 10, 30, Blocks.STONE, world, random, chunkX, chunkZ);
	}
	// Hot Biomes
	if (BiomeDictionary.hasType(biomegenbase, Type.HOT)) {
		GTOreGenerator.generateBasicVein(GTBlocks.oreRuby, GTConfig.generation.rubyGenerate, GTConfig.generation.rubySize, GTConfig.generation.rubyWeight, 0, 48, Blocks.STONE, world, random, chunkX, chunkZ);
	}
	// Ocean Biomes
	if (BiomeDictionary.hasType(biomegenbase, Type.OCEAN) || BiomeDictionary.hasType(biomegenbase, Type.BEACH)) {
		GTOreGenerator.generateBasicVein(GTBlocks.oreSapphire, GTConfig.generation.sapphireGenerate, GTConfig.generation.sapphireSize, GTConfig.generation.sapphireWeight, 0, 48, Blocks.STONE, world, random, chunkX, chunkZ);
	}
	// Forest or Plains Biomes
	if (BiomeDictionary.hasType(biomegenbase, Type.FOREST)
			|| (BiomeDictionary.hasType(biomegenbase, Type.PLAINS))) {
		GTOreGenerator.generateBasicVein(GTBlocks.oreBauxite, GTConfig.generation.bauxiteGenerate, GTConfig.generation.bauxiteSize, GTConfig.generation.bauxiteWeight, 50, 120, Blocks.STONE, world, random, chunkX, chunkZ);
	}
	if (world.provider.getDimensionType().equals(DimensionType.OVERWORLD)) {
		for (Block block : GTBedrockOreHandler.getBedrockOreMap().keySet()) {
			if (GTBedrockOreHandler.shouldGTCHandleGeneration(block)) {
				GTOreGenerator.generateBedrockVein(block, world, random, chunkX, chunkZ);
			}
		}
	}
}
 
Example #23
Source File: WorldGenRubberTree.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (world.getWorldType() == WorldType.FLAT ||
        !world.provider.isSurfaceWorld()) {
        return; //do not generate in flat worlds, or in non-surface worlds
    }
    BlockPos randomPos = new BlockPos(chunkX * 16 + 8, 0, chunkZ * 16 + 8);
    Biome biome = world.getBiome(randomPos);

    if (BiomeDictionary.hasType(biome, Type.COLD) ||
        BiomeDictionary.hasType(biome, Type.HOT) ||
        BiomeDictionary.hasType(biome, Type.DRY) ||
        BiomeDictionary.hasType(biome, Type.DEAD) ||
        BiomeDictionary.hasType(biome, Type.SPOOKY))
        return; //do not generate in inappropriate biomes

    int rubberTreeChance = 6;
    if (BiomeDictionary.hasType(biome, Type.SWAMP) ||
        BiomeDictionary.hasType(biome, Type.WET))
        rubberTreeChance /= 2; //double chance of spawning in swamp or wet biomes

    if (random.nextInt(rubberTreeChance) == 0) {
        randomPos = world.getTopSolidOrLiquidBlock(randomPos).down();
        IBlockState solidBlockState = world.getBlockState(randomPos);
        BlockGregSapling sapling = MetaBlocks.SAPLING;
        if (solidBlockState.getBlock().canSustainPlant(solidBlockState, world, randomPos, EnumFacing.UP, sapling)) {
            BlockPos abovePos = randomPos.up();
            IBlockState saplingState = sapling.getDefaultState()
                .withProperty(BlockGregSapling.VARIANT, LogVariant.RUBBER_WOOD);
            world.setBlockState(abovePos, saplingState);
            sapling.generateTree(world, abovePos, saplingState, random);
        }
    }
}
 
Example #24
Source File: OreGenerator.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
        IChunkProvider chunkProvider) {
    generateWorld(random, chunkX, chunkZ, world, true);
}
 
Example #25
Source File: DungeonGenerator.java    From minecraft-roguelike with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	IWorldEditor editor = new WorldEditor(world);
	IDungeon dungeon = new Dungeon(editor);
	dungeon.spawnInChunk(random, chunkX, chunkZ);
}
 
Example #26
Source File: SpaceWorldProvider.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public IChunkGenerator createChunkGenerator() {
    return new SpaceChunkGenerator(world);
}
 
Example #27
Source File: WorldProviderEndVoid.java    From YUNoMakeGoodMap with Apache License 2.0 4 votes vote down vote up
public IChunkGenerator createChunkGenerator()
{
    if (YUNoMakeGoodMap.instance.shouldBeVoid(world))
        return new ChunkGeneratorEndVoid(world, world.getSeed(), this.getSpawnPoint());
    return new ChunkGeneratorEnd(world, true, world.getSeed(), this.getSpawnPoint());
}
 
Example #28
Source File: VoidWorldType.java    From YUNoMakeGoodMap with Apache License 2.0 4 votes vote down vote up
@Override
public IChunkGenerator getChunkGenerator(World world, String generatorOptions)
{
    return new ChunkGeneratorFlatVoid(world);
}
 
Example #29
Source File: StorageWorldProvider.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public IChunkGenerator createChunkGenerator() {
    return new StorageChunkGenerator(world);
}
 
Example #30
Source File: WorldTypePlanetGen.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public IChunkGenerator getChunkGenerator(World world, String generatorOptions) {
	return new ChunkProviderPlanet(world, world.getSeed(), false, generatorOptions);
}