本文整理匯總了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));
}
}
示例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;
}
示例3: getType
public EntityType getType() {
return EntityType.ARROW;
}