我正在为Minecraft制作一个基于文本的雷达.如果玩家距离你不到20个街区,它会在聊天中说出来.截至目前,它正在骚扰聊天.如何才能让它只写入关于该玩家ONCE的聊天?即使你不玩游戏,也应该很容易理解.
if (Camb.radar)
{
for (Entity e: (List < Entity > ) mc.theWorld.loadedEntityList)
{
if (e instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) e;
if (player == mc.thePlayer || mc.thePlayer.getDistanceToEntity(e) > 20.0)
continue;
mc.thePlayer.addChatMessage("\2479[CAMB] \247e" + player.getEntityName() + " has entered your 20 block radius!"); //Write to chat, only want this line done once for every player
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
603 次 |
| 最近记录: |