Jump to content

[1.7.10] Why Error? (CustomEntityPlayer Getting..)


jmylifecolor

Recommended Posts


////////Getting All Player //////////////
   ArrayList<EntityPlayerMP> AllPlayer = new ArrayList<EntityPlayerMP>();
   ListIterator itl;
	for(int i = 0; i<MinecraftServer.getServer().worldServers.length; i++) {
		itl = MinecraftServer.getServer().worldServers[i].playerEntities.listIterator();
		while(itl.hasNext()) AllPlayer.add((EntityPlayerMP)itl.next());
	}
//////////////////////////////////////////


//// IgameInfo.Player is Custom EntityPlayerMP Array List. ///////
	  IGameInfo.Player.clear(); // Cleary
	  


  for(int i=0; i<AllPlayer.size(); i++)
  {

                 //↓This code Error..
	  CustomPlayer player = new CustomPlayer(MinecraftServer.getServer().worldServers[i], AllPlayer.get(i).getGameProfile());
	  IGameInfo.Player.add(player);
  }

 

CustomPlayer Code.

public class CustomPlayer extends EntityPlayerMP
{
public enum JOB
{
	Detective,JoblessPerson,Police,Cleaner,Army,Programmer,secretary
}


//직업을 설정한다. 
public JOB job;

// 살인마인지 아닌지를 체크한다.
public boolean isKiller;

    public CustomPlayer(WorldServer world, GameProfile name)
    {
        super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world));
    }

}

 

Error message

at IGame.Command.IGameStart.SetIGamePlayerList(IGameStart.java:103) ~[iGameStart.class:?]

at IGame.Command.IGameStart.processCommand(IGameStart.java:124) ~[iGameStart.class:?]

at net.minecraft.command.CommandHandler.executeCommand(CommandHandler.java:96) [CommandHandler.class:?]

at net.minecraft.network.NetHandlerPlayServer.handleSlashCommand(NetHandlerPlayServer.java:788) [NetHandlerPlayServer.class:?]

at net.minecraft.network.NetHandlerPlayServer.processChatMessage(NetHandlerPlayServer.java:764) [NetHandlerPlayServer.class:?]

at net.minecraft.network.play.client.C01PacketChatMessage.processPacket(C01PacketChatMessage.java:47) [C01PacketChatMessage.class:?]

at net.minecraft.network.play.client.C01PacketChatMessage.processPacket(C01PacketChatMessage.java:68) [C01PacketChatMessage.class:?]

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?]

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]

 

 

sorry i can't english very well..

 

 

This code working 3 or less player...

 

but, If my server players 4 or more player than

 

print error message

 

 

 

 

what problem.. :)?

Link to comment
Share on other sites

You're using the index in the

AllPlayers

list as the index for the

worldServers

array.

worldServers

contains the

WorldServer

instance for each dimension. Vanilla only has three dimensions, so once you try to create more than three

CustomPlayer

s you're using an invalid index.

 

I'd suggest using for-each/enhanced for loops instead of

for

/

while

loops here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.