use of com.minecolonies.coremod.items.ItemSpear in project minecolonies by Minecolonies.
the class CombatUtils method createArrowForShooter.
/**
* Get an arrow entity for the given shooter
*
* @param shooter entity
* @return arrow entity
*/
public static AbstractArrowEntity createArrowForShooter(final LivingEntity shooter) {
AbstractArrowEntity arrowEntity = ModEntities.MC_NORMAL_ARROW.create(shooter.level);
arrowEntity.setOwner(shooter);
final ItemStack rangedWeapon = shooter.getItemInHand(Hand.MAIN_HAND);
final Item rangedWeaponItem = rangedWeapon.getItem();
if (rangedWeaponItem instanceof BowItem) {
arrowEntity = ((BowItem) rangedWeaponItem).customArrow(arrowEntity);
} else if (rangedWeaponItem instanceof ItemSpear) {
arrowEntity = ModEntities.SPEAR.create(shooter.level);
} else if (rangedWeaponItem instanceof TridentItem) {
arrowEntity = EntityType.TRIDENT.create(shooter.level);
}
arrowEntity.setPos(shooter.getX(), shooter.getY() + 1, shooter.getZ());
return arrowEntity;
}
use of com.minecolonies.coremod.items.ItemSpear in project minecolonies by ldtteam.
the class CombatUtils method createArrowForShooter.
/**
* Get an arrow entity for the given shooter
*
* @param shooter entity
* @return arrow entity
*/
public static AbstractArrowEntity createArrowForShooter(final LivingEntity shooter) {
AbstractArrowEntity arrowEntity = ModEntities.MC_NORMAL_ARROW.create(shooter.level);
arrowEntity.setOwner(shooter);
final ItemStack rangedWeapon = shooter.getItemInHand(Hand.MAIN_HAND);
final Item rangedWeaponItem = rangedWeapon.getItem();
if (rangedWeaponItem instanceof BowItem) {
arrowEntity = ((BowItem) rangedWeaponItem).customArrow(arrowEntity);
} else if (rangedWeaponItem instanceof ItemSpear) {
arrowEntity = ModEntities.SPEAR.create(shooter.level);
} else if (rangedWeaponItem instanceof TridentItem) {
arrowEntity = EntityType.TRIDENT.create(shooter.level);
}
arrowEntity.setPos(shooter.getX(), shooter.getY() + 1, shooter.getZ());
return arrowEntity;
}
Aggregations