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


Java PlayerManager.isPlayerWatchingChunk方法代码示例

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


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

示例1: getPlayersWatchingChunk

import net.minecraft.server.management.PlayerManager; //导入方法依赖的package包/类
public static List<EntityPlayerMP> getPlayersWatchingChunk(World world, int chunkX, int chunkZ)
{
    if (world.isRemote || !(world instanceof WorldServer))
    {
        return Collections.emptyList();
    }

    ArrayList<EntityPlayerMP> playersWatching = new ArrayList<>();

    WorldServer server = (WorldServer) world;
    PlayerManager playerManager = server.getPlayerManager();

    List<EntityPlayerMP> players = server.playerEntities;
    for (EntityPlayerMP player : players)
    {
        if (playerManager.isPlayerWatchingChunk(player, chunkX, chunkZ))
        {
            playersWatching.add(player);
        }
    }

    return playersWatching;
}
 
开发者ID:Dennisbonke,项目名称:DBLibOld,代码行数:24,代码来源:IvNetworkHelperServer.java

示例2: sendToChunk

import net.minecraft.server.management.PlayerManager; //导入方法依赖的package包/类
public static void sendToChunk(Packet packet, World world, int chunkX, int chunkZ) {
    PlayerManager playerManager = ((WorldServer)world).getPlayerManager();
    for (EntityPlayerMP player : (List<EntityPlayerMP>) MinecraftServer.getServer().getConfigurationManager().playerEntityList)
        if(playerManager.isPlayerWatchingChunk(player, chunkX, chunkZ))
            sendToPlayer(packet, player);

    /* Commented until forge accepts access tranformer request
    PlayerInstance p = ((WorldServer) world).getPlayerManager().getOrCreateChunkWatcher(chunkX, chunkZ, false);
    if (p != null)
        p.sendToAllPlayersWatchingChunk(packet);*/
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:12,代码来源:PacketCustom.java

示例3: getPlayersWatchingChunk

import net.minecraft.server.management.PlayerManager; //导入方法依赖的package包/类
public static Set<EntityPlayerMP> getPlayersWatchingChunk(WorldServer world, int chunkX, int chunkZ) {
    PlayerManager manager = world.getPlayerManager();

    Set<EntityPlayerMP> playerList = Sets.newHashSet();
    for (Object o : world.playerEntities) {
        EntityPlayerMP player = (EntityPlayerMP)o;
        if (manager.isPlayerWatchingChunk(player, chunkX, chunkZ)) playerList.add(player);
    }
    return playerList;
}
 
开发者ID:awesommist,项目名称:DynamicLib,代码行数:11,代码来源:NetUtils.java

示例4: getPlayersWatchingChunk

import net.minecraft.server.management.PlayerManager; //导入方法依赖的package包/类
public static Set<EntityPlayer> getPlayersWatchingChunk(WorldServer world, int chunkX, int chunkZ) {
    final PlayerManager manager = world.getPlayerManager();

    final Set<EntityPlayer> playerList = Sets.newHashSet();
    for (Object o : world.playerEntities) {
        EntityPlayerMP player = (EntityPlayerMP) o;
        if (manager.isPlayerWatchingChunk(player, chunkX, chunkZ)) playerList.add(player);
    }
    return playerList;
}
 
开发者ID:theoriginalbit,项目名称:MoarPeripherals,代码行数:11,代码来源:PacketHandler.java


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