本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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();
}
示例7: LocationTag
import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public LocationTag(Location<World> location) {
this(location.getX(), location.getY(), location.getZ(), location.getExtent());
}
示例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();
}
示例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();
}
示例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());
}
示例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());
}
示例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);
}
}