本文整理匯總了Java中net.minecraft.world.WorldServer.removePlayerEntityDangerously方法的典型用法代碼示例。如果您正苦於以下問題:Java WorldServer.removePlayerEntityDangerously方法的具體用法?Java WorldServer.removePlayerEntityDangerously怎麽用?Java WorldServer.removePlayerEntityDangerously使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.world.WorldServer
的用法示例。
在下文中一共展示了WorldServer.removePlayerEntityDangerously方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: transferPlayerToDimension
import net.minecraft.world.WorldServer; //導入方法依賴的package包/類
/**
* moves provided player from overworld to nether or vice versa
*/
public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension)
{
int i = playerIn.dimension;
WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension);
playerIn.dimension = dimension;
WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension);
playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType()));
worldserver.removePlayerEntityDangerously(playerIn);
playerIn.isDead = false;
this.transferEntityToWorld(playerIn, i, worldserver, worldserver1);
this.preparePlayer(playerIn, worldserver);
playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch);
playerIn.theItemInWorldManager.setWorld(worldserver1);
this.updateTimeAndWeatherForPlayer(playerIn, worldserver1);
this.syncPlayerInventory(playerIn);
for (PotionEffect potioneffect : playerIn.getActivePotionEffects())
{
playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect));
}
}
示例2: playerLoggedOut
import net.minecraft.world.WorldServer; //導入方法依賴的package包/類
/**
* Called when a player disconnects from the game. Writes player data to disk and removes them from the world.
*/
public void playerLoggedOut(EntityPlayerMP playerIn)
{
playerIn.triggerAchievement(StatList.leaveGameStat);
this.writePlayerData(playerIn);
WorldServer worldserver = playerIn.getServerForPlayer();
if (playerIn.ridingEntity != null)
{
worldserver.removePlayerEntityDangerously(playerIn.ridingEntity);
logger.debug("removing player mount");
}
worldserver.removeEntity(playerIn);
worldserver.getPlayerManager().removePlayer(playerIn);
this.playerEntityList.remove(playerIn);
UUID uuid = playerIn.getUniqueID();
EntityPlayerMP entityplayermp = (EntityPlayerMP)this.uuidToPlayerMap.get(uuid);
if (entityplayermp == playerIn)
{
this.uuidToPlayerMap.remove(uuid);
this.playerStatFiles.remove(uuid);
}
this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn}));
}
示例3: handleSpectate
import net.minecraft.world.WorldServer; //導入方法依賴的package包/類
public void handleSpectate(C18PacketSpectate packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());
if (this.playerEntity.isSpectator())
{
Entity entity = null;
for (WorldServer worldserver : this.serverController.worldServers)
{
if (worldserver != null)
{
entity = packetIn.getEntity(worldserver);
if (entity != null)
{
break;
}
}
}
if (entity != null)
{
this.playerEntity.setSpectatingEntity(this.playerEntity);
this.playerEntity.mountEntity((Entity)null);
if (entity.worldObj != this.playerEntity.worldObj)
{
WorldServer worldserver1 = this.playerEntity.getServerForPlayer();
WorldServer worldserver2 = (WorldServer)entity.worldObj;
this.playerEntity.dimension = entity.dimension;
this.sendPacket(new S07PacketRespawn(this.playerEntity.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), this.playerEntity.theItemInWorldManager.getGameType()));
worldserver1.removePlayerEntityDangerously(this.playerEntity);
this.playerEntity.isDead = false;
this.playerEntity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
if (this.playerEntity.isEntityAlive())
{
worldserver1.updateEntityWithOptionalForce(this.playerEntity, false);
worldserver2.spawnEntityInWorld(this.playerEntity);
worldserver2.updateEntityWithOptionalForce(this.playerEntity, false);
}
this.playerEntity.setWorld(worldserver2);
this.serverController.getConfigurationManager().preparePlayer(this.playerEntity, worldserver1);
this.playerEntity.setPositionAndUpdate(entity.posX, entity.posY, entity.posZ);
this.playerEntity.theItemInWorldManager.setWorld(worldserver2);
this.serverController.getConfigurationManager().updateTimeAndWeatherForPlayer(this.playerEntity, worldserver2);
this.serverController.getConfigurationManager().syncPlayerInventory(this.playerEntity);
}
else
{
this.playerEntity.setPositionAndUpdate(entity.posX, entity.posY, entity.posZ);
}
}
}
}