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


Java Vector3i.getX方法代碼示例

本文整理匯總了Java中com.flowpowered.math.vector.Vector3i.getX方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector3i.getX方法的具體用法?Java Vector3i.getX怎麽用?Java Vector3i.getX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.flowpowered.math.vector.Vector3i的用法示例。


在下文中一共展示了Vector3i.getX方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setBlockState

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
public static boolean setBlockState(Player player, Vector3i position, BlockState state) {
    int chunkX = position.getX() >> 4;
    int chunkZ = position.getZ() >> 4;

    Optional<Chunk> chunkOptional = player.getLevel().getChunkIfLoaded(chunkX, chunkZ);
    if (!chunkOptional.isPresent()) {
        // Chunk not loaded, danger ahead!
        return false;
    }

    Block old = chunkOptional.get().getBlock(position.getX() & 0x0f, position.getY(), position.getZ() & 0x0f);
    if (!canProceed(old, state, player)) {
        return false;
    }
    chunkOptional.get().setBlock(position.getX() & 0x0f, position.getY(), position.getZ() & 0x0f, state);
    ((VoxelwindLevel) player.getLevel()).broadcastBlockUpdate(position);
    return true;
}
 
開發者ID:voxelwind,項目名稱:voxelwind,代碼行數:19,代碼來源:BehaviorUtils.java

示例2: getAxisValue

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
public static int getAxisValue(EnumFacing.Axis axis, Vector3i vector) {
    switch (axis) {
        case X:
            return vector.getX();
        case Y:
            return vector.getY();
        case Z:
            return vector.getZ();
        default:
            throw new AssertionError("the hell is the " + axis + " axis? I exist in the 3d plane alone!");
    }
}
 
開發者ID:kenzierocks,項目名稱:HardVox,代碼行數:13,代碼來源:VecBridge.java

