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


Java Location.getZ方法代码示例

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


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

示例1: getInsertClanQuery

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public static PreparedStatement getInsertClanQuery(ClanImpl clan) {
        int clanID = clan.getID();
        String tag = clan.getTag();
        String name = clan.getName();
        int ownerID = clan.getOwner().getID();
        String tagColorId = clan.getTagColor().getId();
        boolean allowAllyInvites = clan.isAllowingAllyInvites();
        boolean ffProtection = clan.isFfProtected();
        long creationTime = clan.getCreationDate().getTime();
        Location<World> clanHome = clan.getHome();
        String clanHomeWorld = null;
        double clanHomeX = 0;
        double clanHomeY = 0;
        double clanHomeZ = 0;
        float clanHomeYaw = 0;
        float clanHomePitch = 0;
        if (clanHome != null) {
            clanHomeWorld = clanHome.getExtent().getUniqueId().toString();
            clanHomeX = clanHome.getX();
            clanHomeY = clanHome.getY();
            clanHomeZ = clanHome.getZ();
            // TODO SPONGE vector3d or something
//            clanHomeYaw = clanHome.getYaw();
//            clanHomePitch = clanHome.getPitch();
        }
        int homeSetTimes = clan.getHomeSetTimes();
        long homeLastSetTimeStamp = clan.getHomeSetTimeStamp();
        String bankId = clan.getBankId();

        return QueryGenerator.createInsertQuery("mcc_clans", databaseConnectionOwner.getConnection()).value("clan_id", clanID).value("clantag", tag)
                .value("clanname", name).value("clanplayer_id_owner", ownerID).value("tagcolor", tagColorId)
                .value("allow_ally_invites", allowAllyInvites).value("clanhome_world", clanHomeWorld).value("clanhome_x", clanHomeX)
                .value("clanhome_y", clanHomeY).value("clanhome_z", clanHomeZ).value("clanhome_yaw", clanHomeYaw)
                .value("clanhome_pitch", clanHomePitch).value("clanhome_set_times", homeSetTimes)
                .value("clanhome_set_timestamp", homeLastSetTimeStamp).value("ff_protection", ffProtection).value("creation_time", creationTime)
                .value("bank_id", bankId).create();
    }
 
开发者ID:iLefty,项目名称:mcClans,代码行数:38,代码来源:DatabaseSaver.java

示例2: getUpdateClanQuery

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public static PreparedStatement getUpdateClanQuery(ClanImpl clan) {
        int clanID = clan.getID();
        String tag = clan.getTag();
        String name = clan.getName();
        int ownerID = clan.getOwner().getID();
        String tagColorId = clan.getTagColor().getId();
        boolean allowAllyInvites = clan.isAllowingAllyInvites();
        boolean ffProtection = clan.isFfProtected();
        long creationTime = clan.getCreationDate().getTime();
        Location<World> clanHome = clan.getHome();
        String clanHomeWorld = null;
        double clanHomeX = 0;
        double clanHomeY = 0;
        double clanHomeZ = 0;
        float clanHomeYaw = 0;
        float clanHomePitch = 0;
        if (clanHome != null) {
            clanHomeWorld = clanHome.getExtent().getUniqueId().toString();
            clanHomeX = clanHome.getX();
            clanHomeY = clanHome.getY();
            clanHomeZ = clanHome.getZ();
            // TODO SPONGE vector3d or something
//            clanHomeYaw = clanHome.getYaw();
//            clanHomePitch = clanHome.getPitch();
        }
        int homeSetTimes = clan.getHomeSetTimes();
        long homeLastSetTimeStamp = clan.getHomeSetTimeStamp();
        String bankId = clan.getBankId();

        return QueryGenerator.createUpdateQuery("mcc_clans", databaseConnectionOwner.getConnection()).value("clantag", tag).value("clanname", name)
                .value("clanplayer_id_owner", ownerID).value("tagcolor", tagColorId)
                .value("allow_ally_invites", allowAllyInvites)
                .value("clanhome_world", clanHomeWorld).value("clanhome_x", clanHomeX).value("clanhome_y", clanHomeY).value("clanhome_z", clanHomeZ)
                .value("clanhome_yaw", clanHomeYaw).value("clanhome_pitch", clanHomePitch).value("clanhome_set_times", homeSetTimes)
                .value("clanhome_set_timestamp", homeLastSetTimeStamp).value("ff_protection", ffProtection).value("creation_time", creationTime)
                .value("bank_id", bankId).where("clan_id", clanID).create();
    }
 
