本文整理匯總了Java中net.minecraft.world.WorldServer.getPersistentChunkIterable方法的典型用法代碼示例。如果您正苦於以下問題:Java WorldServer.getPersistentChunkIterable方法的具體用法?Java WorldServer.getPersistentChunkIterable怎麽用?Java WorldServer.getPersistentChunkIterable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.world.WorldServer
的用法示例。
在下文中一共展示了WorldServer.getPersistentChunkIterable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onTickSnowDecrease
import net.minecraft.world.WorldServer; //導入方法依賴的package包/類
private static void onTickSnowDecrease(WorldServer world) {
for (Iterator<Chunk> iterator = world.getPersistentChunkIterable(world.getPlayerChunkMap().getChunkIterator()); iterator.hasNext();) {
Chunk chunk = iterator.next();
if (r.nextInt(Config.snowMeltRate) != 0) {
continue;
}
BlockPos pos = getRandomPosInChunk(chunk);
pos = getSnowTopPosition(world, pos);
int layers = snowHeightAt(world, pos);
if (layers <= Config.snowMinLayers) {
continue;
}
if (layers % 8 != 1) {
// decrement layer
world.setBlockState(pos, Blocks.SNOW_LAYER.getDefaultState().withProperty(BlockSnow.LAYERS, (layers-1)%8));
} else {
//remove last layer
world.setBlockToAir(pos);
}
}
}
示例2: onTickSnowIncrease
import net.minecraft.world.WorldServer; //導入方法依賴的package包/類
private static void onTickSnowIncrease(WorldServer world) {
int baseRate = Config.accumulationRate;
if (world.isThundering()) {
baseRate /= 2;
}
for (Iterator<Chunk> iterator = world.getPersistentChunkIterable(world.getPlayerChunkMap().getChunkIterator()); iterator.hasNext();) {
Chunk chunk = iterator.next();
if (r.nextInt(baseRate) != 0) {
continue;
}
if (!world.provider.canDoRainSnowIce(chunk)) {
continue;
}
BlockPos pos = getRandomPosInChunk(chunk);
pos = getSnowTopPosition(world, pos);
int layers = snowHeightAt(world, pos);
int surroundingAtLayer = 0;
for(EnumFacing side : EnumFacing.HORIZONTALS){
if (snowHeightAt(world, getSnowTopPosition(world, pos.offset(side))) >= layers) {
surroundingAtLayer++;
}
}
if (surroundingAtLayer < Config.smoothing) {
continue;
}
switch(Config.snowDriftArea) {
case 9:
incrementSnowHeight(world, pos.north().east());
case 8:
incrementSnowHeight(world, pos.south().west());
case 7:
incrementSnowHeight(world, pos.north().west());
case 6:
incrementSnowHeight(world, pos.south().east());
case 5:
incrementSnowHeight(world, pos.west());
case 4:
incrementSnowHeight(world, pos.east());
case 3:
incrementSnowHeight(world, pos.north());
case 2:
incrementSnowHeight(world, pos.south());
case 1:
incrementSnowHeight(world, pos);
}
}
}