• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java S1FPacketSetExperience类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraft.network.play.server.S1FPacketSetExperience的典型用法代码示例。如果您正苦于以下问题:Java S1FPacketSetExperience类的具体用法?Java S1FPacketSetExperience怎么用?Java S1FPacketSetExperience使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



S1FPacketSetExperience类属于net.minecraft.network.play.server包,在下文中一共展示了S1FPacketSetExperience类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleServerSide

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
@Override
public void handleServerSide(EntityPlayerMP player) {
	Entity e = player.worldObj.getEntityByID(entityID);
	if (e != null) {
		try {
			GameType preGameType = player.theItemInWorldManager.getGameType();
			e.readFromNBT(tag);
			NBTEdit.log(Level.FINE, player.getCommandSenderName() + " edited a tag -- Entity ID #" + entityID);
			NBTEdit.logTag(tag);
			if (e == player) { //Update player info
				player.sendContainerToPlayer(player.inventoryContainer);
				GameType type = player.theItemInWorldManager.getGameType();
				if (preGameType != type)
					player.setGameType(type);
				player.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel()));
				player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
				player.sendPlayerAbilities();
			}
			sendMessageToPlayer(player, "Your changes have been saved");
		} 
		catch(Throwable t) {
			sendMessageToPlayer(player, SECTION_SIGN + "cSave Failed - Invalid NBT format for Entity");
			NBTEdit.log(Level.WARNING, player.getCommandSenderName() + " edited a tag and caused an exception");
			NBTEdit.logTag(tag);
			NBTEdit.throwing("EntityNBTPacket", "handleServerSide", t);
		}
	}
}
 
开发者ID:DavidGoldman,项目名称:NBTEdit,代码行数:29,代码来源:EntityNBTPacket.java


示例2: onUpdateEntity

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
public void onUpdateEntity()
{
    try
    {
        super.onUpdate();

        for (int i = 0; i < this.inventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.inventory.getStackInSlot(i);

            if (itemstack != null && itemstack.getItem().isMap())
            {
                Packet packet = ((ItemMapBase)itemstack.getItem()).createMapDataPacket(itemstack, this.worldObj, this);

                if (packet != null)
                {
                    this.playerNetServerHandler.sendPacket(packet);
                }
            }
        }

        if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
        {
            this.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
            this.lastHealth = this.getHealth();
            this.lastFoodLevel = this.foodStats.getFoodLevel();
            this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
        }

        if (this.getHealth() + this.getAbsorptionAmount() != this.combinedHealth)
        {
            this.combinedHealth = this.getHealth() + this.getAbsorptionAmount();

            for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.health))
            {
                this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective).func_96651_a(Arrays.<EntityPlayer>asList(new EntityPlayer[] {this}));
            }
        }

        if (this.experienceTotal != this.lastExperience)
        {
            this.lastExperience = this.experienceTotal;
            this.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel));
        }

        if (this.ticksExisted % 20 * 5 == 0 && !this.getStatFile().hasAchievementUnlocked(AchievementList.exploreAllBiomes))
        {
            this.updateBiomesExplored();
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:59,代码来源:EntityPlayerMP.java


示例3: handleSetExperience

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
public void handleSetExperience(S1FPacketSetExperience packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.thePlayer.setXPStats(packetIn.func_149397_c(), packetIn.getTotalExperience(), packetIn.getLevel());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:6,代码来源:NetHandlerPlayClient.java


示例4: handleSetExperience

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
public void handleSetExperience(S1FPacketSetExperience packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
	this.gameController.thePlayer.setXPStats(packetIn.func_149397_c(), packetIn.getTotalExperience(),
			packetIn.getLevel());
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:6,代码来源:NetHandlerPlayClient.java


示例5: teleportPlayerToDim

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
public static Entity teleportPlayerToDim(World oldWorld, int newWorldID, double d, double e, double f, Entity entity) {
    if (entity != null) {
        if (entity.timeUntilPortal <= 0) {
            WorldServer oldWorldServer = MinecraftServer.getServer().worldServerForDimension(entity.dimension);
            WorldServer newWorldServer = MinecraftServer.getServer().worldServerForDimension(newWorldID);
            if (entity instanceof EntityPlayer) {
                EntityPlayerMP player = (EntityPlayerMP) entity;
                if (!player.worldObj.isRemote) {
                    player.worldObj.theProfiler.startSection("portal");
                    player.worldObj.theProfiler.startSection("changeDimension");
                    ServerConfigurationManager config = player.mcServer.getConfigurationManager();
                    player.closeScreen();
                    player.dimension = newWorldServer.provider.dimensionId;
                    player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, newWorldServer.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
                    oldWorldServer.removeEntity(player);
                    player.isDead = false;
                    player.setLocationAndAngles(d, e, f, player.rotationYaw, player.rotationPitch);
                    newWorldServer.spawnEntityInWorld(player);
                    player.setWorld(newWorldServer);
                    config.func_72375_a(player, oldWorldServer);
                    player.playerNetServerHandler.setPlayerLocation(d, e, f, entity.rotationYaw, entity.rotationPitch);
                    player.theItemInWorldManager.setWorld(newWorldServer);
                    config.updateTimeAndWeatherForPlayer(player, newWorldServer);
                    config.syncPlayerInventory(player);
                    player.worldObj.theProfiler.endSection();
                    oldWorldServer.resetUpdateEntityTick();
                    newWorldServer.resetUpdateEntityTick();
                    player.worldObj.theProfiler.endSection();
                    for (Iterator<PotionEffect> potion = player.getActivePotionEffects().iterator(); potion.hasNext(); ) {
                        player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potion.next()));
                    }
                    player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
                    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldWorldServer.provider.dimensionId, player.dimension);
                    player.timeUntilPortal = 150;
                }
                player.worldObj.theProfiler.endSection();
                return player;
            }
        }
    }
    return null;
}
 