开发者ID:iLefty,项目名称:mcClans,代码行数:38,代码来源:DatabaseSaver.java

示例3: getLoc

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
@Override
public Loc getLoc() {
	Location<World> location = this.player.getLocation();
	Vector3d rotation = this.player.getRotation();
	
	Loc loc = new Loc(this.player.getWorld().getUniqueId(), location.getX(), location.getY(), location.getZ(), (float) rotation.getY(), (float) rotation.getX());
	
	return loc;
}
 
开发者ID:redstone,项目名称:RCameraStudio,代码行数:10,代码来源:SpongeTraveller.java

示例4: doSomethingAround

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
private void doSomethingAround(Player user, World world,
        Location<org.spongepowered.api.world.World> loc,
        EffectCaller effect) {
    double baseX = loc.getX();
    double y = loc.getY();
    double baseZ = loc.getZ();
    for (int dx = -5; dx <= 5; dx++) {
        for (int dz = -5; dz <= 5; dz++) {
            effect.call((EntityPlayerMP) user, world, baseX + dx, y,
                    baseZ + dz);
        }
    }
}
 
开发者ID:kenzierocks,项目名称:Annointment,代码行数:14,代码来源:ARunEffects.java

示例5: from

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public static ClanPojo from(ClanImpl clan) {
        ClanPojo clanPojo = new ClanPojo();
        clanPojo.clanID = clan.getID();
        clanPojo.clanTag = clan.getTag();
        clanPojo.clanName = clan.getName();
        clanPojo.ownerID = clan.getOwner().getID();
        clanPojo.tagColorId = clan.getTagColor().getId();
        clanPojo.allowAllyInvites = clan.isAllowingAllyInvites();
        clanPojo.ffProtection = clan.isFfProtected();
        clanPojo.creationTime = clan.getCreationDate().getTime();

        Location<World> homeLocation = clan.getHome();

        String homeWorld = null;
        double homeX = 0;
        double homeY = 0;
        double homeZ = 0;
        float homeYaw = 0;
        float homePitch = 0;

        if (homeLocation != null) {
            homeWorld = homeLocation.getExtent().getUniqueId().toString();
            homeX = homeLocation.getX();
            homeY = homeLocation.getY();
            homeZ = homeLocation.getZ();
            // TODO SPONGE vector or something
//			homeYaw = homeLocation.getYaw();
//			homePitch = homeLocation.getPitch();
        }

        clanPojo.homeWorld = homeWorld;
        clanPojo.homeX = homeX;
        clanPojo.homeY = homeY;
        clanPojo.homeZ = homeZ;
        clanPojo.homeYaw = homeYaw;
        clanPojo.homePitch = homePitch;
        clanPojo.homeSetTimes = clan.getHomeSetTimes();
        clanPojo.homeSetTimeStamp = clan.getHomeSetTimeStamp();
        clanPojo.bankId = clan.getBankId();
        return clanPojo;
    }
 
开发者ID:iLefty,项目名称:mcClans,代码行数:42,代码来源:ClanPojo.java

