本文整理匯總了Java中net.minecraft.entity.projectile.EntityThrowable.setThrowableHeading方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityThrowable.setThrowableHeading方法的具體用法?Java EntityThrowable.setThrowableHeading怎麽用?Java EntityThrowable.setThrowableHeading使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.projectile.EntityThrowable
的用法示例。
在下文中一共展示了EntityThrowable.setThrowableHeading方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: attackEntityWithRangedAttack
import net.minecraft.entity.projectile.EntityThrowable; //導入方法依賴的package包/類
@Override
public void attackEntityWithRangedAttack(EntityLivingBase sucker, float par2) {
if (worldObj.isRemote)
return;
final EntityCosmeticShadowRiser ecsr = new EntityCosmeticShadowRiser(worldObj);
ecsr.setPosition(posX, posY + getEyeHeight(), posZ);
worldObj.spawnEntityInWorld(ecsr);
final boolean harm_undead = sucker.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD;
final AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(sucker.posX - 8.0, sucker.posY - 16.0, sucker.posZ - 8.0,
sucker.posX + 8.0, sucker.posY + 16.0, sucker.posZ + 8.0);
if (!harm_undead) {
final List li = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb);
for (final Object obj : li)
if (obj instanceof EntityNyxSkeleton) {
final EntityThrowable entityball = new EntityShadowBall(worldObj, this, false, true);
final Entity target = (Entity) obj;
entityball.setPosition(target.posX, target.posY + 32 + worldObj.rand.nextFloat() * 32, target.posZ);
entityball.setThrowableHeading(0, -1, 0, 0.40F, 0F);
worldObj.spawnEntityInWorld(entityball);
}
}
final EntityThrowable entitysmite = new EntityShadowBall(worldObj, this, harm_undead, true);
entitysmite.setPosition(sucker.posX, sucker.posY + 32 + worldObj.rand.nextFloat() * 32, sucker.posZ);
entitysmite.setThrowableHeading(0, -1, 0, 0.40F, 0F);
worldObj.spawnEntityInWorld(entitysmite);
}
示例2: doShadowAttack
import net.minecraft.entity.projectile.EntityThrowable; //導入方法依賴的package包/類
public void doShadowAttack(EntityLivingBase par1EntityLiving, float par2) {
final boolean harm_undead = par1EntityLiving.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD;
final EntityThrowable entityball = new EntityShadowBall(worldObj, this, harm_undead,
IaSWorldHelper.getRegionLevel(par1EntityLiving) >= 6);
final double d0 = par1EntityLiving.posX + par1EntityLiving.motionX - posX;
final double d1 = par1EntityLiving.posY + par1EntityLiving.getEyeHeight() - getEyeHeight() - posY;
final double d2 = par1EntityLiving.posZ + par1EntityLiving.motionZ - posZ;
final float f1 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);
if (f1 <= 2.0) {
entityball.setThrowableHeading(d0, d1, d2, 0.40F, 8.0F);
} else {
entityball.rotationPitch += 20.0F;
}
entityball.setThrowableHeading(d0, d1 + f1 * 0.2F, d2, 0.80F, 8.0F);
worldObj.spawnEntityInWorld(entityball);
}
示例3: attackEntityWithRangedAttack
import net.minecraft.entity.projectile.EntityThrowable; //導入方法依賴的package包/類
public void attackEntityWithRangedAttack(EntityLivingBase entitylivingbase,
float f) {
EntityThrowable ent = entitySelect(this.worldObj);
double toX = entitylivingbase.posX - this.posX;
float percentToMouth = 0.5F;
double toY = entitylivingbase.posY + this.height * percentToMouth
- 1.0D - ent.posY;
double toZ = entitylivingbase.posZ - this.posZ;
float f1 = MathHelper.sqrt_double(toX * toX + toZ * toZ) * 0.2F;
ent.setThrowableHeading(toX, toY + f1, toZ, 1.6F, 12.0F);
playSound("random.bow", 1.0F,
1.0F / (getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(ent);
if (entitylivingbase instanceof EntityCreature) {
((EntityCreature) entitylivingbase).setAttackTarget(this);
}
}
示例4: attackEntityWithRangedAttack
import net.minecraft.entity.projectile.EntityThrowable; //導入方法依賴的package包/類
public void attackEntityWithRangedAttack(EntityLivingBase entitylivingbase, float f)
{
if (entitySelect(this.worldObj) != null)
{
int numbPods = this.min + (int)(Math.random() * (this.max - this.min + 1));
for (int i = 0; i < numbPods; i++) {
EntityThrowable ent = entitySelect(this.worldObj);
double toX = entitylivingbase.posX - this.posX;
float percentToMouth = 0.5F;
double toY = entitylivingbase.posY + this.height * percentToMouth - 1.0D - ent.posY;
double toZ = entitylivingbase.posZ - this.posZ;
float f1 = MathHelper.sqrt_double(toX * toX + toZ * toZ) * 0.2F;
ent.setThrowableHeading(toX, toY + f1, toZ, 1.6F, 12.0F);
playSound("random.bow", 1.0F, 1.0F / (getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(ent);
}
}
}
示例5: launchProjectile
import net.minecraft.entity.projectile.EntityThrowable; //導入方法依賴的package包/類
public static void launchProjectile(Entity entity, EntityThrowable proj, double targetX, double targetY, double targetZ) {
double dx = targetX - entity.posX;
double dy = targetY - entity.posY;
double dz = targetZ - entity.posZ;
proj.setThrowableHeading(dx, dy, dz, 1.6F, 0F);
entity.worldObj.spawnEntityInWorld(proj);
}
示例6: attackEntityWithRangedAttack
import net.minecraft.entity.projectile.EntityThrowable; //導入方法依賴的package包/類
public void attackEntityWithRangedAttack(EntityLivingBase entitylivingbase, float f)
{
if (entitySelect(this.worldObj) != null) {
EntityThrowable ent = entitySelect(this.worldObj);
double toX = entitylivingbase.posX - this.posX;
float percentToMouth = 0.5F;
double toY = entitylivingbase.posY + this.height * percentToMouth - 1.0D - ent.posY;
double toZ = entitylivingbase.posZ - this.posZ;
float f1 = MathHelper.sqrt_double(toX * toX + toZ * toZ) * 0.2F;
ent.setThrowableHeading(toX, toY + f1, toZ, 1.6F, 12.0F);
playSound("random.bow", 1.0F, 1.0F / (getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(ent);
}
}
示例7: attackEntityWithRangedAttack
import net.minecraft.entity.projectile.EntityThrowable; //導入方法依賴的package包/類
public void attackEntityWithRangedAttack(EntityLivingBase entitylivingbase,
float f) {
EntityThrowable ent1 = entitySelect(this.worldObj);
int[] facingA = Util.entityDirectionSpawn(this);
EntityThrowable ent2;
EntityThrowable ent3;
switch (Util.entityDirection(this)) {
case 0:
ent2 = new EntityPeaPod(this.worldObj, this,
this.posX + facingA[0], this.posY, this.posZ);
ent3 = new EntityPeaPod(this.worldObj, this,
this.posX + facingA[1], this.posY, this.posZ);
break;
case 1:
ent2 = new EntityPeaPod(this.worldObj, this, this.posX, this.posY,
this.posZ + facingA[0]);
ent3 = new EntityPeaPod(this.worldObj, this, this.posX, this.posY,
this.posZ + facingA[1]);
break;
case 2:
ent2 = new EntityPeaPod(this.worldObj, this,
this.posX + facingA[0], this.posY, this.posZ);
ent3 = new EntityPeaPod(this.worldObj, this,
this.posX + facingA[1], this.posY, this.posZ);
break;
case 3:
ent2 = new EntityPeaPod(this.worldObj, this, this.posX, this.posY,
this.posZ + facingA[0]);
ent3 = new EntityPeaPod(this.worldObj, this, this.posX, this.posY,
this.posZ + facingA[1]);
break;
default:
ent2 = new EntityPeaPod(this.worldObj, this, this.posX, this.posY,
this.posZ);
ent3 = new EntityPeaPod(this.worldObj, this, this.posX, this.posY,
this.posZ);
}
double toX = entitylivingbase.posX - this.posX;
float percentToMouth = 0.5F;
double toY = entitylivingbase.posY + this.height * percentToMouth
- 1.0D - ent1.posY;
double toZ = entitylivingbase.posZ - this.posZ;
float f1 = MathHelper.sqrt_double(toX * toX + toZ * toZ) * 0.2F;
double podOffset = 0.7D;
ent1.setThrowableHeading(toX, toY + f1, toZ, 1.6F, 12.0F);
ent2.setThrowableHeading(toX + podOffset, toY + f1, toZ + podOffset,
1.6F, 12.0F);
ent3.setThrowableHeading(toX - podOffset, toY + f1, toZ - podOffset,
1.6F, 12.0F);
playSound("random.bow", 1.0F,
1.0F / (getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(ent1);
this.worldObj.spawnEntityInWorld(ent2);
this.worldObj.spawnEntityInWorld(ent3);
Util.entityDirectionSpawn(this);
}