本文整理汇总了Java中com.sk89q.worldedit.extent.Extent.setBlock方法的典型用法代码示例。如果您正苦于以下问题:Java Extent.setBlock方法的具体用法?Java Extent.setBlock怎么用?Java Extent.setBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldedit.extent.Extent
的用法示例。
在下文中一共展示了Extent.setBlock方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import com.sk89q.worldedit.extent.Extent; //导入方法依赖的package包/类
@Override
public boolean apply(Extent extent, Vector setPosition, Vector getPosition) throws WorldEditException {
BaseBlock block = extent.getBlock(getPosition);
int color = util.getColor(block);
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = (color >> 0) & 0xFF;
int alpha = (color >> 24) & 0xFF;
double l = 0.3f * r + 0.6f * g + 0.1f * b;
int red = (int) (r + value * (l - r));
int green = (int) (g + value * (l - g));
int blue = (int) (b + value * (l - b));
int newColor = (alpha << 24) + (red << 16) + (green << 8) + (blue << 0);
if (newColor == color) {
return false;
}
BaseBlock newBlock = util.getNextNearestBlock(newColor);
if (block.equals(newBlock)) {
return false;
}
return extent.setBlock(setPosition, newBlock);
}
示例2: apply
import com.sk89q.worldedit.extent.Extent; //导入方法依赖的package包/类
@Override
public boolean apply(Extent extent, Vector setPosition, Vector getPosition) throws WorldEditException {
BaseBlock block = extent.getBlock(getPosition);
int currentColor = util.getColor(block);
if (currentColor == 0) return false;
int newColor = util.averageColor(currentColor, color);
BaseBlock newBlock = util.getNearestBlock(newColor);
if (newBlock.equals(block)) return false;
return extent.setBlock(setPosition, newBlock);
}
示例3: apply
import com.sk89q.worldedit.extent.Extent; //导入方法依赖的package包/类
@Override
public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException {
if (set.getBlockX() == get.getBlockX() && set.getBlockZ() == get.getBlockZ() && set.getBlockY() == get.getBlockY()) {
return false;
}
return extent.setBlock(set, extent.getBlock(get));
}
示例4: apply
import com.sk89q.worldedit.extent.Extent; //导入方法依赖的package包/类
@Override
public boolean apply(Extent extent, Vector setPosition, Vector getPosition) throws WorldEditException {
BaseBlock block = extent.getBlock(getPosition);
int currentColor = util.getColor(block);
if (currentColor == 0) return false;
int newColor = util.multiplyColor(currentColor, color);
BaseBlock newBlock = util.getNearestBlock(newColor);
if (newBlock.equals(block)) return false;
return extent.setBlock(setPosition, newBlock);
}
示例5: getAndResetTarget
import com.sk89q.worldedit.extent.Extent; //导入方法依赖的package包/类
public boolean getAndResetTarget(Extent extent, Vector set, Vector get) throws WorldEditException {
BaseBlock result = block;
if (result != null) {
block = null;
return extent.setBlock(set, result);
} else {
return pattern.apply(extent, set, target);
}
}
示例6: apply
import com.sk89q.worldedit.extent.Extent; //导入方法依赖的package包/类
@Override
public boolean apply(Extent extent, Vector setPosition, Vector getPosition) throws WorldEditException {
BaseBlock block = extent.getBlock(getPosition);
int slope = getSlope(block, getPosition);
if (slope == -1) return false;
int color = util.getColor(block);
if (color == 0) return false;
int newColor = getColor(color, slope);
BaseBlock newBlock = util.getNearestBlock(newColor);
if (newBlock == null) return false;
return extent.setBlock(setPosition, newBlock);
}
示例7: apply
import com.sk89q.worldedit.extent.Extent; //导入方法依赖的package包/类
@Override
public boolean apply(Extent extent, Vector setPosition, Vector getPosition) throws WorldEditException {
BaseBlock block = extent.getBlock(getPosition);
int slope = getSlope(block, getPosition);
if (slope == -1) return false;
int data = (Math.min(slope, 255)) >> 4;
return extent.setBlock(setPosition, FaweCache.getBlock(block.getId(), data));
}
示例8: apply
import com.sk89q.worldedit.extent.Extent; //导入方法依赖的package包/类
default boolean apply(Extent extent, Vector setPosition, Vector getPosition) throws WorldEditException {
return extent.setBlock(setPosition, next(getPosition));
}
示例9: apply
import com.sk89q.worldedit.extent.Extent; //导入方法依赖的package包/类
@Override
public boolean apply(Extent extent, Vector setPosition, Vector getPosition) throws WorldEditException {
return extent.setBlock(setPosition, this);
}