当前位置: 首页>>代码示例>>Java>>正文


Java EntityPlayer.setGlowing方法代码示例

本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.setGlowing方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.setGlowing方法的具体用法?Java EntityPlayer.setGlowing怎么用?Java EntityPlayer.setGlowing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.player.EntityPlayer的用法示例。


在下文中一共展示了EntityPlayer.setGlowing方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: finishRescue

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static void finishRescue(EntityPlayer player) {
	IHardcoreRevival revival = player.getCapability(CapabilityHardcoreRevival.REVIVAL_CAPABILITY, null);
	if (revival != null) {
		EntityPlayer target = revival.getRescueTarget();
		if (target != null) {
			MinecraftServer server = target.getServer();
			if (server != null) {
				BlockPos prevSpawnPos = target.getBedLocation(target.dimension);
				boolean prevSpawnForced = target.isSpawnForced(target.dimension);
				target.setSpawnPoint(target.getPosition(), true);
				if (ModConfig.glowOnDeath) {
					target.setGlowing(false);
				}
				EntityPlayerMP newPlayer = server.getPlayerList().recreatePlayerEntity((EntityPlayerMP) target, target.dimension, false);
				((EntityPlayerMP) target).connection.player = newPlayer;
				newPlayer.setHealth(1f);
				newPlayer.getFoodStats().setFoodLevel(5);
				newPlayer.addPotionEffect(new PotionEffect(MobEffects.HUNGER, 20 * 30));
				newPlayer.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 20 * 60));
				newPlayer.inventory.copyInventory(target.inventory);
				newPlayer.experienceLevel = target.experienceLevel;
				newPlayer.experienceTotal = target.experienceTotal;
				newPlayer.experience = target.experience;

				newPlayer.extinguish();
				newPlayer.setFlag(0, false); // burning flag

				newPlayer.setScore(target.getScore());
				newPlayer.setSpawnPoint(prevSpawnPos, prevSpawnForced);
				NetworkHandler.instance.sendToAllAround(new MessageRevivalSuccess(newPlayer.getEntityId()), new NetworkRegistry.TargetPoint(newPlayer.dimension, newPlayer.posX, newPlayer.posY, newPlayer.posZ, 32));
			}
		}
	}
}
 
开发者ID:blay09,项目名称:HardcoreRevival,代码行数:35,代码来源:RescueHandler.java

示例2: onPlayerDeath

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerDeath(LivingDeathEvent event) {
	if (event.getEntityLiving() instanceof EntityPlayerMP) {
		EntityPlayer player = (EntityPlayer) event.getEntityLiving();

		// If the player fell into the void, there's no rescuing
		if (event.getSource() == DamageSource.OUT_OF_WORLD) {
			player.getEntityData().setBoolean(IGNORE_REVIVAL_DEATH, true);
			NetworkHandler.instance.sendTo(new MessageDie(), (EntityPlayerMP) player);
			return;
		}

		// If IGNORE_REVIVAL_DEATH is set, this should be treated as a normal death
		if (event.getSource() == HardcoreRevival.notRescuedInTime || player.getEntityData().getBoolean(IGNORE_REVIVAL_DEATH)) {
			return;
		}

		// Fire event for compatibility addons
		MinecraftForge.EVENT_BUS.post(new PlayerKnockedOutEvent(player, event.getSource()));

		// Dead players glow
		if (ModConfig.glowOnDeath) {
			player.setGlowing(true);
		}

		// Cancel event - we're taking over from here
		event.setCanceled(true);

		// If enabled, show a death message
		if (player.world.getGameRules().getBoolean("showDeathMessages")) {
			MinecraftServer server = player.world.getMinecraftServer();
			if (server != null) {
				Team team = player.getTeam();
				if (team != null && team.getDeathMessageVisibility() != Team.EnumVisible.ALWAYS) {
					if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OTHER_TEAMS) {
						server.getPlayerList().sendMessageToAllTeamMembers(player, player.getCombatTracker().getDeathMessage());
					} else if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OWN_TEAM) {
						server.getPlayerList().sendMessageToTeamOrAllPlayers(player, player.getCombatTracker().getDeathMessage());
					}
				} else {
					server.getPlayerList().sendMessage(player.getCombatTracker().getDeathMessage());
				}
			}
		}
	}
}
 
开发者ID:blay09,项目名称:HardcoreRevival,代码行数:47,代码来源:DeathHandler.java


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