use of net.minecraft.entity.projectile.EntityArrow in project Galacticraft by micdoodle8.
the class EntitySkeletonBoss method onDeath.
@Override
public void onDeath(DamageSource par1DamageSource) {
super.onDeath(par1DamageSource);
if (par1DamageSource.getSourceOfDamage() instanceof EntityArrow && par1DamageSource.getEntity() instanceof EntityPlayer) {
final EntityPlayer var2 = (EntityPlayer) par1DamageSource.getEntity();
final double var3 = var2.posX - this.posX;
final double var5 = var2.posZ - this.posZ;
if (var3 * var3 + var5 * var5 >= 2500.0D) {
var2.triggerAchievement(AchievementList.snipeSkeleton);
}
}
}
use of net.minecraft.entity.projectile.EntityArrow in project Galacticraft by micdoodle8.
the class EntityEvolvedSkeleton method attackEntityWithRangedAttack.
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) {
EntityArrow entityarrow = new EntityArrow(this.worldObj, this, par1EntityLivingBase, 0.4F, 17 - this.worldObj.getDifficulty().getDifficultyId() * 4);
int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem());
int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem());
entityarrow.setDamage(par2 * 2.0F + this.rand.nextGaussian() * 0.25D + this.worldObj.getDifficulty().getDifficultyId() * 0.11F);
if (i > 0) {
entityarrow.setDamage(entityarrow.getDamage() + i * 0.5D + 0.5D);
}
if (j > 0) {
entityarrow.setKnockbackStrength(j);
}
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0 || this.getSkeletonType() == 1) {
entityarrow.setFire(100);
}
this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(entityarrow);
}
use of net.minecraft.entity.projectile.EntityArrow in project Galacticraft by micdoodle8.
the class EntitySlimeling method attackEntityFrom.
@Override
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) {
if (this.isEntityInvulnerable(par1DamageSource)) {
return false;
} else {
Entity entity = par1DamageSource.getEntity();
this.setSittingAI(false);
if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) {
par2 = (par2 + 1.0F) / 2.0F;
}
return super.attackEntityFrom(par1DamageSource, par2);
}
}
use of net.minecraft.entity.projectile.EntityArrow in project BuildCraft by BuildCraft.
the class PipeItemsObsidian method canSuck.
public boolean canSuck(Entity entity, int distance) {
if (!entity.isEntityAlive()) {
return false;
}
if (entity instanceof EntityItem) {
EntityItem item = (EntityItem) entity;
if (item.getEntityItem().stackSize <= 0) {
return false;
}
long wt = entity.worldObj.getTotalWorldTime();
if (entityDropTime.containsKey(entity) && entityDropTime.get(entity) >= wt) {
return false;
}
return battery.getEnergyStored() >= distance * 10;
} else if (entity instanceof EntityArrow) {
EntityArrow arrow = (EntityArrow) entity;
return arrow.canBePickedUp == 1 && battery.getEnergyStored() >= distance * 10;
}
return false;
}
use of net.minecraft.entity.projectile.EntityArrow in project BuildCraft by BuildCraft.
the class PipeItemsObsidian method pullItemIntoPipe.
public void pullItemIntoPipe(Entity entity, int distance) {
if (container.getWorld().isRemote) {
return;
}
EnumFacing orientation = getOpenOrientation();
if (orientation != null) {
orientation = orientation.getOpposite();
container.getWorld().playSoundAtEntity(entity, "random.pop", 0.2F, ((container.getWorld().rand.nextFloat() - container.getWorld().rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
ItemStack stack;
double speed = 0.01F;
if (entity instanceof EntityItem) {
EntityItem item = (EntityItem) entity;
ItemStack contained = item.getEntityItem();
if (contained == null) {
return;
}
TransportProxy.proxy.obsidianPipePickup(container.getWorld(), item, this.container);
int energyUsed = Math.min(10 * contained.stackSize * distance, battery.getEnergyStored());
if (distance == 0 || energyUsed / distance / 10 == contained.stackSize) {
stack = contained;
CoreProxy.proxy.removeEntity(entity);
} else {
stack = contained.splitStack(energyUsed / distance / 10);
}
battery.useEnergy(energyUsed, energyUsed, false);
speed = Math.sqrt(item.motionX * item.motionX + item.motionY * item.motionY + item.motionZ * item.motionZ);
speed = speed / 2F - 0.05;
if (speed < 0.01) {
speed = 0.01;
}
} else if (entity instanceof EntityArrow && battery.useEnergy(distance * 10, distance * 10, false) > 0) {
stack = new ItemStack(Items.arrow, 1);
CoreProxy.proxy.removeEntity(entity);
} else {
return;
}
if (stack == null) {
return;
}
TravelingItem item = TravelingItem.make(0.5f, stack);
item.setSpeed((float) speed);
transport.injectItem(item, orientation, true);
}
}
Aggregations