Added amethyst and biome essence ore to the End. Fixed celestial crystal generation

This commit is contained in:
Forstride 2016-02-01 23:31:39 -05:00
parent da077d5d3d
commit 4d5ed22a51
5 changed files with 57 additions and 6 deletions

View File

@ -17,6 +17,7 @@ public class BlockQueries
public static IBlockPosQuery nothing;
public static IBlockPosQuery hasWater;
public static IBlockPosQuery airAbove;
public static IBlockPosQuery airBelow;
public static IBlockPosQuery breakable;
public static IBlockPosQuery air;
public static IBlockPosQuery airOrLeaves;

View File

@ -1,11 +1,16 @@
package biomesoplenty.common.biome.vanilla;
import net.minecraft.init.Blocks;
import net.minecraft.world.biome.BiomeGenBase;
import biomesoplenty.api.biome.ExtendedBiomeWrapper;
import biomesoplenty.api.biome.generation.GeneratorStage;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.block.BlockQueries;
import biomesoplenty.common.enums.BOPGems;
import biomesoplenty.common.util.block.BlockQuery;
import biomesoplenty.common.util.block.BlockQuery.IBlockPosQuery;
import biomesoplenty.common.world.feature.GeneratorCrystals;
import net.minecraft.world.biome.BiomeGenBase;
import biomesoplenty.common.world.feature.GeneratorOreCluster;
import biomesoplenty.common.world.feature.GeneratorOreSingle;
public class BiomeExtEnd extends ExtendedBiomeWrapper
{
@ -13,6 +18,14 @@ public class BiomeExtEnd extends ExtendedBiomeWrapper
{
super(BiomeGenBase.sky);
this.addGenerator("crystals", GeneratorStage.ORE_PRE, (new GeneratorCrystals.Builder()).amountPerChunk(6.0F).placeOn(BlockQueries.endish).with(BOPBlocks.crystal.getDefaultState()).create());
//celestial crystals
IBlockPosQuery emptyEndstone = BlockQuery.buildAnd().withAltitudeBetween(0, 50).withAirBelow().states(Blocks.end_stone.getDefaultState()).create();
this.addGenerator("crystals", GeneratorStage.ORE_PRE, (new GeneratorCrystals.Builder()).amountPerChunk(12.0F).placeOn(emptyEndstone).with(BOPBlocks.crystal.getDefaultState()).create());
// gem
this.addGenerator("amethyst", GeneratorStage.ORE_PRE, (new GeneratorOreSingle.Builder()).replace(Blocks.end_stone.getDefaultState()).amountPerChunk(24).with(BOPGems.AMETHYST).create());
// biome essence
this.addGenerator("biome_essence", GeneratorStage.ORE_PRE, (new GeneratorOreSingle.Builder()).replace(Blocks.end_stone.getDefaultState()).amountPerChunk(24).with(BOPBlocks.biome_block.getDefaultState()).create());
}
}

View File

@ -51,6 +51,16 @@ public class ModBlockQueries
}
};
// Match block positions with air below
airBelow = new IBlockPosQuery()
{
@Override
public boolean matches(World world, BlockPos pos)
{
return world.isAirBlock(pos.down());
}
};
// Match blocks which are not unbreakable - IE not bedrock, barrier, command blocks
breakable = new IBlockPosQuery()
{

View File

@ -94,6 +94,7 @@ public class BlockQuery
public CompoundQueryBuilder withAltitudeBetween(int a, int b) {return this.add(new BlockPosQueryAltitude(a,b));}
public CompoundQueryBuilder byWater() {return this.add(BlockQueries.hasWater);}
public CompoundQueryBuilder withAirAbove() {return this.add(BlockQueries.airAbove);}
public CompoundQueryBuilder withAirBelow() {return this.add(BlockQueries.airBelow);}
public CompoundQueryBuilder withLightAboveAtLeast(int a) {return this.add(new BlockPosQueryLightAboveAtLeast(a));}
public CompoundQueryBuilder withLightAboveNoMoreThan(int a) {return this.add(new BlockPosQueryLightAboveNoMoreThan(a));}
public CompoundQueryBuilder sustainsPlant(EnumPlantType plantType) {return this.add(new BlockPosQuerySustainsPlantType(plantType));}

View File

@ -10,7 +10,14 @@ package biomesoplenty.common.world.feature;
import java.util.Random;
import biomesoplenty.common.util.block.BlockQuery;
import biomesoplenty.common.util.block.BlockQuery.BlockQueryBlock;
import biomesoplenty.common.util.block.BlockQuery.BlockQueryParseException;
import biomesoplenty.common.util.block.BlockQuery.BlockQueryState;
import biomesoplenty.common.util.block.BlockQuery.IBlockPosQuery;
import biomesoplenty.common.util.config.BOPConfig.IConfigObj;
import biomesoplenty.common.world.feature.GeneratorOreSingle.Builder;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
@ -26,6 +33,13 @@ public class GeneratorOreCluster extends GeneratorOreBase
public Builder clusterSize(int a) {this.clusterSize = a; return this.self();}
protected IBlockPosQuery replace;
public Builder replace(IBlockPosQuery a) {this.replace = a; return this.self();}
public Builder replace(String a) throws BlockQueryParseException {this.replace = BlockQuery.parseQueryString(a); return this.self();}
public Builder replace(Block a) {this.replace = new BlockQueryBlock(a); return this.self();}
public Builder replace(IBlockState a) {this.replace = new BlockQueryState(a); return this.self();}
public Builder()
{
this.amountPerChunk = 1.0F;
@ -33,28 +47,39 @@ public class GeneratorOreCluster extends GeneratorOreBase
this.minHeight = 4;
this.maxHeight = 32;
this.clusterSize = 4;
this.replace = new BlockQueryBlock(Blocks.stone);
}
@Override
public GeneratorOreCluster create()
{
return new GeneratorOreCluster(this.amountPerChunk, this.minHeight, this.maxHeight, this.with, this.clusterSize);
return new GeneratorOreCluster(this.amountPerChunk, this.minHeight, this.maxHeight, this.with, this.clusterSize, this.replace);
}
}
private WorldGenMinable generator;
public GeneratorOreCluster(float amountPerChunk, int minHeight, int maxHeight, IBlockState with, int clusterSize)
private IBlockState with;
private IBlockPosQuery replace;
public GeneratorOreCluster(float amountPerChunk, int minHeight, int maxHeight, IBlockState with, int clusterSize, IBlockPosQuery replace)
{
super(amountPerChunk, minHeight, maxHeight);
this.generator = new WorldGenMinable(with, clusterSize);
this.with = with;
this.replace = replace;
}
@Override
public boolean generate(World world, Random random, BlockPos pos)
{
return this.generator.generate(world, random, pos);
if (this.replace.matches(world, pos))
{
return this.generator.generate(world, random, pos);
}
return false;
}
@Override
@ -64,6 +89,7 @@ public class GeneratorOreCluster extends GeneratorOreBase
this.generator.oreBlock = conf.getBlockState("with", this.generator.oreBlock);
this.generator.numberOfBlocks = conf.getInt("clusterSize", this.generator.numberOfBlocks);
this.replace = conf.getBlockPosQuery("replace", this.replace);
}
}