当前位置: 首页>>代码示例>>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;未经允许,请勿转载。