本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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;
}
}
示例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());
}
示例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);*/
}
示例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);
}
}*/
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
示例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;
}
示例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_);
}
示例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);
}
}
示例15: getPlayerManager
import net.minecraft.server.management.PlayerManager; //导入依赖的package包/类
public PlayerManager getPlayerManager()
{
return this.thePlayerManager;
}