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


Java Location.getBlockX方法代码示例

本文整理汇总了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;
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:18,代码来源:Region.java

示例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);
        }
    }
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:41,代码来源:DebugCrateListener.java

示例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);
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:12,代码来源:Utils.java

示例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;
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:13,代码来源:Nation.java

示例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();
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:4,代码来源:SignsConfig.java

示例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());
}
 
开发者ID:KaiKikuchi,项目名称:BetterKits,代码行数:4,代码来源:Kit.java

示例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);
}
 
开发者ID:DosMike,项目名称:VillagerShops,代码行数:4,代码来源:NPCguard.java

示例8: getLocationString

import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
public static String getLocationString(Location<World> location) {
    return "(" + location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ() + ")";
}
 
开发者ID:ichorpowered,项目名称:latch,代码行数:4,代码来源:LatchUtils.java


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