本文整理汇总了Java中org.spongepowered.api.world.Location.getBlockX方法的典型用法代码示例。如果您正苦于以下问题:Java Location.getBlockX方法的具体用法?Java Location.getBlockX怎么用?Java Location.getBlockX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spongepowered.api.world.Location
的用法示例。
在下文中一共展示了Location.getBlockX方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isInside
import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public boolean isInside(Location<World> loc)
{
Rect extr = extrema.get(loc.getExtent().getUniqueId());
Vector2i p = new Vector2i(loc.getBlockX(), loc.getBlockZ());
if (p.getX() < extr.getMinX() || p.getX() > extr.getMaxX() || p.getY() < extr.getMinY() || p.getY() > extr.getMaxY())
{
return false;
}
for (Rect r : rects)
{
if (r.isInside(p))
{
return true;
}
}
return false;
}
示例2: onOpened
import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
@Listener
public void onOpened(PlayerOpenedCrateEvent event) {
Player player = event.getPlayer();
Manager manager = event.getManager();
Drop drop = event.getDrop();
if (manager.isSendOpenMessage()) {
Optional<String> optional_custom_open_message = manager.getCustomOpenMessage();
if (optional_custom_open_message.isPresent()) {
player.sendMessage(TextSerializers.FORMATTING_CODE.
deserialize(optional_custom_open_message.get().
replace("%MANAGER%", manager.getName())));
} else {
player.sendMessage(LanguageUtils.getText("SUCCESSFULLY_OPENED_MANAGER",
new Pair<String, String>("%MANAGER%", manager.getName())));
}
}
if (GWMCrates.getInstance().isLogOpenedCrates()) {
try {
String time = LocalTime.now().withNano(0).format(DateTimeFormatter.ISO_LOCAL_TIME);
String player_name = player.getName();
String player_uuid = player.getUniqueId().toString();
String manager_name = manager.getName();
String manager_id = manager.getId();
String drop_name = drop == null ? "null" : drop.getId().orElse("Unknown ID");
Location<World> location = player.getLocation();
String player_location = location.getExtent().getName() + ' ' + location.getBlockX() + ' ' + location.getBlockY() + ' ' + location.getBlockZ();
LOG_FILE_WRITER.write(LanguageUtils.getPhrase("CRATE_OPENING_LOG_MESSAGE",
new Pair("%TIME%", time),
new Pair("%PLAYER%", player_name),
new Pair("%PLAYER_UUID%", player_uuid),
new Pair("%MANAGER_NAME%", manager_name),
new Pair("%MANAGER_ID%", manager_id),
new Pair("%DROP%", drop_name),
new Pair("%LOCATION%", player_location)) + '\n');
LOG_FILE_WRITER.flush();
} catch (Exception e) {
GWMCrates.getInstance().getLogger().warn("Exception logging crate opening!", e);
}
}
}
示例3: isLocationChanged
import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public static boolean isLocationChanged(Transform<World> from, Transform<World> to, boolean y_sensitive) {
Location<World> location_from = from.getLocation();
Location<World> location_to = to.getLocation();
int x_from = location_from.getBlockX();
int y_from = location_from.getBlockY();
int z_from = location_from.getBlockZ();
int x_to = location_to.getBlockX();
int y_to = location_to.getBlockY();
int z_to = location_to.getBlockZ();
return x_from != x_to || z_from != z_to || (y_sensitive && y_from != y_to);
}
示例4: getZone
import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public Zone getZone(Location<World> loc)
{
Vector2i p = new Vector2i(loc.getBlockX(), loc.getBlockZ());
for (Zone zone : zones.values())
{
if (zone.getRect().isInside(p))
{
return zone;
}
}
return null;
}
示例5: isFor
import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public boolean isFor(Location<World> location) {
return this.location.getBlockX() == location.getBlockX() && this.location.getBlockY() == location.getBlockY() && this.location.getBlockZ() == location.getBlockZ();
}
示例6: Kit
import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public Kit(String name, Location<World> block) {
super(name, block.getExtent().getName(), block.getBlockX(), block.getBlockY(), block.getBlockZ(), 0, Collections.emptyList());
}
示例7: setLoc
import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public void setLoc(Location<World> loc) {
this.loc = new Location<World>(loc.getExtent(), loc.getBlockX()+0.5, loc.getY(), loc.getBlockZ()+0.5);
}
示例8: getLocationString
import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public static String getLocationString(Location<World> location) {
return "(" + location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ() + ")";
}