當前位置: 首頁>>代碼示例>>Java>>正文


Java Pair類代碼示例

本文整理匯總了Java中uk.co.qmunity.lib.misc.Pair的典型用法代碼示例。如果您正苦於以下問題:Java Pair類的具體用法?Java Pair怎麽用?Java Pair使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Pair類屬於uk.co.qmunity.lib.misc包,在下文中一共展示了Pair類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isSideSticky

import uk.co.qmunity.lib.misc.Pair; //導入依賴的package包/類
@Override
@Priority(PriorityEnum.OVERRIDE)
public boolean isSideSticky(World world, int x, int y, int z, ForgeDirection side, IMovement movement) {

    Collection<IFrame> frames = FrameMovementRegistry.instance().findFrames(world, x, y, z);
    if (frames == null || frames.size() == 0)
        return false;

    Pair<Vec3i, ForgeDirection> p = new Pair<Vec3i, ForgeDirection>(new Vec3i(x, y, z, world), side);
    ignored.add(p);

    for (IFrame f : frames) {
        if (FramezUtils.hasModifier(f.getSideModifiers(side), FrameSideModifierLatching.this)) {
            Pair<List<MovingBlock>, List<Vec3i>> pair = MovementHelper.findMovedBlocks(world, x, y, z, side, movement,
                    Arrays.asList(new Vec3i(x, y, z, world)));
            if (pair != null && pair.getValue().size() > 0) {
                ignored.remove(p);
                return false;
            }
        }
    }

    ignored.remove(p);

    return true;
}
 
開發者ID:amadornes,項目名稱:Framez,代碼行數:27,代碼來源:FrameSideModifierLatching.java

示例2: canHandle

import uk.co.qmunity.lib.misc.Pair; //導入依賴的package包/類
@Override
public boolean canHandle(World world, int x, int y, int z, ForgeDirection side) {

    for (Pair<Vec3i, ForgeDirection> p : ignored)
        if (p.getKey().getX() == x && p.getKey().getY() == y && p.getKey().getZ() == z && p.getKey().getWorld().equals(world)
                && p.getValue() == side)
            return false;

    Collection<IFrame> frames = FrameMovementRegistry.instance().findFrames(world, x, y, z);
    if (frames == null || frames.size() == 0)
        return false;

    for (IFrame f : frames)
        if (FramezUtils.hasModifier(f.getSideModifiers(side), FrameSideModifierLatching.this))
            return true;

    return false;
}
 
開發者ID:amadornes,項目名稱:Framez,代碼行數:19,代碼來源:FrameSideModifierLatching.java

示例3: collisionRayTrace

import uk.co.qmunity.lib.misc.Pair; //導入依賴的package包/類
@Override
public MovingObjectPosition collisionRayTrace(World w, int x, int y, int z, Vec3 start, Vec3 end) {

    TileMoving te = get(w, x, y, z);
    if (te == null)
        return null;

    MovingObjectPosition mop = te.rayTrace(new Vec3d(start), new Vec3d(end));
    if (mop != null)
        mop.hitInfo = ((Pair<?, ?>) mop.hitInfo).getValue();
    return mop;
}
 
開發者ID:amadornes,項目名稱:Framez,代碼行數:13,代碼來源:BlockMoving.java

示例4: renderBox

import uk.co.qmunity.lib.misc.Pair; //導入依賴的package包/類
public void renderBox(Vec3dCube cube, IIcon down, IIcon up, IIcon west, IIcon east, IIcon north, IIcon south) {

        if (cube.getMinX() < 0 || cube.getMinY() < 0 || cube.getMinZ() < 0 || cube.getMaxX() > 1 || cube.getMaxY() > 1
                || cube.getMaxZ() > 1) {
            if (renderingMethod == ExtensionRendering.SAME_TEXTURE) {
                LightingHelper h = lightingHelper;

                for (Pair<Pair<Vec3dCube, Translation>, boolean[]> data : cube.splitInto1x1()) {
                    sides = data.getValue();
                    Translation tr = data.getKey().getValue();

                    if (tr.getX() == 0 && tr.getY() == 0 && tr.getZ() == 0) {
                        lightingHelper = h;
                    } else {
                        Vec3d t = new Vec3d(tr.getX(), tr.getY(), tr.getZ()).transform(transformations);
                        lightingHelper = new LightingHelper(getWorld(),
                                new Vec3i((int) t.getX(), (int) t.getY(), (int) t.getZ()).add(getLocation()));
                    }

                    vertexTransformation = tr;
                    renderBox_do(data.getKey().getKey(), down, up, west, east, north, south);
                    vertexTransformation = null;
                }
                resetRenderedSides();

                lightingHelper = h;
            }
        } else {
            renderBox_do(cube, down, up, west, east, north, south);
        }
    }
 
開發者ID:Qmunity,項目名稱:QmunityLib,代碼行數:32,代碼來源:RenderHelper.java

示例5: rayTrace