开发者ID:GamingsModding,项目名称:TeleComponents,代码行数:43,代码来源:TeleportHelper.java


示例6: transferPlayerToDimension

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
public static void transferPlayerToDimension(EntityPlayerMP player, int dim, ServerConfigurationManager manager, Environment environ) {

		int oldDim = player.dimension;
		WorldServer worldserver = manager.getServerInstance().worldServerForDimension(player.dimension);
		player.dimension = dim;
		WorldServer worldserver1 = manager.getServerInstance().worldServerForDimension(player.dimension);
		// Cauldron dont crash the client, let 'em know there's a new dimension in town
        if (DimensionManager.isBukkitDimension(dim))
        {
            FMLEmbeddedChannel serverChannel = ForgeNetworkHandler.getServerChannel();
            serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
            serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
            serverChannel.writeOutbound(new ForgeMessage.DimensionRegisterMessage(dim, environ.getId()));
        }
        // Cauldron end
		player.playerNetServerHandler.sendPacket(new S07PacketRespawn(dim, worldserver1.difficultySetting, worldserver1.getWorldInfo()
				.getTerrainType(), player.theItemInWorldManager.getGameType()));
		player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));

		worldserver.removePlayerEntityDangerously(player);
		if (player.riddenByEntity != null) {
			player.riddenByEntity.mountEntity(null);
		}
		if (player.ridingEntity != null) {
			player.mountEntity(null);
		}
		player.isDead = false;
		transferEntityToWorld(player, worldserver, worldserver1);
		manager.func_72375_a(player, worldserver);
		player.playerNetServerHandler.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
		player.theItemInWorldManager.setWorld(worldserver1);
		manager.updateTimeAndWeatherForPlayer(player, worldserver1);
		manager.syncPlayerInventory(player);
		Iterator<PotionEffect> iterator = player.getActivePotionEffects().iterator();

		while (iterator.hasNext()) {
			PotionEffect potioneffect = iterator.next();
			player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potioneffect));
		}
		FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldDim, dim);
	}
 
开发者ID:CyberdyneCC,项目名称:Thermos,代码行数:42,代码来源:ThermiteTeleportationHandler.java


