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


Java EditSession.nullBlock方法代码示例

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


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

示例1: getBlockInHand

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public BaseBlock getBlockInHand() throws WorldEditException {
    ItemStack itemStack = player.getItemInHand();
    if (itemStack == null) {
        return EditSession.nullBlock;
    }
    final int typeId = itemStack.getTypeId();
    switch (typeId) {
        case 0:
            return EditSession.nullBlock;
        case ItemID.INK_SACK:
            final Dye materialData = (Dye) itemStack.getData();
            if (materialData.getColor() == DyeColor.BROWN) {
                return FaweCache.getBlock(BlockID.COCOA_PLANT, 0);
            }
            break;
        case ItemID.HEAD:
            return new SkullBlock(0, (byte) itemStack.getDurability());

        default:
            final BaseBlock baseBlock = BlockType.getBlockForItem(typeId, itemStack.getDurability());
            if (baseBlock != null) {
                return baseBlock;
            }
            break;
    }
    BaseBlock block = FaweCache.getBlock(typeId, itemStack.getType().getMaxDurability() != 0 ? 0 : Math.max(0, itemStack.getDurability()));
    if (Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES && Fawe.<FaweBukkit>imp().getItemUtil() != null) {
        return new BrushBoundBaseBlock(this, WorldEdit.getInstance().getSession(this), itemStack);
    }
    return block;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:33,代码来源:BukkitPlayer.java

示例2: getBlockInHand

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public BaseBlock getBlockInHand() throws WorldEditException {
    PlayerInventory inv = player.getInventory();
    Item itemStack = inv.getItemInHand();
    if (itemStack == null) {
        return EditSession.nullBlock;
    }
    return new BaseBlock(itemStack.getId(), itemStack.getMaxDurability() != 0 ? 0 : itemStack.getDamage());
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:10,代码来源:NukkitPlayer.java

示例3: getBlock

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public BaseBlock getBlock(Vector position) {
    if (!contains(position)) {
        if (!limit.MAX_FAILS()) {
            WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_FAILS);
        }
        return EditSession.nullBlock;
    }
    return super.getBlock(position);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:FaweRegionExtent.java

示例4: getLazyBlock

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public BaseBlock getLazyBlock(Vector position) {
    if (!contains(position)) {
        if (!limit.MAX_FAILS()) {
            WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_FAILS);
        }
        return EditSession.nullBlock;
    }
    return super.getLazyBlock(position);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:FaweRegionExtent.java

示例5: getLazyBlock

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public BaseBlock getLazyBlock(int x, int y, int z) {
    if (!limit.MAX_CHECKS()) {
        WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
        return EditSession.nullBlock;
    } else {
        return extent.getLazyBlock(x, y, z);
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:10,代码来源:ProcessedWEExtent.java

示例6: getNearestSurfaceTerrainBlock

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
public default int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax) {
    y = Math.max(minY, Math.min(maxY, y));
    int clearanceAbove = maxY - y;
    int clearanceBelow = y - minY;
    int clearance = Math.min(clearanceAbove, clearanceBelow);
    BaseBlock block = getLazyBlock(x, y, z);
    boolean state = FaweCache.canPassThrough(block.getId(), block.getData());
    int offset = state ? 0 : 1;
    for (int d = 0; d <= clearance; d++) {
        int y1 = y + d;
        block = getLazyBlock(x, y1, z);
        if (FaweCache.canPassThrough(block.getId(), block.getData()) != state && block != EditSession.nullBlock) return y1 - offset;
        int y2 = y - d;
        block = getLazyBlock(x, y2, z);
        if (FaweCache.canPassThrough(block.getId(), block.getData()) != state && block != EditSession.nullBlock) return y2 + offset;
    }
    if (clearanceAbove != clearanceBelow) {
        if (clearanceAbove < clearanceBelow) {
            for (int layer = y - clearance - 1; layer >= minY; layer--) {
                block = getLazyBlock(x, layer, z);
                if (FaweCache.canPassThrough(block.getId(), block.getData()) != state && block != EditSession.nullBlock) return layer + offset;
            }
        } else {
            for (int layer = y + clearance + 1; layer <= maxY; layer++) {
                block = getLazyBlock(x, layer, z);
                if (FaweCache.canPassThrough(block.getId(), block.getData()) != state && block != EditSession.nullBlock) return layer - offset;
            }
        }
    }
    return state ? failedMin : failedMax;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:32,代码来源:Extent.java

示例7: getBlock

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public BaseBlock getBlock(Vector position) {
    if (region.contains(position)) {
        int x = position.getBlockX() - mx;
        int y = position.getBlockY() - my;
        int z = position.getBlockZ() - mz;
        return IMP.getBlock(x, y, z);
    }
    return EditSession.nullBlock;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:BlockArrayClipboard.java

示例8: getBlockInHand

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public BaseBlock getBlockInHand() {
    ItemStack is = this.player.getHeldItem(EnumHand.MAIN_HAND);
    return is == null ? EditSession.nullBlock : new BaseBlock(Item.getIdFromItem(is.getItem()), is.isItemStackDamageable() ? 0 : is.getItemDamage());
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:6,代码来源:ForgePlayer.java

示例9: getBlockInHand

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public BaseBlock getBlockInHand() {
    ItemStack is = this.player.getCurrentEquippedItem();
    return is == null ? EditSession.nullBlock : new BaseBlock(Item.getIdFromItem(is.getItem()), is.isItemStackDamageable() ? 0 : is.getItemDamage());
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:6,代码来源:ForgePlayer.java

示例10: getBlock

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
public BaseBlock getBlock(Vector position) {
    return EditSession.nullBlock;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:4,代码来源:EmptyExtent.java

示例11: getLazyBlock

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
public BaseBlock getLazyBlock(Vector position) {
    return EditSession.nullBlock;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:4,代码来源:EmptyExtent.java

示例12: getBlock

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public BaseBlock getBlock(Vector position) {
    return EditSession.nullBlock;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:5,代码来源:EmptyClipboard.java

示例13: getLazyBlock

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public BaseBlock getLazyBlock(Vector position) {
    return EditSession.nullBlock;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:5,代码来源:EmptyClipboard.java

示例14: apply

import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
public int apply(int[] data) throws WorldEditException {
    checkNotNull(data);

    Vector minY = region.getMinimumPoint();
    int originX = minY.getBlockX();
    int originY = minY.getBlockY();
    int originZ = minY.getBlockZ();

    int maxY = region.getMaximumPoint().getBlockY();
    BaseBlock fillerAir = EditSession.nullBlock;

    int blocksChanged = 0;

    BaseBlock tmpBlock = EditSession.nullBlock;

    // Apply heightmap
    int index = 0;
    for (int z = 0; z < height; ++z) {
        int zr = z + originZ;
        for (int x = 0; x < width; ++x, index++) {
            int curHeight = this.data[index];
            if (this.invalid != null && this.invalid[index]) continue;
            int newHeight = Math.min(maxY, data[index]);

            int xr = x + originX;

            // Depending on growing or shrinking we need to start at the bottom or top
            if (newHeight > curHeight) {
                // Set the top block of the column to be the same type (this might go wrong with rounding)
                BaseBlock existing = session.getBlock(xr, curHeight, zr);


                // Skip water/lava
                if (!FaweCache.isLiquidOrGas(existing.getId())) {
                    int y0 = newHeight - 1;
                    for (int setY = y0, getY = curHeight - 1; setY >= curHeight; setY--, getY--) {
                        BaseBlock get = session.getBlock(xr, getY, zr);
                        if (get != EditSession.nullBlock) tmpBlock = get;
                        session.setBlock(xr, setY, zr, tmpBlock);
                        ++blocksChanged;
                    }
                    session.setBlock(xr, newHeight, zr, existing);
                    ++blocksChanged;
                }
            } else if (curHeight > newHeight) {
                // Set the top block of the column to be the same type
                // (this could otherwise go wrong with rounding)
                session.setBlock(xr, newHeight, zr, session.getBlock(xr, curHeight, zr));
                ++blocksChanged;

                // Fill rest with air
                for (int y = newHeight + 1; y <= curHeight; ++y) {
                    session.setBlock(xr, y, zr, fillerAir);
                    ++blocksChanged;
                }
            }
        }
    }
    return blocksChanged;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:61,代码来源:HeightMap.java


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