import uk.co.qmunity.lib.misc.Pair; //導入依賴的package包/類
public MovingObjectPosition rayTrace(Vec3d start, Vec3d end) {

        MovingObjectPosition mopA = null;
        MovingObjectPosition mopB = null;

        Vec3d start2 = null;
        Vec3d end2 = null;

        if (blockA != null) {
            start2 = blockA
                    .getStructure()
                    .getMovement()
                    .transform(
                            start,
                            -(worldObj.isRemote ? blockA.getStructure().getInterpolatedProgress(
                                    Framez.proxy.getFrame() - (1 + (1 - Timing.SECONDS))) : blockA.getStructure().getProgress()));
            end2 = blockA
                    .getStructure()
                    .getMovement()
                    .transform(
                            end,
                            -(worldObj.isRemote ? blockA.getStructure().getInterpolatedProgress(
                                    Framez.proxy.getFrame() - (1 + (1 - Timing.SECONDS))) : blockA.getStructure().getProgress()));

            mopA = blockA.getBlock().collisionRayTrace(FakeWorld.getFakeWorld(blockA), blockA.getX(), blockA.getY(), blockA.getZ(),
                    start2.toVec3(), end2.toVec3());
            if (mopA != null)
                mopA.hitInfo = new Pair<MovingBlock, Object>(blockA, mopA.hitInfo);
        }

        if (blockB != null) {
            if (start2 == null) {
                start2 = blockB
                        .getStructure()
                        .getMovement()
                        .transform(
                                start,
                                -(worldObj.isRemote ? blockB.getStructure().getInterpolatedProgress(
                                        Framez.proxy.getFrame() - (1 + (1 - Timing.SECONDS))) : blockB.getStructure().getProgress()));
                end2 = blockB
                        .getStructure()
                        .getMovement()
                        .transform(
                                end,
                                -(worldObj.isRemote ? blockB.getStructure().getInterpolatedProgress(
                                        Framez.proxy.getFrame() - (1 + (1 - Timing.SECONDS))) : blockB.getStructure().getProgress()));
            }

            mopB = blockB.getBlock().collisionRayTrace(FakeWorld.getFakeWorld(blockB), blockB.getX(), blockB.getY(), blockB.getZ(),
                    start2.toVec3(), end2.toVec3());
            if (mopB != null) {
                mopB.hitInfo = new Pair<MovingBlock, Object>(blockB, mopB.hitInfo);
                Vec3i v = blockB.getStructure().getMovement().transform(new Vec3i(mopB.blockX, mopB.blockY, mopB.blockZ));
                mopB.blockX = v.getX();
                mopB.blockY = v.getY();
                mopB.blockZ = v.getZ();
            }
        }

        if (mopA == null && mopB == null)
            return null;
        if (mopA != null && mopB == null)
            return mopA;
        if (mopB != null && mopA == null)
            return mopB;

        if (mopA.hitVec.squareDistanceTo(start2.toVec3()) < mopB.hitVec.squareDistanceTo(start2.toVec3()))
            return mopA;
        return mopB;
    }
 
開發者ID:amadornes,項目名稱:Framez,代碼行數:71,代碼來源:TileMoving.java

示例6: findMovedBlocks

import uk.co.qmunity.lib.misc.Pair; //導入依賴的package包/類
public static Pair<List<MovingBlock>, List<Vec3i>> findMovedBlocks(World world, int x, int y, int z, ForgeDirection side,
        IMovement movement) {

    return findMovedBlocks(world, x, y, z, side, movement, new ArrayList<Vec3i>());
}
 
開發者ID:amadornes,項目名稱:Framez,代碼行數:6,代碼來源:MovementHelper.java

示例7: splitInto1x1

import uk.co.qmunity.lib.misc.Pair; //導入依賴的package包/類
public List<Pair<Pair<Vec3dCube, Translation>, boolean[]>> splitInto1x1() {

        List<Pair<Pair<Vec3dCube, Translation>, boolean[]>> cubes = new ArrayList<Pair<Pair<Vec3dCube, Translation>, boolean[]>>();

        int minx = (int) Math.floor(getMinX());
        int miny = (int) Math.floor(getMinY());
        int minz = (int) Math.floor(getMinZ());
        int maxx = (int) Math.ceil(getMaxX());
        int maxy = (int) Math.ceil(getMaxY());
        int maxz = (int) Math.ceil(getMaxZ());

        for (int x = minx; x < maxx; x++) {
            for (int y = miny; y < maxy; y++) {
                for (int z = minz; z < maxz; z++) {
                    Translation t = new Translation(x, y, z);
                    Vec3dCube cube = new Vec3dCube(0, 0, 0, 1, 1, 1);
                    boolean[] sides = new boolean[6];

                    if (x == minx) {
                        cube.getMin().setX(getMinX() - minx);
                        sides[4] = true;
                    }
                    if (y == miny) {
                        cube.getMin().setY(getMinY() - miny);
                        sides[0] = true;
                    }
                    if (z == minz) {
                        cube.getMin().setZ(getMinZ() - minz);
                        sides[2] = true;
                    }

                    if (x == maxx - 1) {
                        cube.getMax().setX(getMaxX() - (maxx - 1));
                        sides[5] = true;
                    }
                    if (y == maxy - 1) {
                        cube.getMax().setY(getMaxY() - (maxy - 1));
                        sides[1] = true;
                    }
                    if (z == maxz - 1) {
                        cube.getMax().setZ(getMaxZ() - (maxz - 1));
                        sides[3] = true;
                    }

                    cube.fix();

                    cubes.add(new Pair<Pair<Vec3dCube, Translation>, boolean[]>(new Pair<Vec3dCube, Translation>(cube, t), sides));
                }
            }
        }

        return cubes;
    }
 
開發者ID:Qmunity,項目名稱:QmunityLib,代碼行數:54,代碼來源:Vec3dCube.java


注:本文中的uk.co.qmunity.lib.misc.Pair類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。