本文整理汇总了Java中net.minecraft.entity.projectile.EntityTippedArrow类的典型用法代码示例。如果您正苦于以下问题:Java EntityTippedArrow类的具体用法?Java EntityTippedArrow怎么用?Java EntityTippedArrow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityTippedArrow类属于net.minecraft.entity.projectile包,在下文中一共展示了EntityTippedArrow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_190726_a
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
protected EntityArrow func_190726_a(float p_190726_1_)
{
ItemStack itemstack = this.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
if (itemstack.getItem() == Items.SPECTRAL_ARROW)
{
EntitySpectralArrow entityspectralarrow = new EntitySpectralArrow(this.world, this);
entityspectralarrow.func_190547_a(this, p_190726_1_);
return entityspectralarrow;
}
else
{
EntityArrow entityarrow = super.func_190726_a(p_190726_1_);
if (itemstack.getItem() == Items.TIPPED_ARROW && entityarrow instanceof EntityTippedArrow)
{
((EntityTippedArrow)entityarrow).setPotionEffect(itemstack);
}
return entityarrow;
}
}
示例2: update
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
@Override
public void update() {
super.update();
World world = entity.getWorld();
if(!world.isRemote && entity.ticksExisted()%TICKRATE==0){
BlockPos pos = getPos();
for(int i=0;i<AMOUNT;i++){
double x = pos.getX()+Math.random() * RAD * 2 - RAD,
z = pos.getZ()+Math.random() * RAD * 2 - RAD;
BlockPos spawn = new BlockPos(x,pos.getY()+94,z);
while(!world.isAirBlock(spawn)&&spawn.getY()>pos.getY()+1)spawn=spawn.down();
//Original spawned arrows at a fixed height of 158
EntityArrow arrow = new EntityTippedArrow(world, x, spawn.getY(), z);
arrow.motionX=0;
arrow.motionZ=0;
arrow.motionY=-2D;
arrow.setFire(30);
arrow.pickupStatus=PickupStatus.DISALLOWED;//why is this an int...
//arrow.setThrowableHeading(0, -1, 0, 2F, 0);
world.spawnEntity(arrow);
}
}
}
示例3: getArrow
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
protected EntityArrow getArrow(float distanceFactor) {
ItemStack arrowItem = this.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
if (arrowItem.getItem() == Items.SPECTRAL_ARROW) {
EntitySpectralArrow entityspectralarrow = new EntitySpectralArrow(this.world, this);
entityspectralarrow.setEnchantmentEffectsFromEntity(this, distanceFactor);
return entityspectralarrow;
} else {
EntityTippedArrow entityarrow = new EntityTippedArrow(this.world, this);
entityarrow.setEnchantmentEffectsFromEntity(this, distanceFactor);
if (arrowItem.getItem() == Items.TIPPED_ARROW)
entityarrow.setPotionEffect(arrowItem);
return entityarrow;
}
}
示例4: getArrow
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
protected EntityArrow getArrow(float distanceFactor) {
ItemStack arrowStack = this.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
if (arrowStack.getItem() == Items.SPECTRAL_ARROW) {
EntitySpectralArrow entityspectralarrow = new EntitySpectralArrow(this.world, this);
entityspectralarrow.setEnchantmentEffectsFromEntity(this, distanceFactor);
return entityspectralarrow;
} else {
EntityTippedArrow entityarrow = new EntityTippedArrow(this.world, this);
entityarrow.setEnchantmentEffectsFromEntity(this, distanceFactor);
if (arrowStack.getItem() == Items.TIPPED_ARROW)
entityarrow.setPotionEffect(arrowStack);
return entityarrow;
}
}
示例5: onBowFire
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
@SuppressWarnings("static-access")
@SubscribeEvent
public void onBowFire(ArrowLooseEvent event)
{
EntityPlayer player = event.getEntityPlayer();
ItemStack stack = event.getBow();
NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
if (player != null && stack != null && nbt != null && !player.getEntityWorld().isRemote)
{
if (BowAttribute.BARRAGE.hasAttribute(nbt))
{
for (int i = 0; i < (int) BowAttribute.BARRAGE.getCalculatedValue(nbt, 3, 1.5); i++)
{
EntityArrow entityarrow = new EntityTippedArrow(player.getEntityWorld(), player);
entityarrow.setAim(player, player.rotationPitch, player.rotationYaw, 0, ((ItemBow) event.getBow().getItem()).getArrowVelocity(event.getCharge()) * 3, 20F);
entityarrow.pickupStatus = PickupStatus.DISALLOWED;
player.getEntityWorld().spawnEntity(entityarrow);
}
}
}
}
示例6: attackEntityWithRangedAttack
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
/**
* Attack the specified entity using a ranged attack.
*/
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
EntityArrow entityarrow = new EntityTippedArrow(world, this);
double d0 = par1EntityLivingBase.posX - posX;
double d1 = par1EntityLivingBase.getEntityBoundingBox().minY + par1EntityLivingBase.height / 3.0F - entityarrow.posY;
double d2 = par1EntityLivingBase.posZ - posZ;
double d3 = MathHelper.sqrt(d0 * d0 + d2 * d2);
entityarrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, 14 - world.getDifficulty().getDifficultyId() * 4);
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
entityarrow.setDamage(par2 * 2.0F + rand.nextGaussian() * 0.25D + world.getDifficulty().getDifficultyId() * 0.11F);
if (i > 0)
entityarrow.setDamage(entityarrow.getDamage() + i * 0.5D + 0.5D);
if (j > 0)
entityarrow.setKnockbackStrength(j);
if (EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, this) > 0)
entityarrow.setFire(100);
playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (getRNG().nextFloat() * 0.4F + 0.8F));
world.spawnEntity(entityarrow);
}
示例7: executeActivateBehavior
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
@Override
public int executeActivateBehavior(TileEntityTrophy tile, EntityPlayer player) {
final BlockPos pos = tile.getPos();
double pX = pos.getX() + 0.5;
final int pZ = pos.getY() + 1;
double pY = pos.getZ() + 0.5;
final World world = tile.getWorld();
EntityArrow entityarrow = new EntityTippedArrow(world, pX, pZ, pY);
entityarrow.setDamage(0.1);
entityarrow.shoot(world.rand.nextInt(10) - 5, 40, world.rand.nextInt(10) - 5, 1.0f, 6.0f);
world.playSound((EntityPlayer)null, player.getPosition(), SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + 0.5F);
world.spawnEntity(entityarrow);
return 0;
}
示例8: func_190726_a
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
protected EntityArrow func_190726_a(float p_190726_1_)
{
EntityArrow entityarrow = super.func_190726_a(p_190726_1_);
if (entityarrow instanceof EntityTippedArrow)
{
((EntityTippedArrow)entityarrow).addEffect(new PotionEffect(MobEffects.SLOWNESS, 600));
}
return entityarrow;
}
示例9: attackWithArrow
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
protected void attackWithArrow(EntityLivingBase target) {
int charge = 2 + rand.nextInt(10);
EntityArrow entityarrow = new EntityTippedArrow(this.world, this);
double d0 = target.posX - this.posX;
double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entityarrow.posY;
double d2 = target.posZ - this.posZ;
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
entityarrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F,
(float) (14 - this.world.getDifficulty().getDifficultyId() * 4));
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
entityarrow.setDamage((double) (charge * 2.0F) + this.rand.nextGaussian() * 0.25D
+ (double) ((float) this.world.getDifficulty().getDifficultyId() * 0.11F));
if (i > 0) {
entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D);
}
if (j > 0) {
entityarrow.setKnockbackStrength(j);
}
if (rand.nextBoolean()) {
entityarrow.setFire(100);
}
this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.world.spawnEntity(entityarrow);
}
示例10: apply
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
/**
* Some code in this method is borrowed from ItemBow, I guess, I don't
* remember
*/
@Override
public void apply(EntityActor actor)
{
World world = actor.worldObj;
Frame frame = actor.playback.record.frames.get(actor.playback.tick);
EntityTippedArrow arrow = new EntityTippedArrow(world, actor);
float f = ItemBow.getArrowVelocity(this.charge);
arrow.setAim(actor, frame.pitch, frame.yaw, 0.0F, f * 3.0F, 1.0F);
world.spawnEntityInWorld(arrow);
}
示例11: attackEntityWithRangedAttack
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
public void attackEntityWithRangedAttack(EntityLivingBase target, float arrowSpeed)
{
EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.world, this);
double d0 = target.posX - this.posX;
double d1 = target.getEntityBoundingBox().minY + (double)(target.height / 3.0F) - entitytippedarrow.posY;
double d2 = target.posZ - this.posZ;
double d3 = (double)MathHelper.sqrt(d0 * d0 + d2 * d2);
entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.2, d2, 1.6F, (float)(14 - this.world.getDifficulty().getDifficultyId() * 4));
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
entitytippedarrow.setDamage((double)(arrowSpeed * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().getDifficultyId() * 0.11F));
if (i > 0)
entitytippedarrow.setDamage(entitytippedarrow.getDamage() + (double)i * 0.5D + 0.5D);
if (j > 0)
entitytippedarrow.setKnockbackStrength(j);
boolean flag = this.isBurning() && this.rand.nextBoolean();
flag = flag || EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, this) > 0;
if (flag)
entitytippedarrow.setFire(100);
ItemStack itemstack = this.getHeldItem(EnumHand.OFF_HAND);
if (itemstack != null && itemstack.getItem() == Items.TIPPED_ARROW)
entitytippedarrow.setPotionEffect(itemstack);
this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.world.spawnEntity(entitytippedarrow);
}
示例12: shootThisDirection
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
public void shootThisDirection(EnumFacing enumfacing) {
BlockPos position = this.getPosition().up().offset(enumfacing, 2);
EntityTippedArrow entitytippedarrow = new EntityTippedArrow(world, position.getX(), position.getY(), position.getZ());
entitytippedarrow.setPotionEffect(PotionUtils.addPotionToItemStack(new ItemStack(Items.TIPPED_ARROW), PotionType.getPotionTypeForName("slowness")));
entitytippedarrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
entitytippedarrow.setThrowableHeading((double) enumfacing.getFrontOffsetX(), YAW, (double) enumfacing.getFrontOffsetZ(), VELOCITY, INACCRACY);
world.spawnEntity(entitytippedarrow);
}
示例13: getNewEntityArrow
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
public EntityArrow getNewEntityArrow(World worldIn, EntityPlayer playerIn, int itemUseDuration) {
if (this.getBowToMimick() == null) {
FFQLogger.warning("ItemQuiverableArrow getnewEntityArrow: I have been called to get a new arrow entity, but I have no bow to mimic. Subclass needs to override this method.");
return new EntityTippedArrow(worldIn, playerIn);
} else {
return this.getBowToMimick().getNewEntityArrow(worldIn, playerIn, itemUseDuration);
}
}
示例14: attackEntityWithRangedAttack
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
EntitySnowball entitysnowball = new EntitySnowball(this.world, this);
EntityArrow entityarrow = new EntityTippedArrow(this.world, this);
double d0 = par1EntityLivingBase.posX - this.posX;
double d1 = par1EntityLivingBase.posY + (double)par1EntityLivingBase.getEyeHeight() - 1.100000023841858D - entitysnowball.posY;
double d2 = par1EntityLivingBase.posZ - this.posZ;
float f1 = MathHelper.sqrt(d0 * d0 + d2 * d2) * 0.2F;
entitysnowball.setThrowableHeading(d0, d1 + (double)f1, d2, 1.6F, 12.0F);
entityarrow.setThrowableHeading(d0, d1 + (double)f1, d2, 1.6F, 12.0F);
this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.world.spawnEntity(entityarrow);
this.world.spawnEntity(entitysnowball);
}
示例15: replaceSnowballWithArrow
import net.minecraft.entity.projectile.EntityTippedArrow; //导入依赖的package包/类
@SubscribeEvent
public void replaceSnowballWithArrow(EntityJoinWorldEvent event) {
Entity snowball = event.getEntity();
World world = snowball.worldObj;
if (!(snowball instanceof EntitySnowball)) {
return;
}
if (!world.isRemote) {
EntityTippedArrow arrow = new EntityTippedArrow(world);
arrow.setLocationAndAngles(snowball.posX, snowball.posY, snowball.posZ,
0, 0);
arrow.motionX = snowball.motionX;
arrow.motionY = snowball.motionY;
arrow.motionZ = snowball.motionZ;
// gets arrow out of player's head
// gets the angle of arrow right, in the direction of motion
arrow.posX += arrow.motionX;
arrow.posY += arrow.motionY;
arrow.posZ += arrow.motionZ;
world.spawnEntityInWorld(arrow);
snowball.setDead();
}
}