示例7: teleportPlayerEntity

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
static Entity teleportPlayerEntity(Entity entity, TileController start, TileController end, boolean keepMomentum, BlockPos exitLoc, float yaw) {
    WorldServer startWorld = (WorldServer) start.getWorldObj(), endWorld = (WorldServer) end.getWorldObj();
    boolean dimensionalTransport = startWorld.provider.dimensionId != endWorld.provider.dimensionId;
    EntityPlayerMP player = (EntityPlayerMP) entity;
    ServerConfigurationManager config = null;
    double exitX = exitLoc.getX() + (end.portalType == 1 || end.portalType == 3 ? entity.width < 1 ? 0.5 : entity.width / 2 : 0.5);
    double exitY = exitLoc.getY();
    double exitZ = exitLoc.getZ() + (end.portalType == 2 || end.portalType == 3 ? entity.width < 1 ? 0.5 : entity.width / 2 : 0.5);
    
    player.closeScreen();
    
    if (dimensionalTransport) {
        config = player.mcServer.getConfigurationManager();
        player.dimension = endWorld.provider.dimensionId;
        player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, endWorld.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
    
        startWorld.removeEntity(player);
        player.isDead = false;
        player.setLocationAndAngles(exitX, exitY, exitZ, yaw, player.rotationPitch);
        handleMomentum(player, start.portalType, end.portalType, yaw, keepMomentum);
        endWorld.spawnEntityInWorld(player);
        player.setWorld(endWorld);

        config.func_72375_a(player, startWorld);
        player.playerNetServerHandler.setPlayerLocation(exitX, exitY, exitZ, yaw, entity.rotationPitch);
        player.theItemInWorldManager.setWorld(endWorld);

        config.updateTimeAndWeatherForPlayer(player, endWorld);
        config.syncPlayerInventory(player);

        player.worldObj.theProfiler.endSection();
        startWorld.resetUpdateEntityTick();
        endWorld.resetUpdateEntityTick();
        player.worldObj.theProfiler.endSection();

        for (Iterator<PotionEffect> potion = player.getActivePotionEffects().iterator(); potion.hasNext();)
            player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potion.next()));

        player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));

        FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, startWorld.provider.dimensionId, player.dimension);
    } else {
        player.rotationYaw = yaw;
        player.setPositionAndUpdate(exitX, exitY, exitZ);
        handleMomentum(player, start.portalType, end.portalType, yaw, keepMomentum);
        player.worldObj.updateEntityWithOptionalForce(player, false);
    }
    
    return player;
}
 
开发者ID:enhancedportals,项目名称:enhancedportals,代码行数:51,代码来源:EntityManager.java