示例3: isClaimConnected

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
public static boolean isClaimConnected(String factionName, UUID worldUUID, Vector3i chunk)
{
    List<String> claimsList = getClaims(factionName);

    for (String object: claimsList)
    {
        if(object.contains(worldUUID.toString()))
        {
            String vectors[] = object.replace(worldUUID.toString() + "|", "").replace("(", "").replace(")", "").replace(" ", "").split(",");

            int x = Integer.valueOf(vectors[0]);
            int y = Integer.valueOf(vectors[1]);
            int z = Integer.valueOf(vectors[2]);

            Vector3i claim = Vector3i.from(x, y, z);

            if((claim.getX() == chunk.getX()) && ((claim.getZ() + 1 == chunk.getZ()) || (claim.getZ() - 1 == chunk.getZ())))
            {
                return true;
            }
            else if((claim.getZ() == chunk.getZ()) && ((claim.getX() + 1 == chunk.getX()) || (claim.getX() - 1 == chunk.getX())))
            {
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:Aquerr,項目名稱:EagleFactions,代碼行數:29,代碼來源:FactionLogic.java

示例4: getFirstPoint

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
public static Point getFirstPoint(UUID uuid)
{
	if (ConfigHandler.getNode("others", "enableGoldenAxe").getBoolean(true))
	{
		return firstPoints.get(uuid);
	}
	Optional<Player> player = Sponge.getServer().getPlayer(uuid);
	if (!player.isPresent())
	{
		return null;
	}
	Vector3i chunk = player.get().getLocation().getChunkPosition();
	return new Point(player.get().getWorld(), chunk.getX() * 16, chunk.getZ() * 16);
}
 
開發者ID:Arckenver,項目名稱:Nations,代碼行數:15,代碼來源:DataHandler.java

示例5: getSecondPoint

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
public static Point getSecondPoint(UUID uuid)
{
	if (ConfigHandler.getNode("others", "enableGoldenAxe").getBoolean(true))
	{
		return secondPoints.get(uuid);
	}
	Optional<Player> player = Sponge.getServer().getPlayer(uuid);
	if (!player.isPresent())
	{
		return null;
	}
	Vector3i chunk = player.get().getLocation().getChunkPosition();
	return new Point(player.get().getWorld(), chunk.getX() * 16 + 15, chunk.getZ() * 16 + 15);
}
 
開發者ID:Arckenver,項目名稱:Nations,代碼行數:15,代碼來源:DataHandler.java

示例6: Vector3iView

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
public Vector3iView(Vector3i value) {
    super(value);

    this.x = value.getX();
    this.y = value.getY();
    this.z = value.getZ();
}
 
開發者ID:Valandur,項目名稱:Web-API,代碼行數:8,代碼來源:Vector3iView.java

示例7: processBlock

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
@Override
protected void processBlock(World world, Vector3i pos) {
    int x = pos.getX() - min.getX();
    int y = pos.getY() - min.getY();
    int z = pos.getZ() - min.getZ();
    blockStates[x][y][z] = world.getBlock(pos).copy();
}
 
開發者ID:Valandur,項目名稱:Web-API,代碼行數:8,代碼來源:BlockGetOperation.java

示例8: isOnGround

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
default boolean isOnGround() {
    Vector3i blockPosition = getPosition().sub(0f, 0.1f, 0f).toInt();

    if (blockPosition.getY() < 0) {
        return false;
    }

    int chunkX = blockPosition.getX() >> 4;
    int chunkZ = blockPosition.getZ() >> 4;
    int chunkInX = blockPosition.getX() & 0x0f;
    int chunkInZ = blockPosition.getZ() & 0x0f;

    Optional<Chunk> chunkOptional = getLevel().getChunkIfLoaded(chunkX, chunkZ);
    return chunkOptional.isPresent() && chunkOptional.get().getBlock(chunkInX, blockPosition.getY(), chunkInZ).getBlockState().getBlockType() != BlockTypes.AIR;
}
 
開發者ID:voxelwind,項目名稱:voxelwind,代碼行數:16,代碼來源:Entity.java

示例9: updateProgress

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
private void updateProgress(Vector3i pipePos, Direction dest, boolean toCenter) {
    Vector3d target = pipePos.toDouble().add(0.5, 0.3, 0.5);
    if (!toCenter) {
        target = target.add(dest.asOffset().mul(0.5));
    }

    double dist;
    if (dest == Direction.WEST) {// (-1, 0, 0)
        dist = this.pos.getX() - pipePos.getX();
    } else if (dest == Direction.EAST) {// (1, 0, 0)
        dist = (pipePos.getX() + 1) - this.pos.getX();
    } else if (dest == Direction.NORTH) {// (0, 0, -1
        dist = this.pos.getZ() - pipePos.getZ();
    } else if (dest == Direction.SOUTH) {// (0, 0, 1)
        dist = (pipePos.getZ() + 1) - this.pos.getZ();
    } else if (dest == Direction.UP) {// (0, 1, 0)
        dist = (pipePos.getY() + 0.8) - this.pos.getY();
    } else if (dest == Direction.DOWN) {// (0, -1, 0)
        dist = (this.pos.getY() + 0.3) - pipePos.getY();
    } else {
        return;
    }
    if (toCenter) {
        dist -= 0.5;
    }
    if (dist <= 0) { // On or past the target
        this.pos = target;
        this.itemStand.setLocation(this.itemStand.getLocation().setPosition(target));
        this.finish = true;
    } else {
        this.finish = false;
    }
}
 
開發者ID:simon816,項目名稱:Industrialization,代碼行數:34,代碼來源:ItemStackHolder.java

示例10: toChunk

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
public static Vector3i toChunk(Vector3i v) {
    // NOT EQUAL TO DIVIDING BY 16!
    return new Vector3i(v.getX() >> 4, v.getY() >> 4, v.getZ() >> 4);
}
 
開發者ID:kenzierocks,項目名稱:HardVox,代碼行數:5,代碼來源:VecBridge.java

示例11: getArea

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
@Override
public int getArea() {
    Vector3i dim = getDimensions();
    return dim.getX() * dim.getY() * dim.getZ();
}
 
開發者ID:kenzierocks,項目名稱:HardVox,代碼行數:6,代碼來源:BoxRegion.java

示例12: open

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
@Override
public void open(Player player, Manager manager) {
    PlayerOpenCrateEvent open_event = new PlayerOpenCrateEvent(player, manager);
    Sponge.getEventManager().post(open_event);
    if (open_event.isCancelled()) return;
    Location<World> location = player.getLocation();
    Vector3i position = player.getLocation().getBlockPosition();
    World world = location.getExtent();
    int loc_x = position.getX();
    int loc_y = position.getY();
    int loc_z = position.getZ();
    HashMap<Location<World>, BlockState> original_block_states = new HashMap<Location<World>, BlockState>();
    for (int x = -2; x <= 2; x++) {
        for (int y = -1; y <= 3; y++) {
            for (int z = -2; z <= 2; z++) {
                Location loc = new Location<World>(
                        world, loc_x + x, loc_y + y, loc_z + z);
                BlockState loc_state = loc.getBlock();
                original_block_states.put(loc, loc_state);
                location.setBlockType(BlockTypes.AIR, BlockChangeFlags.NONE);
            }
        }
    }
    for (int x = -2; x <= 2; x++) {
        for (int z = -2; z <= 2; z++) {
            new Location<World>(world, loc_x + x, loc_y - 1, loc_z + z).
                    setBlockType(floor_block_type, BlockChangeFlags.NONE);
            if (z == 2 || z == -2 || x == 2 || x == -2) {
                new Location<World>(world, loc_x + x, loc_y , loc_z + z).
                        setBlockType(fence_block_type, BlockChangeFlags.NONE);
            }
        }
    }
    HashSet<HologramsService.Hologram> holograms = new HashSet<HologramsService.Hologram>();
    Location<World> loc1 = new Location<World>(world, loc_x + 2, loc_y, loc_z);
    loc1.setBlock(BlockState.builder().
                    blockType(crate_block_type).
                    add(Keys.DIRECTION, Direction.WEST).
                    build(),
            BlockChangeFlags.NONE);
    Location<World> loc2 = new Location<World>(world, loc_x - 2, loc_y, loc_z);
    loc2.setBlock(BlockState.builder().
                    blockType(crate_block_type).
                    add(Keys.DIRECTION, Direction.EAST).
                    build(),
            BlockChangeFlags.NONE);
    Location<World> loc3 = new Location<World>(world, loc_x, loc_y, loc_z + 2);
    loc3.setBlock(BlockState.builder().
                    blockType(crate_block_type).
                    add(Keys.DIRECTION, Direction.NORTH).
                    build(),
            BlockChangeFlags.NONE);
    Location<World> loc4 = new Location<World>(world, loc_x, loc_y, loc_z - 2);
    loc4.setBlock(BlockState.builder().
                    blockType(crate_block_type).
                    add(Keys.DIRECTION, Direction.SOUTH).
                    build(),
            BlockChangeFlags.NONE);
    Utils.tryCreateHologram(loc1, hologram).ifPresent(holograms::add);
    Utils.tryCreateHologram(loc2, hologram).ifPresent(holograms::add);
    Utils.tryCreateHologram(loc3, hologram).ifPresent(holograms::add);
    Utils.tryCreateHologram(loc4, hologram).ifPresent(holograms::add);
    getOpenSound().ifPresent(sound -> player.playSound(sound, player.getLocation().getPosition(), 1.));
    PLAYERS_OPENING_ANIMATION1.put(player, new Information(this, manager,
            new HashMap<Location<World>, Boolean>(){{
                put(loc1, false);
                put(loc2, false);
                put(loc3, false);
                put(loc4, false);
            }}, original_block_states, holograms));
}
 
開發者ID:GreWeMa,項目名稱:gwm_Crates,代碼行數:72,代碼來源:Animation1OpenManager.java

示例13: Coordinate

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
public Coordinate(Vector3i point) {
	this.x = point.getX();
	this.z = point.getZ();
}
 
開發者ID:DevOnTheRocks,項目名稱:StickyChunk,代碼行數:5,代碼來源:Coordinate.java

示例14: contains

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
@Override
public boolean contains(Vector3i pos) {
    return (pos.getX() >= min.getX() && pos.getX() <= max.getX() &&
            pos.getY() >= min.getY() && pos.getY() <= max.getY() &&
            pos.getZ() >= min.getZ() && pos.getZ() <= max.getZ());
}
 
開發者ID:prism,項目名稱:SafeGuard,代碼行數:7,代碼來源:CuboidVolume.java

示例15: isValid

import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
private boolean isValid(Vector3i a, Vector3i b) {
    return a.getX() != b.getX() &&
            a.getY() != b.getY() &&
            a.getZ() != b.getZ();
}
 
開發者ID:Zerthick,項目名稱:PlayerShopsRPG,代碼行數:6,代碼來源:CuboidRegionBuffer.java


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