本文整理汇总了Java中com.sk89q.worldedit.blocks.BlockID.STATIONARY_WATER属性的典型用法代码示例。如果您正苦于以下问题:Java BlockID.STATIONARY_WATER属性的具体用法?Java BlockID.STATIONARY_WATER怎么用?Java BlockID.STATIONARY_WATER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sk89q.worldedit.blocks.BlockID
的用法示例。
在下文中一共展示了BlockID.STATIONARY_WATER属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLiquidMask
@Override
default Mask createLiquidMask() {
return new BlockMask(this,
new BaseBlock(BlockID.STATIONARY_LAVA, -1),
new BaseBlock(BlockID.LAVA, -1),
new BaseBlock(BlockID.STATIONARY_WATER, -1),
new BaseBlock(BlockID.WATER, -1));
}
示例2: drainArea
/**
* Drain nearby pools of water or lava.
*
* @param origin the origin to drain from, which will search a 3x3 area
* @param radius the radius of the removal, where a value should be 0 or greater
* @return number of blocks affected
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int drainArea(final Vector origin, final double radius) {
checkNotNull(origin);
checkArgument(radius >= 0, "radius >= 0 required");
Mask liquidMask;
// Not thread safe, use hardcoded liquidmask
// if (getWorld() != null) {
// liquidMask = getWorld().createLiquidMask();
// } else {
liquidMask = new BlockMask(this,
new BaseBlock(BlockID.STATIONARY_LAVA, -1),
new BaseBlock(BlockID.LAVA, -1),
new BaseBlock(BlockID.STATIONARY_WATER, -1),
new BaseBlock(BlockID.WATER, -1));
// }
final MaskIntersection mask = new MaskIntersection(
new BoundedHeightMask(0, EditSession.this.getMaximumPoint().getBlockY()),
new RegionMask(
new EllipsoidRegion(null, origin,
new Vector(radius, radius, radius))), liquidMask);
final BlockReplace replace = new BlockReplace(EditSession.this, new BaseBlock(BlockID.AIR));
final RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1), this);
// Around the origin in a 3x3 block
for (final BlockVector position : CuboidRegion.fromCenter(origin, 1)) {
if (mask.test(position)) {
visitor.visit(position);
}
}
Operations.completeBlindly(visitor);
return this.changes = visitor.getAffected();
}
示例3: canTick
private static boolean canTick(int id) {
switch (id) {
case BlockID.VINE:
case BlockID.FIRE:
case BlockID.ICE:
case BlockID.PACKED_ICE:
case BlockID.FROSTED_ICE:
case BlockID.LEAVES:
case BlockID.LEAVES2:
case BlockID.SOIL:
case BlockID.CACTUS:
case BlockID.REED:
case BlockID.CHORUS_FLOWER:
case BlockID.CHORUS_PLANT:
case BlockID.GRASS:
case BlockID.MYCELIUM:
case BlockID.SAPLING:
case BlockID.WATER:
case BlockID.STATIONARY_WATER:
case BlockID.LAVA:
case BlockID.STATIONARY_LAVA:
case BlockID.GLOWING_REDSTONE_ORE:
case BlockID.REDSTONE_ORE:
case BlockID.PORTAL:
case BlockID.END_PORTAL:
case BlockID.REDSTONE_BLOCK:
case BlockID.REDSTONE_LAMP_OFF:
case BlockID.REDSTONE_LAMP_ON:
case BlockID.REDSTONE_REPEATER_OFF:
case BlockID.REDSTONE_REPEATER_ON:
case BlockID.COMMAND_BLOCK:
case BlockID.CHAIN_COMMAND_BLOCK:
case BlockID.REPEATING_COMMAND_BLOCK:
case BlockID.REDSTONE_TORCH_OFF:
case BlockID.REDSTONE_TORCH_ON:
case BlockID.REDSTONE_WIRE:
case BlockID.CROPS:
case BlockID.MELON_STEM:
case BlockID.PUMPKIN_STEM:
case BlockID.POTATOES:
case BlockID.CARROTS:
case BlockID.COCOA_PLANT:
case BlockID.BEETROOTS:
case BlockID.NETHER_WART:
case BlockID.NETHER_WART_BLOCK:
case BlockID.BROWN_MUSHROOM:
case BlockID.RED_MUSHROOM:
return true;
default: return false;
}
}
示例4: thaw
/**
* Thaw blocks in a radius.
*
* @param position the position
* @param radius the radius
* @return number of blocks affected
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int thaw(final Vector position, final double radius) {
final double radiusSq = radius * radius;
final int ox = position.getBlockX();
final int oy = position.getBlockY();
final int oz = position.getBlockZ();
final BaseBlock air = new BaseBlock(0);
final BaseBlock water = new BaseBlock(BlockID.STATIONARY_WATER);
final int ceilRadius = (int) Math.ceil(radius);
for (int x = ox - ceilRadius; x <= (ox + ceilRadius); ++x) {
int dx = x - ox;
int dx2 = dx * dx;
for (int z = oz - ceilRadius; z <= (oz + ceilRadius); ++z) {
int dz = z - oz;
int dz2 = dz * dz;
if (dx2 + dz2 > radiusSq) {
continue;
}
for (int y = maxY; y >= 1; --y) {
final int id = FaweCache.getId(queue.getCombinedId4Data(x, y, z));
switch (id) {
case BlockID.ICE:
this.setBlock(x, y, z, water);
break;
case BlockID.SNOW:
this.setBlock(x, y, z, air);
break;
case BlockID.AIR:
continue;
default:
break;
}
break;
}
}
}
return changes;
}
示例5: simulateSnow
/**
* Make snow in a radius.
*
* @param position a position
* @param radius a radius
* @return number of blocks affected
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int simulateSnow(final Vector position, final double radius) {
final double radiusSq = radius * radius;
final int ox = position.getBlockX();
final int oy = position.getBlockY();
final int oz = position.getBlockZ();
final BaseBlock ice = new BaseBlock(BlockID.ICE);
final BaseBlock snow = new BaseBlock(BlockID.SNOW);
final int ceilRadius = (int) Math.ceil(radius);
for (int x = ox - ceilRadius; x <= (ox + ceilRadius); ++x) {
int dx = x - ox;
int dx2 = dx * dx;
for (int z = oz - ceilRadius; z <= (oz + ceilRadius); ++z) {
int dz = z - oz;
int dz2 = dz * dz;
if (dx2 + dz2 > radiusSq) {
continue;
}
outer:
for (int y = maxY; y >= 1; --y) {
final int id = FaweCache.getId(queue.getCombinedId4Data(x, y, z));
if (id == BlockID.AIR) {
continue;
}
// Ice!
if ((id == BlockID.WATER) || (id == BlockID.STATIONARY_WATER)) {
this.setBlock(x, y, z, ice);
break;
}
// Snow should not cover these blocks
if (BlockType.isTranslucent(id)) {
switch (id) {
case BlockID.LEAVES:
case BlockID.LEAVES2:
break;
default:
break outer;
}
}
// Too high?
if (y == maxY) {
break;
}
// add snow cover
this.setBlock(x, y + 1, z, snow);
break;
}
}
}
return changes;
}
示例6: green
/**
* Make dirt green.
*
* @param position a position
* @param radius a radius
* @param onlyNormalDirt only affect normal dirt (data value 0)
* @return number of blocks affected
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int green(final Vector position, final double radius, final boolean onlyNormalDirt) {
final double radiusSq = radius * radius;
final int ox = position.getBlockX();
final int oy = position.getBlockY();
final int oz = position.getBlockZ();
final BaseBlock grass = new BaseBlock(BlockID.GRASS);
final int ceilRadius = (int) Math.ceil(radius);
for (int x = ox - ceilRadius; x <= (ox + ceilRadius); ++x) {
int dx = x - ox;
int dx2 = dx * dx;
for (int z = oz - ceilRadius; z <= (oz + ceilRadius); ++z) {
int dz = z - oz;
int dz2 = dz * dz;
if (dx2 + dz2 > radiusSq) {
continue;
}
loop:
for (int y = maxY; y >= 1; --y) {
BaseBlock block = getLazyBlock(x, y, z);
final int id = block.getId();
final int data = block.getData();
switch (id) {
case BlockID.DIRT:
if (onlyNormalDirt && (data != 0)) {
break loop;
}
this.setBlock(x, y, z, grass);
break loop;
case BlockID.WATER:
case BlockID.STATIONARY_WATER:
case BlockID.LAVA:
case BlockID.STATIONARY_LAVA:
// break on liquids...
break loop;
default:
// ...and all non-passable blocks
if (!BlockType.canPassThrough(id, data)) {
break loop;
}
}
}
}
}
return changes;
}