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


Java PlayerManager类代码示例

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


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

示例1: registerDimension

import net.minecraft.server.management.PlayerManager; //导入依赖的package包/类
@SubscribeEvent
public void registerDimension(TickEvent.ServerTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        throw new IllegalStateException("I should be gone.");
    }
    DimensionManager.initDimension(DeltaChunk.getDimensionId());
    if (!DimensionManager.shouldLoadSpawn(DeltaChunk.getDimensionId())) {
        throw new RuntimeException("hammerWorld is not loaded");
    }
    if (!DimensionManager.isDimensionRegistered(DeltaChunk.getDimensionId())) {
        throw new RuntimeException("Hammer dimension was not registered!?");
    }
    World hammerWorld = DimensionManager.getWorld(DeltaChunk.getDimensionId());
    if (!(hammerWorld.provider instanceof HammerWorldProvider)) {
        throw new RuntimeException("Expected HammerWorldProvider for HammerWorld; is there a dimension ID conflict? Actual provider: " + hammerWorld.provider.getClass());
    }
    hammerWorld.addWorldAccess(new ServerShadowWorldAccess());
    int view_distance = MinecraftServer.getServer().getConfigurationManager().getViewDistance();
    //the undeobfed method comes after "isPlayerWatchingChunk", also in uses of ServerConfigurationManager.getViewDistance()
    //It returns how many blocks are visible.
    DSE_ChunkUpdateRangeSquared = Math.pow(PlayerManager.getFurthestViewableBlock(view_distance) + 16*2, 2);
    Core.unloadBus(this);
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:24,代码来源:Hammer.java

示例2: resyncChunksFull

