本文整理汇总了Java中net.minecraft.world.WorldServer.removeEntityDangerously方法的典型用法代码示例。如果您正苦于以下问题:Java WorldServer.removeEntityDangerously方法的具体用法?Java WorldServer.removeEntityDangerously怎么用?Java WorldServer.removeEntityDangerously使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.WorldServer
的用法示例。
在下文中一共展示了WorldServer.removeEntityDangerously方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transferPlayerToDimension
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public static void transferPlayerToDimension(EntityPlayerMP player, int dimensionIn, BlockPos pos, IBlockState state)
{
int i = player.dimension;
WorldServer worldserver = player.mcServer.getWorld(player.dimension);
player.dimension = dimensionIn;
WorldServer worldserver1 = player.mcServer.getWorld(player.dimension);
player.connection.sendPacket(new SPacketRespawn(player.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
player.mcServer.getPlayerList().updatePermissionLevel(player);
worldserver.removeEntityDangerously(player);
player.isDead = false;
transferPlayerToWorld(player, i, worldserver, worldserver1, pos, state);
player.mcServer.getPlayerList().preparePlayer(player, worldserver);
player.connection.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
player.interactionManager.setWorld(worldserver1);
player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));
player.mcServer.getPlayerList().updateTimeAndWeatherForPlayer(player, worldserver1);
player.mcServer.getPlayerList().syncPlayerInventory(player);
for (PotionEffect potioneffect : player.getActivePotionEffects())
{
player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potioneffect));
}
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, i, dimensionIn);
}
示例2: changePlayerDimension
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public void changePlayerDimension(EntityPlayerMP player, int dimensionIn)
{
int i = player.dimension;
WorldServer worldserver = this.mcServer.worldServerForDimension(player.dimension);
player.dimension = dimensionIn;
WorldServer worldserver1 = this.mcServer.worldServerForDimension(player.dimension);
player.connection.sendPacket(new SPacketRespawn(player.dimension, player.world.getDifficulty(), player.world.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
this.updatePermissionLevel(player);
worldserver.removeEntityDangerously(player);
player.isDead = false;
this.transferEntityToWorld(player, i, worldserver, worldserver1);
this.preparePlayer(player, worldserver);
player.connection.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
player.interactionManager.setWorld(worldserver1);
player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));
this.updateTimeAndWeatherForPlayer(player, worldserver1);
this.syncPlayerInventory(player);
for (PotionEffect potioneffect : player.getActivePotionEffects())
{
player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potioneffect));
}
}
示例3: transferPlayerToDimension
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public void transferPlayerToDimension(EntityPlayerMP player, int dimensionIn, net.minecraft.world.Teleporter teleporter)
{
int i = player.dimension;
WorldServer worldserver = this.mcServer.worldServerForDimension(player.dimension);
player.dimension = dimensionIn;
WorldServer worldserver1 = this.mcServer.worldServerForDimension(player.dimension);
player.connection.sendPacket(new SPacketRespawn(player.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
this.updatePermissionLevel(player);
worldserver.removeEntityDangerously(player);
player.isDead = false;
this.transferEntityToWorld(player, i, worldserver, worldserver1, teleporter);
this.preparePlayer(player, worldserver);
player.connection.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
player.interactionManager.setWorld(worldserver1);
player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));
this.updateTimeAndWeatherForPlayer(player, worldserver1);
this.syncPlayerInventory(player);
for (PotionEffect potioneffect : player.getActivePotionEffects())
{
player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potioneffect));
}
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, i, dimensionIn);
}
示例4: teleportPlayerToDimension
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
private static void teleportPlayerToDimension(EntityPlayerMP playerIn, int suggestedDimensionId, double x, double y, double z) {
WorldServer fromWorld = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(playerIn.dimension);
WorldServer toWorld = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(suggestedDimensionId);
playerIn.dimension = toWorld.provider.getDimension();
ChunkPos pos = new ChunkPos(playerIn.getPosition());
toWorld.getChunkProvider().loadChunk(pos.x, pos.z);
final int dimensionId = playerIn.dimension;
if (fromWorld != toWorld && fromWorld.provider.getDimensionType() == toWorld.provider.getDimensionType()) {
playerIn.connection.sendPacket(new SPacketRespawn((dimensionId >= 0 ? -1 : 0), toWorld.getDifficulty(), toWorld.getWorldInfo().getTerrainType(), playerIn.interactionManager.getGameType()));
}
playerIn.connection.sendPacket(new SPacketRespawn(dimensionId, toWorld.getDifficulty(), toWorld.getWorldInfo().getTerrainType(), playerIn.interactionManager.getGameType()));
fromWorld.removeEntityDangerously(playerIn);
playerIn.isDead = false;
playerIn.connection.setPlayerLocation(x, y, z, playerIn.rotationYaw, playerIn.rotationPitch);
playerIn.world = toWorld;
playerIn.setWorld(toWorld);
toWorld.spawnEntity(playerIn);
toWorld.updateEntityWithOptionalForce(playerIn, false);
WorldServer worldserver = playerIn.getServerWorld();
fromWorld.getPlayerChunkMap().removePlayer(playerIn);
worldserver.getPlayerChunkMap().addPlayer(playerIn);
worldserver.getChunkProvider().provideChunk((int)playerIn.posX >> 4, (int)playerIn.posZ >> 4);
playerIn.connection.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch);
playerIn.interactionManager.setWorld(toWorld);
WorldBorder worldborder = FMLCommonHandler.instance().getMinecraftServerInstance().worlds[0].getWorldBorder();
playerIn.connection.sendPacket(new SPacketWorldBorder(worldborder, SPacketWorldBorder.Action.INITIALIZE));
playerIn.connection.sendPacket(new SPacketTimeUpdate(toWorld.getTotalWorldTime(), toWorld.getWorldTime(), toWorld.getGameRules().getBoolean("doDaylightCycle")));
if (toWorld.isRaining()) {
playerIn.connection.sendPacket(new SPacketChangeGameState(1, 0.0F));
playerIn.connection.sendPacket(new SPacketChangeGameState(7, toWorld.getRainStrength(1.0F)));
playerIn.connection.sendPacket(new SPacketChangeGameState(8, toWorld.getThunderStrength(1.0F)));
}
playerIn.sendContainerToPlayer(playerIn.inventoryContainer);
playerIn.setPlayerHealthUpdated();
playerIn.connection.sendPacket(new SPacketHeldItemChange(playerIn.inventory.currentItem));
}
示例5: 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)
{
WorldServer worldserver = playerIn.getServerWorld();
playerIn.addStat(StatList.LEAVE_GAME);
this.writePlayerData(playerIn);
if (playerIn.isRiding())
{
Entity entity = playerIn.getLowestRidingEntity();
if (entity.getRecursivePassengersByType(EntityPlayerMP.class).size() == 1)
{
LOG.debug("Removing player mount");
playerIn.dismountRidingEntity();
worldserver.removeEntityDangerously(entity);
for (Entity entity1 : entity.getRecursivePassengers())
{
worldserver.removeEntityDangerously(entity1);
}
worldserver.getChunkFromChunkCoords(playerIn.chunkCoordX, playerIn.chunkCoordZ).setChunkModified();
}
}
worldserver.removeEntity(playerIn);
worldserver.getPlayerChunkMap().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 SPacketPlayerListItem(SPacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn}));
}
示例6: handleSpectate
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public void handleSpectate(CPacketSpectate packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
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.dismountRidingEntity();
if (entity.world == this.playerEntity.world)
{
this.playerEntity.setPositionAndUpdate(entity.posX, entity.posY, entity.posZ);
}
else
{
WorldServer worldserver1 = this.playerEntity.getServerWorld();
WorldServer worldserver2 = (WorldServer)entity.world;
this.playerEntity.dimension = entity.dimension;
this.sendPacket(new SPacketRespawn(this.playerEntity.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), this.playerEntity.interactionManager.getGameType()));
this.serverController.getPlayerList().updatePermissionLevel(this.playerEntity);
worldserver1.removeEntityDangerously(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.getPlayerList().preparePlayer(this.playerEntity, worldserver1);
this.playerEntity.setPositionAndUpdate(entity.posX, entity.posY, entity.posZ);
this.playerEntity.interactionManager.setWorld(worldserver2);
this.serverController.getPlayerList().updateTimeAndWeatherForPlayer(this.playerEntity, worldserver2);
this.serverController.getPlayerList().syncPlayerInventory(this.playerEntity);
}
}
}
}
示例7: handleSpectate
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public void handleSpectate(CPacketSpectate packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
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.dismountRidingEntity();
if (entity.worldObj == this.playerEntity.worldObj)
{
this.playerEntity.setPositionAndUpdate(entity.posX, entity.posY, entity.posZ);
}
else
{
WorldServer worldserver1 = this.playerEntity.getServerWorld();
WorldServer worldserver2 = (WorldServer)entity.worldObj;
this.playerEntity.dimension = entity.dimension;
this.sendPacket(new SPacketRespawn(this.playerEntity.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), this.playerEntity.interactionManager.getGameType()));
this.serverController.getPlayerList().updatePermissionLevel(this.playerEntity);
worldserver1.removeEntityDangerously(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.getPlayerList().preparePlayer(this.playerEntity, worldserver1);
this.playerEntity.setPositionAndUpdate(entity.posX, entity.posY, entity.posZ);
this.playerEntity.interactionManager.setWorld(worldserver2);
this.serverController.getPlayerList().updateTimeAndWeatherForPlayer(this.playerEntity, worldserver2);
this.serverController.getPlayerList().syncPlayerInventory(this.playerEntity);
}
}
}
}
示例8: 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)
{
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(playerIn);
WorldServer worldserver = playerIn.getServerWorld();
playerIn.addStat(StatList.LEAVE_GAME);
this.writePlayerData(playerIn);
if (playerIn.isRiding())
{
Entity entity = playerIn.getLowestRidingEntity();
if (entity.getRecursivePassengersByType(EntityPlayerMP.class).size() == 1)
{
LOG.debug("Removing player mount");
playerIn.dismountRidingEntity();
worldserver.removeEntityDangerously(entity);
for (Entity entity1 : entity.getRecursivePassengers())
{
worldserver.removeEntityDangerously(entity1);
}
worldserver.getChunkFromChunkCoords(playerIn.chunkCoordX, playerIn.chunkCoordZ).setChunkModified();
}
}
worldserver.removeEntity(playerIn);
worldserver.getPlayerChunkMap().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);
}
net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount());
this.sendPacketToAllPlayers(new SPacketPlayerListItem(SPacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn}));
}