本文整理汇总了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;
}