本文整理汇总了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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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);
}
示例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;
}
}
}