當前位置: 首頁>>代碼示例>>Java>>正文


Java DamageSource.OUT_OF_WORLD屬性代碼示例

本文整理匯總了Java中net.minecraft.util.DamageSource.OUT_OF_WORLD屬性的典型用法代碼示例。如果您正苦於以下問題:Java DamageSource.OUT_OF_WORLD屬性的具體用法?Java DamageSource.OUT_OF_WORLD怎麽用?Java DamageSource.OUT_OF_WORLD使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraft.util.DamageSource的用法示例。


在下文中一共展示了DamageSource.OUT_OF_WORLD屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: applyGlobalPotionModifiers

/**
 * Changed copy of the first part from {@link EnchantmentHelper#applyEnchantmentModifier(EnchantmentHelper.IModifier, ItemStack)}
 */
public static float applyGlobalPotionModifiers(EntityPlayer player, DamageSource source, float damage) {
    if (source.isDamageAbsolute())
        return damage;
    if (player.isPotionActive(MobEffects.RESISTANCE) && source != DamageSource.OUT_OF_WORLD) {
        @SuppressWarnings("ConstantConditions")
        int i = (player.getActivePotionEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
        int j = 25 - i;
        float f = damage * (float) j;
        damage = f / 25.0F;
    }

    if (damage <= 0.0F)
        return 0.0F;

    return damage;
}
 
開發者ID:ichttt,項目名稱:FirstAid,代碼行數:19,代碼來源:ArmorUtils.java

示例2: attackEntityFrom

@Override
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
{
    if(par1DamageSource == DamageSource.LAVA || par1DamageSource == DamageSource.OUT_OF_WORLD)
    {
        setDead();
        return true;
    }
    return false;
}
 
開發者ID:TheCBProject,項目名稱:WirelessRedstone,代碼行數:10,代碼來源:EntityWirelessTracker.java

示例3: onDeath

@Override
public void onDeath(DamageSource cause) {
	if (cause == DamageSource.OUT_OF_WORLD) {
		connection.sendPacket(new SPacketCombatEvent(getCombatTracker(), SPacketCombatEvent.Event.ENTITY_DIED, false));
		EntityLivingBase entitylivingbase = getAttackingEntity();
		if (entitylivingbase != null) {
			entitylivingbase.onItemPickup(this, scoreValue);
		}
		extinguish();
		setFlag(0, false);
		getCombatTracker().reset();
	}
}
 
開發者ID:p455w0rd,項目名稱:DankNull,代碼行數:13,代碼來源:EntityPFakePlayer.java

示例4: onPlayerDeath

@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,代碼行數:46,代碼來源:DeathHandler.java


注:本文中的net.minecraft.util.DamageSource.OUT_OF_WORLD屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。