当前位置: 首页>>代码示例>>Java>>正文


Java WorldGeneratorBonusChest.generate方法代码示例

本文整理汇总了Java中net.minecraft.world.gen.feature.WorldGeneratorBonusChest.generate方法的典型用法代码示例。如果您正苦于以下问题:Java WorldGeneratorBonusChest.generate方法的具体用法?Java WorldGeneratorBonusChest.generate怎么用?Java WorldGeneratorBonusChest.generate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.gen.feature.WorldGeneratorBonusChest的用法示例。


在下文中一共展示了WorldGeneratorBonusChest.generate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createBonusChest

import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; //导入方法依赖的package包/类
/**
 * Creates the bonus chest in the world.
 */
protected void createBonusChest()
{
    WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10);

    for (int i = 0; i < 10; ++i)
    {
        int j = this.worldInfo.getSpawnX() + this.rand.nextInt(6) - this.rand.nextInt(6);
        int k = this.worldInfo.getSpawnZ() + this.rand.nextInt(6) - this.rand.nextInt(6);
        BlockPos blockpos = this.getTopSolidOrLiquidBlock(new BlockPos(j, 0, k)).up();

        if (worldgeneratorbonuschest.generate(this, this.rand, blockpos))
        {
            break;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:WorldServer.java

示例2: createBonusChest

import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; //导入方法依赖的package包/类
/**
 * Creates the bonus chest in the world.
 */
protected void createBonusChest()
{
    WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest();

    for (int i = 0; i < 10; ++i)
    {
        int j = this.worldInfo.getSpawnX() + this.rand.nextInt(6) - this.rand.nextInt(6);
        int k = this.worldInfo.getSpawnZ() + this.rand.nextInt(6) - this.rand.nextInt(6);
        BlockPos blockpos = this.getTopSolidOrLiquidBlock(new BlockPos(j, 0, k)).up();

        if (worldgeneratorbonuschest.generate(this, this.rand, blockpos))
        {
            break;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:WorldServer.java

示例3: createBonusChest

import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; //导入方法依赖的package包/类
public static void createBonusChest(World world)
{
    WorldInfo info = world.getWorldInfo();
    WorldGeneratorBonusChest gen = new WorldGeneratorBonusChest();

    for (int i = 0; i < 10; ++i)
    {
        int x = info.getSpawnX() + world.rand.nextInt(6) - world.rand.nextInt(6);
        int z = info.getSpawnZ() + world.rand.nextInt(6) - world.rand.nextInt(6);
        BlockPos pos = world.getTopSolidOrLiquidBlock(new BlockPos(x, 0, z)).up();

        if (gen.generate(world, world.rand, pos))
        {
            break;
        }
    }
}
 
开发者ID:maruohon,项目名称:justenoughdimensions,代码行数:18,代码来源:WorldUtils.java

示例4: createBonusChest

import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; //导入方法依赖的package包/类
/**
 * Creates the bonus chest in the specified world.
 */
protected void createBonusChest(World world)
{
    WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest();

    for (int i = 0; i < 10; ++i)
    {
        int j = world.getWorldInfo().getSpawnX() + world.rand.nextInt(6) - world.rand.nextInt(6);
        int k = world.getWorldInfo().getSpawnZ() + world.rand.nextInt(6) - world.rand.nextInt(6);
        BlockPos blockpos = world.getTopSolidOrLiquidBlock(new BlockPos(j, 0, k)).up();

        if(worldgeneratorbonuschest.generate(world, world.rand, blockpos))
        {
            break;
        }
    }
}
 
开发者ID:Lumaceon,项目名称:ClockworkPhase2,代码行数:20,代码来源:WorldHandler.java

示例5: createBonusChest

import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; //导入方法依赖的package包/类
/**
 * Creates the bonus chest in the world.
 */
protected void createBonusChest()
{
    WorldGeneratorBonusChest var1 = new WorldGeneratorBonusChest(bonusChestContent, 10);

    for (int var2 = 0; var2 < 10; ++var2)
    {
        int var3 = this.worldInfo.getSpawnX() + this.rand.nextInt(6) - this.rand.nextInt(6);
        int var4 = this.worldInfo.getSpawnZ() + this.rand.nextInt(6) - this.rand.nextInt(6);
        int var5 = this.getTopSolidOrLiquidBlock(var3, var4) + 1;

        if (var1.generate(this, this.rand, var3, var5, var4))
        {
            break;
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:20,代码来源:WorldServer.java

示例6: createBonusChest

import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; //导入方法依赖的package包/类
protected void createBonusChest()
{
    WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(ChestGenHooks.getItems(BONUS_CHEST, rand), ChestGenHooks.getCount(BONUS_CHEST, rand));

    for (int i = 0; i < 10; ++i)
    {
        int j = this.worldInfo.getSpawnX() + this.rand.nextInt(6) - this.rand.nextInt(6);
        int k = this.worldInfo.getSpawnZ() + this.rand.nextInt(6) - this.rand.nextInt(6);
        int l = this.getTopSolidOrLiquidBlock(j, k) + 1;

        if (worldgeneratorbonuschest.generate(this, this.rand, j, l, k))
        {
            break;
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:17,代码来源:WorldServer.java

示例7: createBonusChest

import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; //导入方法依赖的package包/类
/**
 * Creates the bonus chest in the world.
 */
protected void createBonusChest()
{
    WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(ChestGenHooks.getItems(BONUS_CHEST, rand), ChestGenHooks.getCount(BONUS_CHEST, rand));

    for (int i = 0; i < 10; ++i)
    {
        int j = this.worldInfo.getSpawnX() + this.rand.nextInt(6) - this.rand.nextInt(6);
        int k = this.worldInfo.getSpawnZ() + this.rand.nextInt(6) - this.rand.nextInt(6);
        int l = this.getTopSolidOrLiquidBlock(j, k) + 1;

        if (worldgeneratorbonuschest.generate(this, this.rand, j, l, k))
        {
            break;
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:20,代码来源:WorldServer.java

示例8: onCreateSpawn

import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; //导入方法依赖的package包/类
public void onCreateSpawn(WorldEvent.CreateSpawnPosition event) {
    WorldServer world = (WorldServer)(event.getWorld());
    if (ignore(world.getWorldType(),this.newSettings)) {
        return;
    }
    int dimension = world.provider.getDimension();
    if (!this.dimensionSettings.ccOnIn(dimension)) {
        if (!DimensionalSettingsRegistry.instance.useCCIn(dimension)) {
            return;
        }
    }// only change dimensions we're supposed to;
    onWorldLoad(event.getWorld());
    salvageSpawn(event.getWorld());
    if (event.getSettings().isBonusChestEnabled()) {
        Random rand = new Random(world.getSeed());
        WorldGeneratorBonusChest worldgeneratorbonuschest =new WorldGeneratorBonusChest();

        for (int i = 0; i < 100; ++i){
            int j = world.getWorldInfo().getSpawnX() + rand.nextInt(6+i/10) - rand.nextInt(6+i/10);
            int k = world.getWorldInfo().getSpawnZ() + rand.nextInt(6+i/10) - rand.nextInt(6+i/10);

            BlockPos topBlockSpot = new BlockPos(j,world.getActualHeight()-1,k);
            while (!world.getBlockState(topBlockSpot).getBlock().isBlockSolid(world, topBlockSpot, EnumFacing.UP)) {
                topBlockSpot = topBlockSpot.down();
            }
            BlockPos above = topBlockSpot.up();

            if (world.getBlockState(above).getBlock().isAir(world.getBlockState(above),world, above)){
                if (worldgeneratorbonuschest.generate(world, rand, above)) break;
            }
        }
    }
    event.setCanceled(true);
}
 
开发者ID:Zeno410,项目名称:Geographicraft,代码行数:35,代码来源:DimensionManager.java

示例9: createBonusChest

import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; //导入方法依赖的package包/类
/**
 * Creates the bonus chest in the world.
 */
protected void createBonusChest() {
	WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(
			ChestGenHooks.getItems(BONUS_CHEST, rand), ChestGenHooks.getCount(BONUS_CHEST, rand));

	for (int i = 0; i < 10; ++i) {
		int j = this.worldInfo.getSpawnX() + this.rand.nextInt(6) - this.rand.nextInt(6);
		int k = this.worldInfo.getSpawnZ() + this.rand.nextInt(6) - this.rand.nextInt(6);
		int l = this.getTopSolidOrLiquidBlock(j, k) + 1;

		if (worldgeneratorbonuschest.generate(this, this.rand, j, l, k)) {
			break;
		}
	}
}
 
开发者ID:OreCruncher,项目名称:Jiffy,代码行数:18,代码来源:WorldServer.java


注:本文中的net.minecraft.world.gen.feature.WorldGeneratorBonusChest.generate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。