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


Java EnchantmentHelper.applyThornEnchantments方法代碼示例

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


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

示例1: applyEnchantments

import net.minecraft.enchantment.EnchantmentHelper; //導入方法依賴的package包/類
protected void applyEnchantments(EntityLivingBase entityLivingBaseIn, Entity entityIn)
{
    if (entityIn instanceof EntityLivingBase)
    {
        EnchantmentHelper.applyThornEnchantments((EntityLivingBase)entityIn, entityLivingBaseIn);
    }

    EnchantmentHelper.applyArthropodEnchantments(entityLivingBaseIn, entityIn);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:10,代碼來源:Entity.java

示例2: onImpact

import net.minecraft.enchantment.EnchantmentHelper; //導入方法依賴的package包/類
@Override
protected void onImpact(RayTraceResult result) {
	if (result.typeOfHit == RayTraceResult.Type.ENTITY) {
		EntityLivingBase thrower = getThrower();
		// prevent damaging thrower
		if (result.entityHit == thrower)
			return;

		Entity entity = result.entityHit;
		DamageSource ds = createDamageSource(null == thrower ? this : thrower);

		if (isBurning() && !(entity instanceof EntityEnderman))
			entity.setFire(5);
		if (entity.attackEntityFrom(ds, getDamage())) {
			if (entity instanceof EntityLivingBase) {
				EntityLivingBase base = (EntityLivingBase) entity;

				if (knockbackStrength > 0) {
					float f1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
					if (f1 > 0f) {
						base.addVelocity(motionX * knockbackStrength * 0.6000000238418579D / f1,
							0.1D, motionZ * knockbackStrength * 0.6000000238418579D / f1);
					}
				}

				if (null != thrower) {
					EnchantmentHelper.applyThornEnchantments(base, thrower);
					EnchantmentHelper.applyArthropodEnchantments(thrower, base);
					if (base != thrower && base instanceof EntityPlayer && thrower instanceof EntityPlayerMP)
					{
						((EntityPlayerMP)thrower).connection.sendPacket(new SPacketChangeGameState(6, 0.0F));
					}
				}
			}
		}
	}
	if (!worldObj.isRemote)
        setDead();
}
 
開發者ID:arucil,項目名稱:mc-Slingshot,代碼行數:40,代碼來源:EntityBall.java


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