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


Java Extent.setBlock方法代码示例

本文整理汇总了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);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:23,代码来源:DesaturatePattern.java

示例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);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:AverageColorPattern.java

示例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));
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:8,代码来源:ExistingPattern.java

示例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);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:SaturatePattern.java

示例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);
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:10,代码来源:PatternExtent.java

示例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);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:13,代码来源:AngleColorPattern.java

示例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));
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:9,代码来源:DataAnglePattern.java

示例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));
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:4,代码来源:Pattern.java

示例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);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:5,代码来源:BaseBlock.java


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