示例8: onUpdateEntity

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
public void onUpdateEntity()
{
    try
    {
        super.onUpdate();

        for (int var1 = 0; var1 < this.inventory.getSizeInventory(); ++var1)
        {
            ItemStack var6 = this.inventory.getStackInSlot(var1);

            if (var6 != null && var6.getItem().isMap())
            {
                Packet var8 = ((ItemMapBase)var6.getItem()).func_150911_c(var6, this.worldObj, this);

                if (var8 != null)
                {
                    this.playerNetServerHandler.sendPacket(var8);
                }
            }
        }

        if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
        {
            this.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
            this.lastHealth = this.getHealth();
            this.lastFoodLevel = this.foodStats.getFoodLevel();
            this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
        }

        if (this.getHealth() + this.getAbsorptionAmount() != this.field_130068_bO)
        {
            this.field_130068_bO = this.getHealth() + this.getAbsorptionAmount();
            Collection var5 = this.getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.health);
            Iterator var7 = var5.iterator();

            while (var7.hasNext())
            {
                ScoreObjective var9 = (ScoreObjective)var7.next();
                this.getWorldScoreboard().func_96529_a(this.getCommandSenderName(), var9).func_96651_a(Arrays.asList(new EntityPlayer[] {this}));
            }
        }

        if (this.experienceTotal != this.lastExperience)
        {
            this.lastExperience = this.experienceTotal;
            this.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel));
        }

        if (this.ticksExisted % 20 * 5 == 0 && !this.func_147099_x().hasAchievementUnlocked(AchievementList.field_150961_L))
        {
            this.func_147098_j();
        }
    }
    catch (Throwable var4)
    {
        CrashReport var2 = CrashReport.makeCrashReport(var4, "Ticking player");
        CrashReportCategory var3 = var2.makeCategory("Player being ticked");
        this.addEntityCrashInfo(var3);
        throw new ReportedException(var2);
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:62,代码来源:EntityPlayerMP.java


示例9: handleSetExperience

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
public void handleSetExperience(S1FPacketSetExperience p_147295_1_)
{
    this.gameController.thePlayer.setXPStats(p_147295_1_.func_149397_c(), p_147295_1_.func_149396_d(), p_147295_1_.func_149395_e());
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:5,代码来源:NetHandlerPlayClient.java


示例10: setExperience

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
@Override
public Packet setExperience(float bar, int level, int totalXp) {
    return (Packet) new S1FPacketSetExperience(bar, level, totalXp);
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:5,代码来源:NeptunePacketFactory.java


示例11: onUpdateEntity

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
public void onUpdateEntity()
{
    try
    {
        super.onUpdate();

        for (int i = 0; i < this.inventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.inventory.getStackInSlot(i);

            if (itemstack != null && itemstack.getItem().isMap())
            {
                Packet packet = ((ItemMapBase)itemstack.getItem()).func_150911_c(itemstack, this.worldObj, this);

                if (packet != null)
                {
                    this.playerNetServerHandler.sendPacket(packet);
                }
            }
        }

        // CraftBukkit - Optionally scale health
        if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
        {
            this.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(this.getBukkitEntity().getScaledHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
            this.lastHealth = this.getHealth();
            this.lastFoodLevel = this.foodStats.getFoodLevel();
            this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
        }

        if (this.getHealth() + this.getAbsorptionAmount() != this.field_130068_bO)
        {
            this.field_130068_bO = this.getHealth() + this.getAbsorptionAmount();
            // CraftBukkit - Update ALL the scores!
            this.worldObj.getServer().getScoreboardManager().updateAllScoresForList(IScoreObjectiveCriteria.health, this.getCommandSenderName(), com.google.common.collect.ImmutableList.of(this));
        }

        // CraftBukkit start - Force max health updates
        if (this.maxHealthCache != this.getMaxHealth())
        {
            this.getBukkitEntity().updateScaledHealth();
        }

        // CraftBukkit end

        if (this.experienceTotal != this.lastExperience)
        {
            this.lastExperience = this.experienceTotal;
            this.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel));
        }

        if (this.ticksExisted % 20 * 5 == 0 && !this.func_147099_x().hasAchievementUnlocked(AchievementList.field_150961_L))
        {
            this.func_147098_j();
        }

        // CraftBukkit start
        if (this.oldLevel == -1)
        {
            this.oldLevel = this.experienceLevel;
        }

        if (this.oldLevel != this.experienceLevel)
        {
            CraftEventFactory.callPlayerLevelChangeEvent(this.worldObj.getServer().getPlayer((EntityPlayerMP) this), this.oldLevel, this.experienceLevel);
            this.oldLevel = this.experienceLevel;
        }

        // CraftBukkit end
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:79,代码来源:EntityPlayerMP.java


示例12: onUpdateEntity

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
public void onUpdateEntity()
{
    try
    {
        super.onUpdate();

        for (int i = 0; i < this.inventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.inventory.getStackInSlot(i);

            if (itemstack != null && itemstack.getItem().isMap())
            {
                Packet packet = ((ItemMapBase)itemstack.getItem()).func_150911_c(itemstack, this.worldObj, this);

                if (packet != null)
                {
                    this.playerNetServerHandler.sendPacket(packet);
                }
            }
        }

        if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry)
        {
            this.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel()));
            this.lastHealth = this.getHealth();
            this.lastFoodLevel = this.foodStats.getFoodLevel();
            this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
        }

        if (this.getHealth() + this.getAbsorptionAmount() != this.field_130068_bO)
        {
            this.field_130068_bO = this.getHealth() + this.getAbsorptionAmount();
            Collection collection = this.getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.health);
            Iterator iterator = collection.iterator();

            while (iterator.hasNext())
            {
                ScoreObjective scoreobjective = (ScoreObjective)iterator.next();
                this.getWorldScoreboard().func_96529_a(this.getCommandSenderName(), scoreobjective).func_96651_a(Arrays.asList(new EntityPlayer[] {this}));
            }
        }

        if (this.experienceTotal != this.lastExperience)
        {
            this.lastExperience = this.experienceTotal;
            this.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel));
        }

        if (this.ticksExisted % 20 * 5 == 0 && !this.func_147099_x().hasAchievementUnlocked(AchievementList.field_150961_L))
        {
            this.func_147098_j();
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:62,代码来源:EntityPlayerMP.java


示例13: onPlayerRespawn

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
public static void onPlayerRespawn(EntityPlayerMP ent){
    MinecraftServer server = MinecraftServer.getServer();
    NailedPlayer player = ((NailedPlayer) NailedPlatform.instance().getPlayerFromEntity(ent));
    NailedWorld destWorld = NailedDimensionManager.instance().getWorld(ent.dimension);
    NailedWorld currentWorld = NailedDimensionManager.instance().getWorld(ent.dimension);
    Map destMap = destWorld.getMap();

    currentWorld.getWrapped().getEntityTracker().removePlayerFromTrackers(ent); //Remove from EntityTracker
    currentWorld.getWrapped().getEntityTracker().untrackEntity(ent); //Notify other players of entity death
    currentWorld.getWrapped().getPlayerManager().removePlayer(ent); //Remove player's ChunkLoader
    server.getConfigurationManager().playerEntityList.remove(ent); //Remove from the global player list
    currentWorld.getWrapped().removePlayerEntityDangerously(ent); //Force the entity to be removed from it's current world

    Mappack mappack = destMap != null ? destMap.mappack() : null;
    Location pos = mappack == null ? new Location(destWorld, 0, 64, 0) : Location.builder().copy(destWorld.getConfig().spawnPoint()).setWorld(destWorld).build();

    if(destMap != null && destMap.getGameManager().isGameRunning()){
        if(destMap.getPlayerTeam(player) == null){
            //TODO: random spawnpoints
            /*if(mappack != null && mappack.getMetadata.isChoosingRandomSpawnpointAtRespawn()){
              List<Location> spawnpoints = mappack.getMappackMetadata().getRandomSpawnpoints();
              pos = spawnpoints.get(NailedAPI.getMapLoader().getRandomSpawnpointSelector().nextInt(spawnpoints.size()));
            }*/
        }else{
            Location p = destMap.getPlayerTeam(player).getSpawnPoint();
            if(p != null) pos = p;
        }
    }

    ent.dimension = destWorld.getDimensionId();

    ItemInWorldManager worldManager = new ItemInWorldManager(destWorld.getWrapped());

    EntityPlayerMP newPlayer = new EntityPlayerMP(server, destWorld.getWrapped(), ent.getGameProfile(), worldManager);
    newPlayer.playerNetServerHandler = ent.playerNetServerHandler;
    newPlayer.clonePlayer(ent, false);
    newPlayer.dimension = destWorld.getDimensionId();
    newPlayer.setEntityId(ent.getEntityId());

    worldManager.setGameType(ent.theItemInWorldManager.getGameType());

    newPlayer.setLocationAndAngles(pos.getX(), pos.getY(), pos.getZ(), pos.getYaw(), pos.getPitch());
    destWorld.getWrapped().theChunkProviderServer.loadChunk((int)(newPlayer.posX) >> 4, (int)(newPlayer.posZ) >> 4);

    player.sendPacket(new S07PacketRespawn(destWorld.getConfig().dimension().getId(), destWorld.getWrapped().getDifficulty(), destWorld.getWrapped().getWorldInfo().getTerrainType(), worldManager.getGameType()));
    player.netHandler.setPlayerLocation(pos.getX(), pos.getY(), pos.getZ(), pos.getYaw(), pos.getPitch());
    player.sendPacket(new S05PacketSpawnPosition(new BlockPos(pos.getX(), pos.getY(), pos.getZ())));
    player.sendPacket(new S1FPacketSetExperience(newPlayer.experience, newPlayer.experienceTotal, newPlayer.experienceLevel));
    server.getConfigurationManager().updateTimeAndWeatherForPlayer(newPlayer, destWorld.getWrapped());
    destWorld.getWrapped().getPlayerManager().addPlayer(newPlayer);
    destWorld.getWrapped().spawnEntityInWorld(newPlayer);
    //noinspection unchecked
    ((List<EntityPlayer>) server.getConfigurationManager().playerEntityList).add(newPlayer);
    newPlayer.addSelfToInternalCraftingInventory();
    newPlayer.setHealth(newPlayer.getHealth());

    player.netHandler.playerEntity = newPlayer;
    player.entity = newPlayer;

    //TODO: respawn event
}
 
开发者ID:nailed,项目名称:nailed,代码行数:62,代码来源:NailedEventFactory.java


示例14: handleSetExperience

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
void handleSetExperience(S1FPacketSetExperience packetIn); 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:2,代码来源:INetHandlerPlayClient.java


示例15: handleSetExperience

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
void handleSetExperience(S1FPacketSetExperience var1); 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:2,代码来源:INetHandlerPlayClient.java


示例16: handleSetExperience

import net.minecraft.network.play.server.S1FPacketSetExperience; //导入依赖的package包/类
void handleSetExperience(S1FPacketSetExperience p_147295_1_); 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:2,代码来源:INetHandlerPlayClient.java



注:本文中的net.minecraft.network.play.server.S1FPacketSetExperience类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AbsSavedState类代码示例发布时间:2022-05-21
下一篇:
Java SWTObservables类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap