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


Java Extent类代码示例

本文整理汇总了Java中com.sk89q.worldedit.extent.Extent的典型用法代码示例。如果您正苦于以下问题:Java Extent类的具体用法?Java Extent怎么用?Java Extent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getResettableExtent

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
/**
 * Gets an {@link com.sk89q.worldedit.extent.Extent} from a {@link ArgumentStack}.
 *
 * @param context the context
 * @return an extent
 * @throws ParameterException on other error
 */
@BindingMatch(type = ResettableExtent.class,
        behavior = BindingBehavior.PROVIDES)
public ResettableExtent getResettableExtent(ArgumentStack context) throws ParameterException, InputParseException {
    String input = context.next();
    if (input.equalsIgnoreCase("#null")) return new NullExtent();
    DefaultTransformParser parser = Fawe.get().getTransformParser();
    Actor actor = context.getContext().getLocals().get(Actor.class);
    ParserContext parserContext = new ParserContext();
    parserContext.setActor(context.getContext().getLocals().get(Actor.class));
    if (actor instanceof Entity) {
        Extent extent = ((Entity) actor).getExtent();
        if (extent instanceof World) {
            parserContext.setWorld((World) extent);
        }
    }
    parserContext.setSession(WorldEdit.getInstance().getSessionManager().get(actor));
    return parser.parseFromInput(input, parserContext);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:26,代码来源:FawePrimitiveBinding.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 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

示例3: apply

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
@Override
public boolean apply(Extent extent, Vector setPosition, Vector getPosition) throws WorldEditException {
    ClipboardHolder holder = clipboards.get(PseudoRandom.random.random(clipboards.size()));
    AffineTransform transform = new AffineTransform();
    if (randomRotate) {
        transform = transform.rotateY(PseudoRandom.random.random(4) * 90);
        holder.setTransform(new AffineTransform().rotateY(PseudoRandom.random.random(4) * 90));
    }
    if (randomFlip) {
        transform = transform.scale(new Vector(1, 0, 0).multiply(-2).add(1, 1, 1));
    }
    if (!transform.isIdentity()) {
        holder.setTransform(transform);
    }
    Clipboard clipboard = holder.getClipboard();
    Schematic schematic = new Schematic(clipboard);
    Transform newTransform = holder.getTransform();
    if (newTransform.isIdentity()) {
        schematic.paste(extent, setPosition, false);
    } else {
        schematic.paste(extent, worldData, setPosition, false, newTransform);
    }
    return true;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:25,代码来源:RandomFullClipboardPattern.java

示例4: cancel

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
public boolean cancel() {
    ExtentTraverser traverser = new ExtentTraverser(this.extent);
    NullExtent nullExtent = new NullExtent(world, BBC.WORLDEDIT_CANCEL_REASON_MANUAL);
    while (traverser != null) {
        ExtentTraverser next = traverser.next();
        Extent get = traverser.get();
        if (get instanceof AbstractDelegateExtent && !(get instanceof NullExtent)) {
            traverser.setNext(nullExtent);
        }
        traverser = next;
    }
    bypassHistory = nullExtent;
    this.extent = nullExtent;
    bypassAll = nullExtent;
    dequeue();
    queue.clear();
    return true;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:19,代码来源:EditSession.java

示例5: getBaseBlock

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
/**
 * Gets an {@link BaseBlock} from a {@link ArgumentStack}.
 *
 * @param context the context
 * @return a pattern
 * @throws ParameterException on error
 * @throws WorldEditException on error
 */
@BindingMatch(type = BaseBlock.class,
        behavior = BindingBehavior.CONSUMES,
        consumedCount = 1)
public BaseBlock getBaseBlock(ArgumentStack context) throws ParameterException, WorldEditException {
    Actor actor = context.getContext().getLocals().get(Actor.class);
    ParserContext parserContext = new ParserContext();
    parserContext.setActor(context.getContext().getLocals().get(Actor.class));
    if (actor instanceof Entity) {
        Extent extent = ((Entity) actor).getExtent();
        if (extent instanceof World) {
            parserContext.setWorld((World) extent);
        }
    }
    parserContext.setSession(worldEdit.getSessionManager().get(actor));
    try {
        return worldEdit.getBlockFactory().parseFromInput(context.next(), parserContext);
    } catch (NoMatchException e) {
        throw new ParameterException(e.getMessage(), e);
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:29,代码来源:WorldEditBinding.java

示例6: getMask

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
/**
 * Gets an {@link Mask} from a {@link ArgumentStack}.
 *
 * @param context the context
 * @return a pattern
 * @throws ParameterException on error
 * @throws WorldEditException on error
 */
@BindingMatch(type = Mask.class,
        behavior = BindingBehavior.CONSUMES,
        consumedCount = 1)
public Mask getMask(ArgumentStack context) throws ParameterException, WorldEditException {
    Actor actor = context.getContext().getLocals().get(Actor.class);
    ParserContext parserContext = new ParserContext();
    parserContext.setActor(context.getContext().getLocals().get(Actor.class));
    if (actor instanceof Entity) {
        Extent extent = ((Entity) actor).getExtent();
        if (extent instanceof World) {
            parserContext.setWorld((World) extent);
        }
    }
    parserContext.setSession(worldEdit.getSessionManager().get(actor));
    try {
        return worldEdit.getMaskFactory().parseFromInput(context.next(), parserContext);
    } catch (NoMatchException e) {
        throw new ParameterException(e.getMessage(), e);
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:29,代码来源:WorldEditBinding.java

示例7: getExtent

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
@BindingMatch(
        type = {Extent.class},
        behavior = BindingBehavior.PROVIDES
)
public Extent getExtent(ArgumentStack context) throws ParameterException {
    Extent extent = context.getContext().getLocals().get(EditSession.class);
    if (extent != null) return extent;
    extent = Request.request().getExtent();
    if (extent != null) return extent;
    Actor actor = context.getContext().getLocals().get(Actor.class);
    if (actor == null) throw new ParameterException("No player to get a session for");
    if (!(actor instanceof Player)) throw new ParameterException("Caller is not a player");
    LocalSession session = WorldEdit.getInstance().getSessionManager().get(actor);
    EditSession editSession = session.createEditSession((Player) actor);
    editSession.enableQueue();
    context.getContext().getLocals().put(EditSession.class, editSession);
    session.tellVersion(actor);
    return editSession;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:20,代码来源:FawePrimitiveBinding.java

示例8: build

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
/**
 * Build the operation.
 *
 * @return the operation
 */
public Operation build() {
    Extent extent = clipboard;
    if (!transform.isIdentity()) {
        extent = new BlockTransformExtent(extent, transform, targetWorldData.getBlockRegistry());
    }
    ForwardExtentCopy copy = new ForwardExtentCopy(extent, clipboard.getRegion(), clipboard.getOrigin(), targetExtent, to);
    copy.setTransform(transform);
    copy.setCopyEntities(!ignoreEntities);
    copy.setCopyBiomes((!ignoreBiomes) && (!(clipboard instanceof BlockArrayClipboard) || ((BlockArrayClipboard) clipboard).IMP.hasBiomes()));
    if (this.canApply != null) {
        copy.setFilterFunction(this.canApply);
    }
    if (targetExtent instanceof EditSession) {
        Mask sourceMask = ((EditSession) targetExtent).getSourceMask();
        if (sourceMask != null) {
            new MaskTraverser(sourceMask).reset(extent);
            copy.setSourceMask(sourceMask);
            ((EditSession) targetExtent).setSourceMask(null);
        }
    }
    if (ignoreAirBlocks) {
        copy.setSourceMask(new ExistingBlockMask(clipboard));
    }
    return copy;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:31,代码来源:PasteBuilder.java

示例9: create

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
public void create(UndoContext context, boolean undo) {
    if (queue != null) {
        perform(queue, undo);
    }
    if (!checkedQueue) {
        checkedQueue = true;
        Extent extent = context.getExtent();
        ExtentTraverser found = new ExtentTraverser(extent).find(HasFaweQueue.class);
        if (found != null) {
            perform(queue = ((HasFaweQueue) found.get()).getQueue(), undo);
        } else {
            Fawe.debug("FAWE does not support: " + extent + " for " + getClass() + " (bug Empire92)");
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:16,代码来源:MutableChunkChange.java

示例10: apply

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
@Override
public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException {
    patternExtent.setTarget(get);
    if (mask.test(get)) {
        return patternExtent.getAndResetTarget(extent, set, get);
    }
    return secondaryPattern.apply(extent, set, get);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:9,代码来源:MaskedPattern.java

示例11: BlockReplace

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
/**
 * Create a new instance.
 *
 * @param extent  an extent
 * @param pattern a pattern
 */
public BlockReplace(Extent extent, Pattern pattern) {
    checkNotNull(extent);
    checkNotNull(pattern);
    this.extent = extent;
    this.pattern = pattern;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:13,代码来源:BlockReplace.java

示例12: AverageColorPattern

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
public AverageColorPattern(Extent extent, int color, int complexity, boolean randomize) {
    super(extent);
    this.complexity = complexity;
    this.randomize = randomize;
    this.util = Fawe.get().getCachedTextureUtil(randomize, 0, complexity);
    this.color = new Color(color).getRGB();
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:8,代码来源:AverageColorPattern.java

示例13: ExtentEntityCopy

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
/**
 * Create a new instance.
 *
 * @param from        the from position
 * @param destination the destination {@code Extent}
 * @param to          the destination position
 * @param transform   the transformation to apply to both position and orientation
 */
public ExtentEntityCopy(Vector from, Extent destination, Vector to, Transform transform) {
    checkNotNull(from);
    checkNotNull(destination);
    checkNotNull(to);
    checkNotNull(transform);
    this.destination = destination;
    this.from = from;
    this.to = to;
    this.transform = transform;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:19,代码来源:ExtentEntityCopy.java

示例14: light

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
@Command(
        aliases = {"#nolight"},
        desc = "Restrict to blocks without light (sky or emitted)"
)
public Mask nolight(Extent extent) {
    return new LightMask(extent, 0, 0);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:8,代码来源:MaskCommands.java

示例15: OreGen

import com.sk89q.worldedit.extent.Extent; //导入依赖的package包/类
public OreGen(Extent extent, Mask mask, Pattern pattern, int size, int minY, int maxY) {
    this.maxSize = size;
    this.maxSizeO8 = size * ONE_8;
    this.maxSizeO16 = size * ONE_16;
    this.sizeInverse = 1.0 / size;
    this.minY = minY;
    this.maxY = maxY;
    this.mask = mask;
    this.pattern = pattern;
    this.extent = extent;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:12,代码来源:OreGen.java


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