當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityType.ARROW屬性代碼示例

本文整理匯總了Java中org.bukkit.entity.EntityType.ARROW屬性的典型用法代碼示例。如果您正苦於以下問題:Java EntityType.ARROW屬性的具體用法?Java EntityType.ARROW怎麽用?Java EntityType.ARROW使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.bukkit.entity.EntityType的用法示例。


在下文中一共展示了EntityType.ARROW屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onProjectileLaunch

/**
 * Launch 2 more arrows when one is launched
 *
 * @param event Event
 */
@EventHandler
public void onProjectileLaunch(ProjectileLaunchEvent event)
{
    if (event.getEntity().getType() != EntityType.ARROW || !(event.getEntity().getShooter() instanceof Player) || event.getEntity().hasMetadata("TAM"))
        return;

    final Vector velocity = event.getEntity().getVelocity();

    for(int i = 0; i < 2; i++)
    {
        this.plugin.getServer().getScheduler().runTaskLater(this.plugin, () ->
        {
            EntityArrow entityArrow = new EntityArrow(((CraftWorld)event.getEntity().getWorld()).getHandle(), ((CraftLivingEntity)event.getEntity().getShooter()).getHandle(), 1F);
            entityArrow.shoot(((CraftLivingEntity)event.getEntity().getShooter()).getHandle().pitch, ((CraftLivingEntity)event.getEntity().getShooter()).getHandle().yaw, 0.0F, 3.0F, 1.0F);
            entityArrow.getBukkitEntity().setMetadata("TAM", new FixedMetadataValue(this.plugin, true));
            entityArrow.getBukkitEntity().setVelocity(velocity);
            ((CraftWorld)event.getEntity().getWorld()).getHandle().addEntity(entityArrow);
        }, 5L * (i + 1));
    }
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:25,代碼來源:ThreeArrowModule.java

示例2: isAllowedSelfDamage

/**
 * Are players allowed to inflict the given damage on themselves?
 * Custom rules can override this.
 */
public static boolean isAllowedSelfDamage(DamageInfo damageInfo) {
    // Disable self-damage with arrows
    if(damageInfo instanceof ProjectileInfo) {
        ProjectileInfo projectileInfo = (ProjectileInfo) damageInfo;
        if(projectileInfo.getProjectile() instanceof EntityInfo &&
           ((EntityInfo) projectileInfo.getProjectile()).getEntityType() == EntityType.ARROW) {
            return false;
        }
    }
    return true;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:15,代碼來源:DamageMatchModule.java

示例3: getType

public EntityType getType() {
    return EntityType.ARROW;
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:3,代碼來源:CraftArrow.java


注:本文中的org.bukkit.entity.EntityType.ARROW屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。