本文整理匯總了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);
}
示例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();
}