本文整理匯總了Java中net.minecraft.world.gen.feature.WorldGenMinable類的典型用法代碼示例。如果您正苦於以下問題:Java WorldGenMinable類的具體用法?Java WorldGenMinable怎麽用?Java WorldGenMinable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
WorldGenMinable類屬於net.minecraft.world.gen.feature包,在下文中一共展示了WorldGenMinable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generate
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
IChunkProvider chunkProvider) {
StabilityHandler.addChunkData(world.provider.getDimension(), new ChunkPos(chunkX, chunkZ), StabilityHandler.generateChunkStability(random));
if (world.provider.getDimensionType() == DimensionType.OVERWORLD) {
WorldGenMinable lodestone = new WorldGenMinable(RegistryManager.lodestone_ore.getDefaultState(), Config.LODESTONE_VEIN_SIZE);
for (int i = 0; i < Config.LODESTONE_FREQUENCY; i++) {
int x = chunkX * 16 + random.nextInt(16);
int y = random.nextInt(Config.LODESTONE_MAX_Y - Config.LODESTONE_MIN_Y) + Config.LODESTONE_MIN_Y;
int z = chunkZ * 16 + random.nextInt(16);
lodestone.generate(world, random, new BlockPos(x, y, z));
}
BlockPos pos = new BlockPos(chunkX * 16, 0, chunkZ * 16);
WorldGenRift rift = new WorldGenRift();
rift.generate(world, random, pos);
}
}
示例2: decorate
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
public void decorate(World worldIn, Random random, Biome biome, BlockPos pos)
{
if (this.decorating)
{
throw new RuntimeException("Already decorating");
}
else
{
this.chunkProviderSettings = ChunkProviderSettings.Factory.jsonToFactory(worldIn.getWorldInfo().getGeneratorOptions()).build();
this.chunkPos = pos;
this.dirtGen = new WorldGenMinable(Blocks.DIRT.getDefaultState(), this.chunkProviderSettings.dirtSize);
this.gravelGen = new WorldGenMinable(Blocks.GRAVEL.getDefaultState(), this.chunkProviderSettings.gravelSize);
this.graniteGen = new WorldGenMinable(Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.GRANITE), this.chunkProviderSettings.graniteSize);
this.dioriteGen = new WorldGenMinable(Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.DIORITE), this.chunkProviderSettings.dioriteSize);
this.andesiteGen = new WorldGenMinable(Blocks.STONE.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.ANDESITE), this.chunkProviderSettings.andesiteSize);
this.coalGen = new WorldGenMinable(Blocks.COAL_ORE.getDefaultState(), this.chunkProviderSettings.coalSize);
this.ironGen = new WorldGenMinable(Blocks.IRON_ORE.getDefaultState(), this.chunkProviderSettings.ironSize);
this.goldGen = new WorldGenMinable(Blocks.GOLD_ORE.getDefaultState(), this.chunkProviderSettings.goldSize);
this.redstoneGen = new WorldGenMinable(Blocks.REDSTONE_ORE.getDefaultState(), this.chunkProviderSettings.redstoneSize);
this.diamondGen = new WorldGenMinable(Blocks.DIAMOND_ORE.getDefaultState(), this.chunkProviderSettings.diamondSize);
this.lapisGen = new WorldGenMinable(Blocks.LAPIS_ORE.getDefaultState(), this.chunkProviderSettings.lapisSize);
this.genDecorations(biome, worldIn, random);
this.decorating = false;
}
}
示例3: generateOre
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVienSize,
int maxVienSize, int chance, int minY, int maxY, Block generateIn) {
int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);
int heightRange = maxY - minY;
WorldGenMinable gen = new WorldGenMinable(block, vienSize, generateIn);
for (int i = 0; i < chance; i++) {
int xRand = chunkX * random.nextInt(16);
int yRand = random.nextInt(heightRange) + minY;
int zRand = chunkZ * random.nextInt(16);
gen.generate(world, random, xRand, yRand, zRand);
}
}
示例4: registerOreGen
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
/**
* Registers an ore generator to the world generator registry.
*
* @param id the generator ID. Must be unique.
* @param ore the ore
* @param replaceables the blocks the ore may spawn in, usually stone for
* the overworld and netherrack for the nether
* @param veinSize the vein size
* @param minY the minimum Y level the ore may spawn at
* @param maxY the maximum Y level the ore may spawn at
* @param dimensions the dimensions the ore may spawn in. May be
* {@link Short#MAX_VALUE} as a wildcard.
* @param attempts the number of attempts at spawning the ore per chunk
*/
public static void registerOreGen(ResourceLocation id, IBlockState ore, IBlockState[] replaceables, int veinSize, int minY, int maxY, int[] dimensions, int attempts) {
List<IBlockState> replaceableList = Arrays.asList(replaceables);
WorldGenMinable generator = new WorldGenMinable(ore, veinSize, replaceableList::contains);
registerWorldGen(id, (biome, world, random, chunkPos) -> {
for (int dimension : dimensions) {
if (dimension != world.provider.getDimensionType().getId() && dimension != Short.MAX_VALUE) {
continue;
}
for (int attempt = 0; attempt < attempts; attempt++) {
int xOffset = world.rand.nextInt(16);
int yOffset = world.rand.nextInt(maxY - minY + 1) + minY;
int zOffset = world.rand.nextInt(16);
BlockPos pos = chunkPos.add(xOffset, yOffset, zOffset);
generator.generate(world, world.rand, pos);
}
return;
}
});
}
示例5: generateInOverworld
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
private void generateInOverworld(Instruction par1, World world, Random random, int x, int z)
{
for (int k = 0; k < par1.getVeinsPerChunk(); k++)
{
int chunkX = x + random.nextInt(16);
int chunkY = random.nextInt(par1.getMaxHeight());
int chunkZ = z + random.nextInt(16);
// TODO Implement the below if() statement
// if(world.getBlockState(instruction.getBlockType() ==
// GlobalAdditions.surfaceCrystals)) {
if (!isValidSpawn(world, chunkX, chunkY, chunkZ)) { return; }
// }
new WorldGenMinable(par1.getBlockType().getDefaultState(), par1.getBlocksPerVein()).generate(world, random,
new BlockPos(chunkX, chunkY, chunkZ));
}
}
示例6: generateAllOverworldOre
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
private void generateAllOverworldOre(World world, Random rand, int chunkX, int chunkZ){
for(int i=0;i< listOre.size();i++){
if(listOre.get(i).dimId==0){
for (int k = 0; k < listOre.get(i).frequencyOre; k++)
{
int firstBlockXCoord = chunkX + rand.nextInt(16);
int firstBlockZCoord = chunkZ + rand.nextInt(16);
int quisqueY=-1;
while (listOre.get(i).minY>quisqueY||listOre.get(i).maxY<quisqueY){
quisqueY=rand.nextInt(listOre.get(i).minY+listOre.get(i).maxY);
}
BlockPos quisquePos = new BlockPos(firstBlockXCoord, quisqueY, firstBlockZCoord);
//The listOre[i].veinSize as the second parameter sets the maximum vein size
(new WorldGenMinable(listOre.get(i).block,listOre.get(i).veinSize)).generate(world, rand, quisquePos);
}
}
}
}
示例7: generateAllNetherOre
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
private void generateAllNetherOre(World world, Random rand, int chunkX, int chunkZ){
for(int i=0;i< listOre.size();i++){
if(listOre.get(i).dimId==-1){
for (int k = 0; k < listOre.get(i).frequencyOre; k++)
{
int firstBlockXCoord = chunkX + rand.nextInt(16);
int firstBlockZCoord = chunkZ + rand.nextInt(16);
int quisqueY=-1;
while (listOre.get(i).minY>quisqueY||listOre.get(i).maxY<quisqueY){
quisqueY=rand.nextInt(listOre.get(i).minY+listOre.get(i).maxY);
}
BlockPos quisquePos = new BlockPos(firstBlockXCoord, quisqueY, firstBlockZCoord);
//The listOre[i].veinSize as the second parameter sets the maximum vein size
(new WorldGenMinable(listOre.get(i).block,listOre.get(i).veinSize)).generate(world, rand, quisquePos);
}
}
}
}
示例8: generateAllEndOre
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
private void generateAllEndOre(World world, Random rand, int chunkX, int chunkZ){
for(int i=0;i< listOre.size();i++){
if(listOre.get(i).dimId==1){
for (int k = 0; k < listOre.get(i).frequencyOre; k++)
{
int firstBlockXCoord = chunkX + rand.nextInt(16);
int firstBlockZCoord = chunkZ + rand.nextInt(16);
int quisqueY=-1;
while (listOre.get(i).minY>quisqueY||listOre.get(i).maxY<quisqueY){
quisqueY=rand.nextInt(listOre.get(i).minY+listOre.get(i).maxY);
}
BlockPos quisquePos = new BlockPos(firstBlockXCoord, quisqueY, firstBlockZCoord);
//The listOre[i].veinSize as the second parameter sets the maximum vein size
(new WorldGenMinable(listOre.get(i).block,listOre.get(i).veinSize)).generate(world, rand, quisquePos);
}
}
}
}
示例9: WorldGenEndOre
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
public WorldGenEndOre() {
if (Configs.blockCountGold > 0)
this.genGold = new WorldGenMinable(WorldModule.end_gold_ore.getDefaultState(), Configs.blockCountGold, BlockMatcher.forBlock(Blocks.END_STONE));
if (Configs.blockCountIron > 0)
this.genIron = new WorldGenMinable(WorldModule.end_iron_ore.getDefaultState(), Configs.blockCountIron, BlockMatcher.forBlock(Blocks.END_STONE));
if (Configs.blockCountRedstone > 0)
this.genRedstone = new WorldGenMinable(WorldModule.end_redstone_ore.getDefaultState(), Configs.blockCountRedstone, BlockMatcher.forBlock(Blocks.END_STONE));
if (Configs.blockCountCoal > 0)
this.genCoal = new WorldGenMinable(WorldModule.end_coal_ore.getDefaultState(), Configs.blockCountCoal, BlockMatcher.forBlock(Blocks.END_STONE));
if (Configs.blockCountEmerald > 0)
this.genEmerald = new WorldGenMinable(WorldModule.end_emerald_ore.getDefaultState(), Configs.blockCountEmerald, BlockMatcher.forBlock(Blocks.END_STONE));
if (Configs.blockCountLapis > 0)
this.genLapis = new WorldGenMinable(WorldModule.end_lapis_ore.getDefaultState(), Configs.blockCountLapis, BlockMatcher.forBlock(Blocks.END_STONE));
if (Configs.blockCountDiamond > 0)
this.genDiamond = new WorldGenMinable(WorldModule.end_diamond_ore.getDefaultState(), Configs.blockCountDiamond, BlockMatcher.forBlock(Blocks.END_STONE));
}
示例10: WorldGenNetherOre
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
public WorldGenNetherOre() {
if (Configs.blockCountRedstone > 0)
this.genRedstone = new WorldGenMinable(WorldModule.nether_redstone_ore.getDefaultState(), Configs.blockCountRedstone, BlockMatcher.forBlock(Blocks.NETHERRACK));
if (Configs.blockCountIron > 0)
this.genIron = new WorldGenMinable(WorldModule.nether_iron_ore.getDefaultState(), Configs.blockCountIron, BlockMatcher.forBlock(Blocks.NETHERRACK));
if (Configs.blockCountGold > 0)
this.genGold = new WorldGenMinable(WorldModule.nether_gold_ore.getDefaultState(), Configs.blockCountGold, BlockMatcher.forBlock(Blocks.NETHERRACK));
if (Configs.blockCountCoal > 0)
this.genCoal = new WorldGenMinable(WorldModule.nether_coal_ore.getDefaultState(), Configs.blockCountCoal, BlockMatcher.forBlock(Blocks.NETHERRACK));
if (Configs.blockCountEmerald > 0)
this.genEmerald = new WorldGenMinable(WorldModule.nether_emerald_ore.getDefaultState(), Configs.blockCountEmerald, BlockMatcher.forBlock(Blocks.NETHERRACK));
if (Configs.blockCountLapis > 0)
this.genLapis = new WorldGenMinable(WorldModule.nether_lapis_ore.getDefaultState(), Configs.blockCountLapis, BlockMatcher.forBlock(Blocks.NETHERRACK));
if (Configs.blockCountDiamond > 0)
this.genDiamond = new WorldGenMinable(WorldModule.nether_diamond_ore.getDefaultState(), Configs.blockCountDiamond, BlockMatcher.forBlock(Blocks.NETHERRACK));
}
示例11: generateOre
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
private void generateOre(Block block, World world, Random rand, int chunkX, int chunkZ, int minVienSize, int maxVienSize, int chance, int minY, int maxY, Predicate blockType, boolean generate)
{
if (generate == true)
{
int vienSize = minVienSize + rand.nextInt(maxVienSize - minVienSize);
int heightRange = maxY - minY;
WorldGenMinable gen = new WorldGenMinable(block.getDefaultState(), vienSize, blockType);
for (int i = 0; i < chance; i++)
{
int xRand = chunkX * 16 + rand.nextInt(16);
int yRand = rand.nextInt(heightRange) + minY;
int zRand = chunkZ * 16 + rand.nextInt(16);
BlockPos position = new BlockPos(xRand, yRand, zRand);
gen.generate(world, rand, position);
}
}
}
示例12: generate
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
if(!(chunkGenerator instanceof ChunkProviderHell) && !(chunkGenerator instanceof ChunkProviderEnd))
{
for(int i = 0; i < ConfigurationHandler.leadOrePerChunk; i++)
{
int randPosX = (chunkX*16) + random.nextInt(16);
int randPosY = random.nextInt(60);
int randPosZ = (chunkZ*16) + random.nextInt(16);
new WorldGenMinable(ModBlocks.leadOre, 10, Blocks.stone).generate(world, random, randPosX, randPosY, randPosZ);
}
}
}
示例13: generateInOverworld
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
private void generateInOverworld(Instruction par1, World world, Random random, int x, int z)
{
for (int k = 0; k < par1.getVeinsPerChunk(); k++)
{
int chunkX = x + random.nextInt(16);
int chunkY = random.nextInt(par1.getMaxHeight());
int chunkZ = z + random.nextInt(16);
//TODO Implement the below if() statement
//if(world.getBlockState(instruction.getBlockType() == GlobalAdditions.surfaceCrystals)) {
if (!isValidSpawn(world, chunkX, chunkY, chunkZ))
{
return;
}
//}
new WorldGenMinable(par1.getBlockType().getDefaultState(), par1.getBlocksPerVein()).generate(world, random, new BlockPos(chunkX, chunkY, chunkZ));
}
}
示例14: generate
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
IChunkProvider chunkProvider) {
chunkX *= 16;
chunkZ *= 16;
//System.out.println("All the cool kids do world gen");
if(world.provider.dimensionId == 0)
{
//for(int k = 0; k < 1; k++) {
int chance = 2;
if(MineGate.doesClassExist("moze_intel.projecte.api.ProjectEAPI"))
chance = 16;
if(random.nextInt(chance) == 0)
{
int firstBlockXCoord = chunkX + random.nextInt(16);
int firstBlockYCoord = random.nextInt(10);
int firstBlockZCoord = chunkZ + random.nextInt(16);
new WorldGenMinable(MineGate.naquadahOre, 3).generate(world, random, firstBlockXCoord, firstBlockYCoord, firstBlockZCoord);
//System.out.println("Doing stuff at " + firstBlockXCoord + ", " + firstBlockYCoord + ", " + firstBlockZCoord);
//}
}
}
}
示例15: generate
import net.minecraft.world.gen.feature.WorldGenMinable; //導入依賴的package包/類
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
IChunkProvider chunkProvider) {
chunkX *= 16;
chunkZ *= 16;
if(world.provider.dimensionId == 0)
{
int chance = 2;
if(MineGate.doesClassExist("moze_intel.projecte.api.ProjectEAPI"))
chance = 16;
if(random.nextInt(chance) == 0)
{
int firstBlockXCoord = chunkX + random.nextInt(16);
int firstBlockYCoord = random.nextInt(10);
int firstBlockZCoord = chunkZ + random.nextInt(16);
new WorldGenMinable(MineGate.naquadahOre, 3).generate(world, random, firstBlockXCoord, firstBlockYCoord, firstBlockZCoord);
//System.out.println("Doing stuff at " + firstBlockXCoord + ", " + firstBlockYCoord + ", " + firstBlockZCoord);
//}
}
}
}