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


Java Vector2i.getX方法代码示例

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


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

示例1: isInside

import com.flowpowered.math.vector.Vector2i; //导入方法依赖的package包/类
public boolean isInside(Location<World> loc)
{
	Rect extr = extrema.get(loc.getExtent().getUniqueId());
	Vector2i p = new Vector2i(loc.getBlockX(), loc.getBlockZ());
	if (p.getX() < extr.getMinX() || p.getX() > extr.getMaxX() || p.getY() < extr.getMinY() || p.getY() > extr.getMaxY())
	{
		return false;
	}
	for (Rect r : rects)
	{
		if (r.isInside(p))
		{
			return true;
		}
	}
	return false;
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:18,代码来源:Region.java

示例2: unforce

import com.flowpowered.math.vector.Vector2i; //导入方法依赖的package包/类
/**
 * Unforces the specified chunk coordinates for a specific ticket.
 * 
 * @param ticket the ticket
 * @param coords the coordinates
 */
void unforce(LanternLoadingTicket ticket, Vector2i coords, @Nullable CauseStack causeStack) {
    if (unlockInternally(coords, ticket)) {
        final LanternChunk chunk = getChunk(coords, false);
        // Try to cancel any queued chunk loadings
        if (chunk != null && chunk.lock.isLocked() && chunk.lockState == LanternChunk.LockState.LOADING) {
            final LanternChunkQueueTask task = this.chunkQueueTasks.get(coords);
            if (task != null && task.runnable instanceof LanternChunkLoadTask) {
                task.cancel();
            }
        // Queue the chunk for unload, will be some ticks later
        } else {
            final UnloadingChunkEntry entry = new UnloadingChunkEntry(coords);
            if (!this.pendingForUnload.contains(entry)) {
                this.pendingForUnload.offer(entry);
            }
        }
    }
    if (causeStack != null) {
        final Vector3i coords0 = new Vector3i(coords.getX(), 0, coords.getY());
        Sponge.getEventManager().post(SpongeEventFactory.createUnforcedChunkEvent(causeStack.getCurrentCause(), coords0, ticket));
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:29,代码来源:LanternChunkManager.java

示例3: updateOnTick

import com.flowpowered.math.vector.Vector2i; //导入方法依赖的package包/类
@Override
public void updateOnTick(float delta) {
    // For test entities, we can assume there's no other windows for now.
    DisplayLayer layer = DisplayLayer.CREATED.values().iterator().next();
    Vector2i size = DrawableUtils.getWindowSize(layer);
    if (this.pos.x > size.getX() || this.pos.x < 0) {
        setXPos(!(this.pos.x > size.getX()) ? size.getX() : 0);
    }
    if (this.pos.y > size.getY() || this.pos.y < 0) {
        setYPos(!(this.pos.y > size.getY()) ? size.getY() : 0);
    }
    if (Math.sqrt(this.vel.y * this.vel.y + this.vel.x * this.vel.x) < 0.5) {
        setTex(BetterArrays.randomArray(TestEntity.texmix)[0]);
    }
    super.updateOnTick(delta);
    doRandomVelocityChange();
    setYaw(getYaw() + 1);
}
 
开发者ID:TechShroom,项目名称:EmergencyLanding,代码行数:19,代码来源:TestEntity.java

示例4: slot

import com.flowpowered.math.vector.Vector2i; //导入方法依赖的package包/类
@Builder(
        builderMethodName = "slotBuilder",
        builderClassName = "SimpleCustomInventoryDefinitionBuilderSlotBuilder"
)
public SimpleCustomInventoryDefinitionBuilder slot(String slotId, Vector2i position, boolean persistent, AffectCustomSlotListener affectCustomSlotListener, @NonNull GUIFeature defaultFeature, GUIFeature... additionalFeatures) {
    Preconditions.checkNotNull(highPrioritySlots, "The height must be set first.");

    highPrioritySlots[position.getY()][position.getX()] =
            CustomSlotDefinition.create(position, slotId, persistent, affectCustomSlotListener, defaultFeature, Arrays.asList(additionalFeatures));

    return this;
}
 
开发者ID:Limeth,项目名称:CustomItemLibrary,代码行数:13,代码来源:SimpleCustomInventoryDefinitionBuilder.java

示例5: emptySlot

import com.flowpowered.math.vector.Vector2i; //导入方法依赖的package包/类
@Builder(
        builderMethodName = "emptySlotBuilder",
        builderClassName = "SimpleCustomInventoryDefinitionBuilderEmptySlotBuilder"
)
public SimpleCustomInventoryDefinitionBuilder emptySlot(String slotId, Vector2i position, boolean persistent, AffectCustomSlotListener affectCustomSlotListener) {
    highPrioritySlots[position.getY()][position.getX()] =
            CustomSlotDefinition.createEmpty(position, slotId, persistent, affectCustomSlotListener != null ? affectCustomSlotListener
                    : (customSlot, slotTransaction, affectSlotEvent) -> {});

    return this;
}
 
开发者ID:Limeth,项目名称:CustomItemLibrary,代码行数:12,代码来源:SimpleCustomInventoryDefinitionBuilder.java

示例6: getForced

import com.flowpowered.math.vector.Vector2i; //导入方法依赖的package包/类
/**
 * Gets a map with all the forced chunk and the assigned tickets.
 * 
 * @return the tickets
 */
public ImmutableSetMultimap<Vector3i, LoadingTicket> getForced() {
    final ImmutableSetMultimap.Builder<Vector3i, LoadingTicket> builder =
            ImmutableSetMultimap.builder();
    for (Entry<Vector2i, Set<ChunkLoadingTicket>> en : this.ticketsByPos.entrySet()) {
        final Vector2i pos0 = en.getKey();
        final Vector3i pos = new Vector3i(pos0.getX(), 0, pos0.getY());
        for (ChunkLoadingTicket ticket : en.getValue()) {
            builder.put(pos, ticket);
        }
    }
    return builder.build();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:18,代码来源:LanternChunkManager.java

示例7: force

import com.flowpowered.math.vector.Vector2i; //导入方法依赖的package包/类
/**
 * Forces the specified chunk coordinates for a specific ticket.
 * 
 * @param ticket the ticket
 * @param coords the coordinates
 * @param callEvents whether the force chunk events should be called
 */
void force(LanternLoadingTicket ticket, Vector2i coords, boolean callEvents) {
    final LanternChunk chunk = getChunk(coords, false);
    // The chunk at this coords is already loaded,
    // wa can call the event directly
    lockInternally(coords, ticket);
    // Remove from unload through loadChunk
    this.pendingForUnload.removeIf(e -> e.coords.equals(coords));
    // Whether the chunk should be queued for loading
    boolean queueLoad = false;
    if (chunk != null) {
        if (chunk.lock.isLocked() && chunk.lockState == LanternChunk.LockState.UNLOADING) {
            queueLoad = true;
        }
    // Queue the chunk to load
    } else {
        queueLoad = true;
    }
    if (queueLoad) {
        LanternChunkQueueTask task = this.chunkQueueTasks.get(coords);
        if (task == null || !(task.runnable instanceof LanternChunkLoadTask)) {
            this.chunkQueueTasks.computeIfAbsent(coords, coords1 ->
                    queueTask(coords1, new LanternChunkLoadTask(coords1)));
        }
    }
    if  (callEvents) {
        final Vector3i coords0 = new Vector3i(coords.getX(), 0, coords.getY());
        final CauseStack causeStack = CauseStack.currentOrNull();
        if (causeStack != null) {
            postForcedChunkEvent(causeStack, ticket, coords0);
        } else {
            Lantern.getScheduler().callSync(() -> postForcedChunkEvent(CauseStack.current(), ticket, coords0));
        }
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:42,代码来源:LanternChunkManager.java

示例8: chopBuffer

import com.flowpowered.math.vector.Vector2i; //导入方法依赖的package包/类
/**
 * Chops a buffer to the specified width, height, and possibly an extra
 * dimension.
 * 
 * The returned buffer is rewinded.
 * 
 * @param buf
 *            - the buffer to shrink
 * @param oldWidthHeight
 *            - the old width and height (should multiply with
 *            extraDimensions to equal buf.capacity())
 * @param choppedWidth
 *            - the new (smaller) width
 * @param choppedHeight
 *            - the new (smaller) height
 * @param extraDimensions
 *            - any extra dimensions, like bytes of color that should be
 *            kept together. Should be 1 if there is none.
 * @return the chopped buffer
 */
public static ByteBuffer
        chopBuffer(ByteBuffer buf, Vector2i oldWidthHeight, int choppedWidth, int choppedHeight, int extraDimensions) {
    if (buf.capacity() < choppedWidth * choppedHeight * extraDimensions || oldWidthHeight.getX() < choppedHeight
            || oldWidthHeight.getY() < choppedWidth || extraDimensions < 1) {
        throw new IndexOutOfBoundsException("One of the dimensions is breaking the bounds of the buffer!");
    }
    if (buf.capacity() > buf.remaining()) {
        buf.rewind();
    }
    ByteBuffer newBuf = ByteBuffer.allocateDirect(choppedWidth * choppedHeight * extraDimensions);
    byte[][][] arrayOfStuff = new byte[choppedWidth][choppedHeight][extraDimensions];
    for (int i = 0; i < oldWidthHeight.getX() * oldWidthHeight.getY() * extraDimensions; i += extraDimensions) {
        int x = i / extraDimensions / oldWidthHeight.getX();
        int y = i / extraDimensions % oldWidthHeight.getY();
        LUtils.print("x/y=" + String.format("%s/%s", x, y));
        if (x >= choppedWidth || y >= choppedHeight) {
            continue;
        }
        for (int extra = 0; extra < extraDimensions; extra++) {
            arrayOfStuff[x][y][extra] = buf.get(i + extra);
        }
    }
    for (byte[][] b2d : arrayOfStuff) {
        for (byte[] b1d : b2d) {
            for (byte b : b1d) {
                newBuf.put(b);
            }
        }
    }
    newBuf.rewind();
    return newBuf;
}
 
开发者ID:TechShroom,项目名称:EmergencyLanding,代码行数:53,代码来源:DrawableUtils.java

示例9: Rect

import com.flowpowered.math.vector.Vector2i; //导入方法依赖的package包/类
public Rect(UUID world, Vector2i point)
{
	this(world, point.getX(), point.getX(), point.getY(), point.getY());
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:5,代码来源:Rect.java

示例10: isInside

import com.flowpowered.math.vector.Vector2i; //导入方法依赖的package包/类
public boolean isInside(Vector2i point)
{
	return minX <= point.getX() && point.getX() <= maxX && minY <= point.getY() && point.getY() <= maxY;
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:5,代码来源:Rect.java

示例11: isAdjacent

import com.flowpowered.math.vector.Vector2i; //导入方法依赖的package包/类
public boolean isAdjacent(Vector2i point)
{
	return this.minX - 1 <= point.getX() && point.getX() <= this.maxX + 1 && this.minY - 1 <= point.getY() && point.getY() <= this.maxY + 1;
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:5,代码来源:Rect.java

示例12: inBounds

import com.flowpowered.math.vector.Vector2i; //导入方法依赖的package包/类
public static boolean inBounds(int x, int y, Vector2i min, Vector2i max) {
    return x >= min.getX() && x <= max.getX() && y >= min.getY() && y <= max.getY();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:VecHelper.java


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