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


Java BaseBlock.setNbtData方法代码示例

本文整理汇总了Java中com.sk89q.worldedit.blocks.BaseBlock.setNbtData方法的典型用法代码示例。如果您正苦于以下问题:Java BaseBlock.setNbtData方法的具体用法?Java BaseBlock.setNbtData怎么用?Java BaseBlock.setNbtData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sk89q.worldedit.blocks.BaseBlock的用法示例。


在下文中一共展示了BaseBlock.setNbtData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBlock

import com.sk89q.worldedit.blocks.BaseBlock; //导入方法依赖的package包/类
public BaseBlock getBlock(Location location)
{
    Preconditions.checkNotNull(location);

    CraftWorld craftWorld = (CraftWorld)location.getWorld();
    int x = location.getBlockX();
    int y = location.getBlockY();
    int z = location.getBlockZ();

    Block bukkitBlock = location.getBlock();
    BaseBlock block = new BaseBlock(bukkitBlock.getTypeId(), bukkitBlock.getData());

    TileEntity te = craftWorld.getHandle().getTileEntity(new BlockPosition(x, y, z));
    if (te != null)
    {
        NBTTagCompound tag = new NBTTagCompound();
        readTileEntityIntoTag(te, tag);
        block.setNbtData((CompoundTag)toNative(tag));
    }
    return block;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:22,代码来源:FaweAdapter_1_10.java

示例2: applyBlock

import com.sk89q.worldedit.blocks.BaseBlock; //导入方法依赖的package包/类
@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());
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:17,代码来源:MappedReplacePatternFilter.java

示例3: getBlock

import com.sk89q.worldedit.blocks.BaseBlock; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public BaseBlock getBlock(Vector position) {
    final int state = BlockRegistryModule.get().getStateInternalIdAndData(
            getWorld().getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ()));
    final Optional<TileEntity> optTile = getWorld().getTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ());
    final BaseBlock baseBlock = new BaseBlock(state >> 4, state & 0xf);
    if (optTile.isPresent()) {
        final TileEntity tile = optTile.get();
        final ObjectSerializer serializer = ObjectSerializerRegistry.get().get(tile.getClass()).get();
        final DataView dataView = serializer.serialize(tile);
        baseBlock.setNbtData(DataViewNbt.to(dataView));
    }
    return baseBlock;
}
 
开发者ID:LanternPowered,项目名称:LanternWorldEdit,代码行数:16,代码来源:LanternWEWorld.java

示例4: remap

import com.sk89q.worldedit.blocks.BaseBlock; //导入方法依赖的package包/类
public BaseBlock remap(BaseBlock block) {
    int combined = block.getCombined();
    if (remap[combined]) {
        char value = remapCombined[combined];
        BaseBlock newBlock = FaweCache.CACHE_BLOCK[value];
        newBlock.setNbtData(block.getNbtData());
        return newBlock;
    }
    return block;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:ClipboardRemapper.java

示例5: applyBlock

import com.sk89q.worldedit.blocks.BaseBlock; //导入方法依赖的package包/类
@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());
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:13,代码来源:ReplacePatternFilter.java

示例6: clearContainerBlockContents

import com.sk89q.worldedit.blocks.BaseBlock; //导入方法依赖的package包/类
@Override
public boolean clearContainerBlockContents(Vector pos) {
    BaseBlock block = getBlock(pos);
    CompoundTag nbt = block.getNbtData();
    if (nbt != null) {
        if (nbt.containsKey("items")) {
            block.setNbtData(null);
            return setBlock(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), block);
        }
    }
    return false;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:13,代码来源:EditSession.java


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