本文整理汇总了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;
}
示例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);*/
}
示例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;
}
示例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;
}