本文整理匯總了Java中com.flowpowered.math.vector.Vector3i.from方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector3i.from方法的具體用法?Java Vector3i.from怎麽用?Java Vector3i.from使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.flowpowered.math.vector.Vector3i
的用法示例。
在下文中一共展示了Vector3i.from方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPlayerChunkPosition
import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
public static Vector3i getPlayerChunkPosition(UUID playerUUID)
{
Path playerFile = Paths.get(EagleFactions.getEagleFactions ().getConfigDir().resolve("players") + "/" + playerUUID.toString() + ".conf");
try
{
ConfigurationLoader<CommentedConfigurationNode> configLoader = HoconConfigurationLoader.builder().setPath(playerFile).build();
CommentedConfigurationNode playerNode = configLoader.load();
ConfigurationNode chunkPositionNode = playerNode.getNode("chunkPosition");
if(chunkPositionNode.getValue() != null)
{
String object = chunkPositionNode.getString();
String vectors[] = object.replace("(", "").replace(")", "").replace(" ", "").split(",");
int x = Integer.valueOf(vectors[0]);
int y = Integer.valueOf(vectors[1]);
int z = Integer.valueOf(vectors[2]);
Vector3i chunk = Vector3i.from(x, y, z);
return chunk;
}
else
{
return new Vector3i(0,0,0);
}
}
catch (Exception exception)
{
exception.printStackTrace();
}
return null;
}
示例2: 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;
}
示例3: getHome
import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
public static Vector3i getHome(String factionName)
{
ConfigurationNode homeNode = ConfigAccess.getConfig(factionsConfig).getNode("factions", factionName, "home");
if(homeNode.getValue() != null)
{
String homeString = homeNode.getString();
String splitter = "\\|";
// String worldUUID = homeString.split(splitter)[0];
String vectorsString = homeString.split(splitter)[1];
String vectors[] = vectorsString.replace("(", "").replace(")", "").replace(" ", "").split(",");
int x = Integer.valueOf(vectors[0]);
int y = Integer.valueOf(vectors[1]);
int z = Integer.valueOf(vectors[2]);
Vector3i home = Vector3i.from(x, y, z);
return home;
}
else
{
return null;
}
}
示例4: parseVector3i
import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
public static Vector3i parseVector3i(JsonArray vector) {
Preconditions.checkNotNull(vector, "vector");
if (vector.size() != 3) throw new IllegalStateException();
int x = vector.get(0).getAsInt();
int y = vector.get(1).getAsInt();
int z = vector.get(2).getAsInt();
return Vector3i.from(x, y, z);
}
示例5: getPrimaryPosition
import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
@Override
public Vector3i getPrimaryPosition() {
try {
Vector vector = this.selector.getPrimaryPosition();
return Vector3i.from(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
} catch (IncompleteRegionException e) {
return this.getMinimumPoint();
}
}
示例6: deserialize
import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
@Override
public Vector3i deserialize(TypeToken<?> type, ConfigurationNode node) throws ObjectMappingException {
List<Integer> positions = node.getList(TypeToken.of(Integer.class));
if (positions.size() != 3) {
throw new ObjectMappingException();
}
return Vector3i.from(positions.get(0), positions.get(1), positions.get(2));
}
示例7: getMinimumPoint
import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
@Override
public Vector3i getMinimumPoint() {
Vector min = this.region.getMinimumPoint();
return Vector3i.from(min.getBlockX(), min.getBlockY(), min.getBlockZ());
}
示例8: getMaximumPoint
import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
@Override
public Vector3i getMaximumPoint() {
Vector max = this.region.getMaximumPoint();
return Vector3i.from(max.getBlockX(), max.getBlockY(), max.getBlockZ());
}
示例9: getCenter
import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
@Override
public Vector3i getCenter() {
Vector center = this.region.getCenter();
return Vector3i.from(center.getBlockX(), center.getBlockY(), center.getBlockZ());
}
示例10: getSecondaryPosition
import com.flowpowered.math.vector.Vector3i; //導入方法依賴的package包/類
@Override
public Vector3i getSecondaryPosition() {
Vector vector = ((CuboidRegion) this.region).getPos2();
return Vector3i.from(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
}