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


Java EnchantmentHelper.applyArthropodEnchantments方法代码示例

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


在下文中一共展示了EnchantmentHelper.applyArthropodEnchantments方法的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.applyArthropodEnchantments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。