Java Code Examples for net.minecraft.world.World.getBiomeProvider()

The following are Jave code examples for showing how to use getBiomeProvider() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ExPetrum   File: GenerationHelper.java   Source Code and License Vote up 6 votes
public static EnumRockClass getStoneTypeAt(World w, BlockPos at)
{
	if (lastRememberedSeed != w.getSeed())
	{
		rand.setSeed(w.getSeed());
		offsetStone = new Vec3i(rand.nextInt(300000) - rand.nextInt(300000), 0, rand.nextInt(300000) - rand.nextInt(300000));
		offsetDirt = new Vec3i(rand.nextInt(300000) - rand.nextInt(300000), 0, rand.nextInt(300000) - rand.nextInt(300000));
	}
	
	BlockPos actual = at.add(offsetStone);
	
	try
	{
		FeatureProvider provider = ((BiomeProviderExP)w.getBiomeProvider()).featureProvider;
		return EnumRockClass.values()[Math.abs(provider.getByte(actual, provider.cacheRocks)) % 16];
	}
	catch (Exception ex)
	{
		ex.printStackTrace();
		return EnumRockClass.ANDESITE;
	}
}
 
Example 2
Project: ExPetrum   File: GenerationHelper.java   Source Code and License Vote up 6 votes
public static EnumDirtClass getDirtTypeAt(World w, BlockPos at)
{
	if (lastRememberedSeed != w.getSeed())
	{
		rand.setSeed(w.getSeed());
		offsetStone = new Vec3i(rand.nextInt(300000) - rand.nextInt(300000), 0, rand.nextInt(300000) - rand.nextInt(300000));
		offsetDirt = new Vec3i(rand.nextInt(300000) - rand.nextInt(300000), 0, rand.nextInt(300000) - rand.nextInt(300000));
	}
	
	BlockPos actual = at.add(offsetDirt);
	
	try
	{
		FeatureProvider provider = ((BiomeProviderExP)w.getBiomeProvider()).featureProvider;
		return EnumDirtClass.values()[Math.abs(provider.getByte(actual, provider.cacheSoil)) % 16];
	}
	catch (Exception ex)
	{
		ex.printStackTrace();
		return EnumDirtClass.ACRISOL;
	}
}
 
Example 3
Project: modName   File: GeneralUtil.java   Source Code and License Vote up 5 votes
public static BiomeProviderATG getATGBiomeProvider(World world) {
    BiomeProvider provider = world.getBiomeProvider();
    if (provider instanceof BiomeProviderATG) {
        return (BiomeProviderATG)provider;
    }

    //todo: if deemed necessary, some form of recursive field search in case the biome provider is wrapped

    return null;
}
 
Example 4
Project: Backmemed   File: MapGenVillage.java   Source Code and License Vote up 5 votes
public Start(World worldIn, Random rand, int x, int z, int size)
{
    super(x, z);
    List<StructureVillagePieces.PieceWeight> list = StructureVillagePieces.getStructureVillageWeightedPieceList(rand, size);
    StructureVillagePieces.Start structurevillagepieces$start = new StructureVillagePieces.Start(worldIn.getBiomeProvider(), 0, rand, (x << 4) + 2, (z << 4) + 2, list, size);
    this.components.add(structurevillagepieces$start);
    structurevillagepieces$start.buildComponent(structurevillagepieces$start, this.components, rand);
    List<StructureComponent> list1 = structurevillagepieces$start.pendingRoads;
    List<StructureComponent> list2 = structurevillagepieces$start.pendingHouses;

    while (!list1.isEmpty() || !list2.isEmpty())
    {
        if (list1.isEmpty())
        {
            int i = rand.nextInt(list2.size());
            StructureComponent structurecomponent = (StructureComponent)list2.remove(i);
            structurecomponent.buildComponent(structurevillagepieces$start, this.components, rand);
        }
        else
        {
            int j = rand.nextInt(list1.size());
            StructureComponent structurecomponent2 = (StructureComponent)list1.remove(j);
            structurecomponent2.buildComponent(structurevillagepieces$start, this.components, rand);
        }
    }

    this.updateBoundingBox();
    int k = 0;

    for (StructureComponent structurecomponent1 : this.components)
    {
        if (!(structurecomponent1 instanceof StructureVillagePieces.Road))
        {
            ++k;
        }
    }

    this.hasMoreThanTwoComponents = k > 2;
}
 
Example 5
Project: CustomWorldGen   File: MapGenVillage.java   Source Code and License Vote up 5 votes
public Start(World worldIn, Random rand, int x, int z, int size)
{
    super(x, z);
    List<StructureVillagePieces.PieceWeight> list = StructureVillagePieces.getStructureVillageWeightedPieceList(rand, size);
    StructureVillagePieces.Start structurevillagepieces$start = new StructureVillagePieces.Start(worldIn.getBiomeProvider(), 0, rand, (x << 4) + 2, (z << 4) + 2, list, size);
    this.components.add(structurevillagepieces$start);
    structurevillagepieces$start.buildComponent(structurevillagepieces$start, this.components, rand);
    List<StructureComponent> list1 = structurevillagepieces$start.pendingRoads;
    List<StructureComponent> list2 = structurevillagepieces$start.pendingHouses;

    while (!list1.isEmpty() || !list2.isEmpty())
    {
        if (list1.isEmpty())
        {
            int i = rand.nextInt(list2.size());
            StructureComponent structurecomponent = (StructureComponent)list2.remove(i);
            structurecomponent.buildComponent(structurevillagepieces$start, this.components, rand);
        }
        else
        {
            int j = rand.nextInt(list1.size());
            StructureComponent structurecomponent2 = (StructureComponent)list1.remove(j);
            structurecomponent2.buildComponent(structurevillagepieces$start, this.components, rand);
        }
    }

    this.updateBoundingBox();
    int k = 0;

    for (StructureComponent structurecomponent1 : this.components)
    {
        if (!(structurecomponent1 instanceof StructureVillagePieces.Road))
        {
            ++k;
        }
    }

    this.hasMoreThanTwoComponents = k > 2;
}
 
Example 6
Project: Backmemed   File: WoodlandMansion.java   Source Code and License Vote up 4 votes
public BlockPos getClosestStrongholdPos(World worldIn, BlockPos pos, boolean p_180706_3_)
{
    this.worldObj = worldIn;
    BiomeProvider biomeprovider = worldIn.getBiomeProvider();
    return biomeprovider.func_190944_c() && biomeprovider.func_190943_d() != Biomes.ROOFED_FOREST ? null : func_191069_a(worldIn, this, pos, 80, 20, 10387319, true, 100, p_180706_3_);
}