示例6: locToString

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
private String locToString(Location<World> loc) {
    return loc.getExtent().getName() + "," + loc.getX() + "," + loc.getY() + "," + loc.getZ();
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:4,代码来源:SignsConfig.java

示例7: LocationTag

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public LocationTag(Location<World> location) {
    this(location.getX(), location.getY(), location.getZ(), location.getExtent());
}
 
开发者ID:DenizenScript,项目名称:Denizen2Sponge,代码行数:4,代码来源:LocationTag.java

示例8: LengthSquared

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public static double LengthSquared(Location<World> loc) {
    return loc.getX() * loc.getX() + loc.getY() * loc.getY() + loc.getZ() * loc.getZ();
}
 
开发者ID:DenizenScript,项目名称:Denizen2Sponge,代码行数:4,代码来源:LocationTag.java

示例9: locToString

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public static String locToString(Location<World> loc)
{
	return loc.getExtent().getName() + "|" + loc.getX() + "|" + loc.getY() + "|" + loc.getZ();
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:5,代码来源:Utils.java

示例10: of

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public static Location3D of(Location<World> location) {
    return new Location3D(location.getExtent().getName(), location.getX(), location.getY(), location.getZ());
}
 
开发者ID:caseif,项目名称:Inferno,代码行数:4,代码来源:WorldLocationConverter.java

示例11: getBlockPos

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
private static BlockPos getBlockPos(Location<World> location){
    return new BlockPos(location.getX(), location.getY(), location.getZ());
}
 
开发者ID:thomas15v,项目名称:NoXray,代码行数:4,代码来源:NMSUtil.java

示例12: plantTree

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
private void plantTree(ExplosionEvent.Pre event) {
    Location explosionLocation = event.getExplosion().getLocation();
    int x = (int) explosionLocation.getX();
    int y = (int) explosionLocation.getY();
    int z = (int) explosionLocation.getZ();

    //Evaluating the tree type, based on biome
    World world = event.getTargetWorld();
    BiomeType biome = world.getBiome(x, z);
    BiomeGenerationSettings biomeSettings = world.getWorldGenerator().getBiomeSettings(biome);
    List<Forest> forestPopulators = biomeSettings.getPopulators(Forest.class);

    PopulatorObject populator;
    try {
        //There may be multiple tree types in one Biome. Get one per weighted random
        populator = forestPopulators.isEmpty() ? fallbackTreePopulator : forestPopulators.get(0).getTypes().get(random).get(0);
    } catch (Exception e) {
        populator = fallbackTreePopulator;
    }

    //if the explosion happened on level 0, set it to 1, so we can place a dirt block below
    if (y == 0) {
        y = 1;
    }

    Vector3i pos = new Vector3i(x, y, z);
    Vector3i below = new Vector3i(x, y - 1, z);

    Cause genericCause = Cause.of(NamedCause.owner(container));


    //set Dirt block below if possible (Trees cannot be placed without)
    BlockState blockBelow = world.containsBlock(below) ? world.getBlock(below) : null;
    if (blockBelow != null) {
        BlockState blockState = BlockState.builder().blockType(BlockTypes.DIRT).build();

        world.setBlock(below, blockState, genericCause);
    }

    //Remove Grass, redstone, etc.
    BlockState blockOnPosition = world.getBlock(pos);

    Optional<PassableProperty> passableProperty_Op = blockOnPosition.getProperty(PassableProperty.class);
    boolean blockPassable = passableProperty_Op.isPresent() && passableProperty_Op.get().getValue();

    boolean passableBlockRemoved = false;
    if (blockPassable) {
        world.setBlock(pos, BlockState.builder().blockType(BlockTypes.AIR).build(), BlockChangeFlag.NEIGHBOR, genericCause);
        passableBlockRemoved = true;
    }

    boolean treePlaced = false;
    //is the tree placeable?
    if (populator.canPlaceAt(world, x, y, z)) {
        //Place the tree
        populator.placeObject(world, random, x, y, z);
        treePlaced = true;
    } else if (passableBlockRemoved) {
        //Reset passable Block
        world.setBlock(pos, blockOnPosition, genericCause);

    }

    //Replace block below with original Block (unless the tree was placed in mid-air or water)
    if (blockBelow != null && !(treePlaced && (blockBelow.getType() == BlockTypes.AIR ||
            blockBelow.getType() == BlockTypes.WATER ||
            blockBelow.getType() == BlockTypes.FLOWING_WATER))) {
        world.setBlock(below, blockBelow, genericCause);
    }
}
 
开发者ID:Felfio,项目名称:treepers-sponge,代码行数:71,代码来源:Treepers.java


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