Java Code Examples for com.sk89q.worldedit.blocks.BaseBlock#setData()

The following examples show how to use com.sk89q.worldedit.blocks.BaseBlock#setData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MappedReplacePatternFilter.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void applyBlock(int x, int y, int z, BaseBlock block, MutableLong ignore) {
    int id = block.getId();
    int data = FaweCache.hasData(id) ? block.getData() : 0;
    int combined = FaweCache.getCombined(id, data);
    Pattern p = map[combined];
    if (p != null) {
        BaseBlock newBlock = p.apply(x, y, z);
        int currentId = block.getId();
        if (FaweCache.hasNBT(currentId)) {
            block.setNbtData(null);
        }
        block.setId(newBlock.getId());
        block.setData(newBlock.getData());
    }
}
 
Example 2
Source File: SetPatternFilter.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void applyBlock(int x, int y, int z, BaseBlock block, MutableLong count) {
    BaseBlock newBlock = to.apply(x, y, z);
    int currentId = block.getId();
    if (FaweCache.hasNBT(currentId)) {
        block.setNbtData(null);
    }
    block.setId(newBlock.getId());
    block.setData(newBlock.getData());
    count.increment();
}
 
Example 3
Source File: ReplacePatternFilter.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void applyBlock(int x, int y, int z, BaseBlock block, MutableLong ignore) {
    if (matchFrom.apply(block)) {
        BaseBlock newBlock = to.apply(x, y, z);
        int currentId = block.getId();
        if (FaweCache.hasNBT(currentId)) {
            block.setNbtData(null);
        }
        block.setId(newBlock.getId());
        block.setData(newBlock.getData());
    }
}
 
Example 4
Source File: BundledBlockData.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean set(BaseBlock block) {
    if (data != null) {
        block.setData((block.getData() & ~state.getDataMask()) | data);
        return true;
    } else {
        return false;
    }
}