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


Java Operations.completeLegacy方法代码示例

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


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

示例1: forest

import com.sk89q.worldedit.function.operation.Operations; //导入方法依赖的package包/类
@Command(
        aliases = {"/forest"},
        usage = "[type] [density]",
        desc = "Make a forest within the region",
        min = 0,
        max = 2
)
@CommandPermissions("worldedit.region.forest")
@Logging(REGION)
public void forest(FawePlayer player, EditSession editSession, @Selection Region region, @Optional("tree") TreeType type,
                   @Optional("5") @Range(min = 0, max = 100) double density,
                   CommandContext context) throws WorldEditException {
    player.checkConfirmationRegion(getArguments(context), region);

    density = density / 100;
    ForestGenerator generator = new ForestGenerator(editSession, new TreeGenerator(type));
    GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator);
    LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground);
    visitor.setMask(new NoiseFilter2D(new RandomNoise(), density));
    Operations.completeLegacy(visitor);

    BBC.COMMAND_TREE.send(player, ground.getAffected());
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:RegionCommands.java

示例2: flora

import com.sk89q.worldedit.function.operation.Operations; //导入方法依赖的package包/类
@Command(
        aliases = {"/flora"},
        usage = "[density]",
        desc = "Make flora within the region",
        min = 0,
        max = 1
)
@CommandPermissions("worldedit.region.flora")
@Logging(REGION)
public void flora(FawePlayer player, EditSession editSession, @Selection Region region, @Optional("10") @Range(min = 0, max = 100) double density, CommandContext context) throws WorldEditException {
    player.checkConfirmationRegion(getArguments(context), region);
    density = density / 100;
    FloraGenerator generator = new FloraGenerator(editSession);
    GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator);
    LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground);
    visitor.setMask(new NoiseFilter2D(new RandomNoise(), density));
    Operations.completeLegacy(visitor);

    BBC.COMMAND_FLORA.send(player, ground.getAffected());
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:21,代码来源:RegionCommands.java

示例3: pasteWithWE

import com.sk89q.worldedit.function.operation.Operations; //导入方法依赖的package包/类
public static void pasteWithWE(Player p, File f) throws DataException {
	SpongePlayer sp = SpongeWorldEdit.inst().wrapPlayer(p);
	SpongeWorld ws = SpongeWorldEdit.inst().getWorld(p.getWorld());
	
	LocalSession session = SpongeWorldEdit.inst().getSession(p);
	
	Closer closer = Closer.create();
	try {
		ClipboardFormat format = ClipboardFormat.findByAlias("schematic");
		FileInputStream fis = closer.register(new FileInputStream(f));
	    BufferedInputStream bis = closer.register(new BufferedInputStream(fis));
	    ClipboardReader reader = format.getReader(bis);
	    		    
	    WorldData worldData = ws.getWorldData();
	    Clipboard clipboard = reader.read(ws.getWorldData());
	    session.setClipboard(new ClipboardHolder(clipboard, worldData));
	    
	    ClipboardHolder holder = session.getClipboard();
	    
	    Operation op = holder.createPaste(session.createEditSession(sp), ws.getWorldData()).to(session.getPlacementPosition(sp)).build();
	    Operations.completeLegacy(op);
	} catch (IOException | MaxChangedBlocksException | EmptyClipboardException | IncompleteRegionException e) {
		e.printStackTrace();
	}		
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:26,代码来源:WEListener.java

示例4: pasteBlocks

import com.sk89q.worldedit.function.operation.Operations; //导入方法依赖的package包/类
@Override
protected int pasteBlocks(Vector target, Vector offset, double angle) throws MaxChangedBlocksException {
    RoundedTransform transform = new RoundedTransform(new AffineTransform()
            .translate(offset)
            .rotateY(angle));
    if (!this.transform.isIdentity()) {
        transform = transform.combine(this.transform);
    }
    if (!originalTransform.isIdentity()) {
        transform = transform.combine(originalTransform);
    }

    // Pasting
    Clipboard clipboard = clipboardHolder.getClipboard();
    clipboard.setOrigin(center.subtract(centerOffset).round());
    clipboardHolder.setTransform(transform);

    Vector functionOffset = target.subtract(clipboard.getOrigin());
    final int offX = functionOffset.getBlockX();
    final int offY = functionOffset.getBlockY();
    final int offZ = functionOffset.getBlockZ();

    Operation operation = clipboardHolder
            .createPaste(editSession, editSession.getWorldData())
            .to(target)
            .ignoreAirBlocks(true)
            .filter(v -> buffer.add(v.getBlockX() + offX, v.getBlockY() + offY, v.getBlockZ() + offZ))
            .build();
    Operations.completeLegacy(operation);

    // Cleanup
    clipboardHolder.setTransform(originalTransform);
    clipboard.setOrigin(originalOrigin);

    return operation instanceof ForwardExtentCopy ? ((ForwardExtentCopy) operation).getAffected() : 0;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:37,代码来源:ClipboardSpline.java


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