import net.minecraft.server.management.PlayerManager; //导入依赖的package包/类
public void resyncChunksFull() {
    if (w.isRemote) return;
    Chunk chunk = getChunk();
    final WorldServer world = (WorldServer) chunk.getWorld();
    final PlayerManager pm = world.getPlayerManager();
    PlayerManager.PlayerInstance watcher = pm.getPlayerInstance(chunk.xPosition, chunk.zPosition, false);
    if (watcher == null) return;
    ArrayList<EntityPlayerMP> players = new ArrayList<EntityPlayerMP>();
    players.addAll(watcher.playersWatchingChunk);
    for (EntityPlayerMP player : players) {
        watcher.removePlayer(player);
        watcher.addPlayer(player);
    }


    Packet packet = new S21PacketChunkData(chunk, true, -1);
    FzNetDispatch.addPacketFrom(packet, chunk);
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:19,代码来源:Coord.java

示例3: 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

示例4: func_73252_b

import net.minecraft.server.management.PlayerManager; //导入依赖的package包/类
public void func_73252_b(EntityPlayerMP p_73252_1_) {
   if(this.field_73263_b.contains(p_73252_1_)) {
      Chunk var2 = PlayerManager.func_72692_a(this.field_73265_a).func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b);
      p_73252_1_.field_71135_a.func_72567_b(new Packet51MapChunk(var2, true, 0));
      this.field_73263_b.remove(p_73252_1_);
      p_73252_1_.field_71129_f.remove(this.field_73264_c);
      if(this.field_73263_b.isEmpty()) {
         long var3 = (long)this.field_73264_c.field_77276_a + 2147483647L | (long)this.field_73264_c.field_77275_b + 2147483647L << 32;
         this.func_111196_a(var2);
         PlayerManager.func_72689_b(this.field_73265_a).func_76159_d(var3);
         PlayerManager.func_111191_d(this.field_73265_a).remove(this);
         if(this.field_73262_e > 0) {
            PlayerManager.func_72682_c(this.field_73265_a).remove(this);
         }

         this.field_73265_a.func_72688_a().field_73059_b.func_73241_b(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b);
      }

   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:21,代码来源:PlayerInstance.java

示例5: func_73259_a

import net.minecraft.server.management.PlayerManager; //导入依赖的package包/类
public void func_73259_a(int p_73259_1_, int p_73259_2_, int p_73259_3_) {
   if(this.field_73262_e == 0) {
      PlayerManager.func_72682_c(this.field_73265_a).add(this);
   }

   this.field_73260_f |= 1 << (p_73259_2_ >> 4);
   if(this.field_73262_e < 64) {
      short var4 = (short)(p_73259_1_ << 12 | p_73259_3_ << 8 | p_73259_2_);

      for(int var5 = 0; var5 < this.field_73262_e; ++var5) {
         if(this.field_73261_d[var5] == var4) {
            return;
         }
      }

      this.field_73261_d[this.field_73262_e++] = var4;
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:20,代码来源:PlayerInstance.java

示例6: WorldServer

import net.minecraft.server.management.PlayerManager; //导入依赖的package包/类
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn)
{
    super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false);
    this.mcServer = server;
    this.theEntityTracker = new EntityTracker(this);
    this.thePlayerManager = new PlayerManager(this);
    this.provider.registerWorld(this);
    this.chunkProvider = this.createChunkProvider();
    this.worldTeleporter = new Teleporter(this);
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    this.getWorldBorder().setSize(server.getMaxWorldSize());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:WorldServer.java

示例7: 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

示例8: addPacketFrom

import net.minecraft.server.management.PlayerManager; //导入依赖的package包/类
public static void addPacketFrom(Packet packet, Chunk chunk) {
    if (chunk.getWorld().isRemote) return;
    final WorldServer world = (WorldServer) chunk.getWorld();
    final PlayerManager pm = world.getPlayerManager();
    PlayerManager.PlayerInstance watcher = pm.getPlayerInstance(chunk.xPosition, chunk.zPosition, false);
    if (watcher == null) return;
    watcher.sendToAllPlayersWatchingChunk(packet);

    // The above requires an AT that is impossible to get working?
    
    /*if (chunk.worldObj.isRemote) return;
    final WorldServer world = (WorldServer) chunk.worldObj;
    final PlayerManager pm = world.getPlayerManager();
    final int near = 10;
    final int far = 16;
    final int sufficientlyClose = (near*16)*(near*16);
    final int superlativelyFar = (far*16)*(far*16);
    final int chunkBlockX = chunk.xPosition*16 + 8;
    final int chunkBlockZ = chunk.zPosition*16 + 8;
    for (EntityPlayerMP player : world.playerEntities) {
        double dx = player.posX - chunkBlockX;
        double dz = player.posZ - chunkBlockZ;
        double dist = dx*dx + dz*dz;
        if (dist > superlativelyFar) continue;
        if (dist < sufficientlyClose || pm.isPlayerWatchingChunk(player, chunk.xPosition, chunk.zPosition)) {
            player.playerNetServerHandler.sendPacket(packet);
        }
    }*/
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:30,代码来源:FzNetDispatch.java

示例9: 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

示例10: sendToPlayersWatchingChunk

import net.minecraft.server.management.PlayerManager; //导入依赖的package包/类
public void sendToPlayersWatchingChunk(IMessage message, WorldServer worldServer, int chunkX, int chunkZ)
{
    PlayerManager.PlayerInstance pi = worldServer.getPlayerManager().getOrCreateChunkWatcher(chunkX, chunkZ, false);
    if (pi != null)
    {
        for (EntityPlayerMP player : (List<EntityPlayerMP>) pi.playersWatchingChunk)
        {
            sendTo(message, player);
        }
    }
}
 
开发者ID:Dynious,项目名称:Biota,代码行数:12,代码来源:SimpleNetworkWrapperExtension.java

示例11: sendToAllWatchingChunk

import net.minecraft.server.management.PlayerManager; //导入依赖的package包/类
/**
 * Sends the specified packet to all players either in specified chunk, or at least have that chunk loaded
 */
public static void sendToAllWatchingChunk(Chunk chunk, Packet packet) {
	World world = chunk.worldObj;

	if (world instanceof WorldServer) {
		PlayerManager playerManager = ((WorldServer) world).getPlayerManager();
		PlayerInstance playerInstance = playerManager.getOrCreateChunkWatcher(chunk.xPosition, chunk.zPosition, false);

		if (playerInstance != null) {
			playerInstance.sendToAllPlayersWatchingChunk(packet);
		}
	}
}
 
开发者ID:dmillerw,项目名称:Package,代码行数:16,代码来源:VanillaPacketHelper.java

示例12: 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

示例13: PlayerInstance

import net.minecraft.server.management.PlayerManager; //导入依赖的package包/类
public PlayerInstance(PlayerManager p_i1518_1_, int p_i1518_2_, int p_i1518_3_) {
   this.field_73265_a = p_i1518_1_;
   this.field_73263_b = new ArrayList();
   this.field_73261_d = new short[64];
   this.field_73264_c = new ChunkCoordIntPair(p_i1518_2_, p_i1518_3_);
   p_i1518_1_.func_72688_a().field_73059_b.func_73158_c(p_i1518_2_, p_i1518_3_);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:8,代码来源:PlayerInstance.java

示例14: func_73255_a

import net.minecraft.server.management.PlayerManager; //导入依赖的package包/类
public void func_73255_a(EntityPlayerMP p_73255_1_) {
   if(this.field_73263_b.contains(p_73255_1_)) {
      throw new IllegalStateException("Failed to add player. " + p_73255_1_ + " already is in chunk " + this.field_73264_c.field_77276_a + ", " + this.field_73264_c.field_77275_b);
   } else {
      if(this.field_73263_b.isEmpty()) {
         this.field_111198_g = PlayerManager.func_72692_a(this.field_73265_a).func_82737_E();
      }

      this.field_73263_b.add(p_73255_1_);
      p_73255_1_.field_71129_f.add(this.field_73264_c);
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:13,代码来源:PlayerInstance.java

示例15: getPlayerManager

import net.minecraft.server.management.PlayerManager; //导入依赖的package包/类
public PlayerManager getPlayerManager()
{
    return this.thePlayerManager;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:WorldServer.java


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