本文整理汇总了Java中org.bukkit.entity.EntityType.SNOWBALL属性的典型用法代码示例。如果您正苦于以下问题:Java EntityType.SNOWBALL属性的具体用法?Java EntityType.SNOWBALL怎么用?Java EntityType.SNOWBALL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.entity.EntityType
的用法示例。
在下文中一共展示了EntityType.SNOWBALL属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onProjectileHit
@EventHandler
public void onProjectileHit(ProjectileHitEvent event)
{
if (event.getEntity().getType() != EntityType.SNOWBALL || !event.getEntity().hasMetadata("paintball-ball") || !event.getEntity().getMetadata("paintball-ball").get(0).asString().equals(this.uuid.toString()))
return;
for (Block block : getNearbyBlocks(event.getEntity().getLocation(), 2))
{
if (block.getType() == Material.AIR || block.getType() == Material.SIGN || block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
continue;
if (this.isBlockGloballyUsed(block.getLocation()))
continue;
SimpleBlock simpleBlock = new SimpleBlock(Material.STAINED_CLAY, DyeColor.values()[new Random().nextInt(DyeColor.values().length)].getWoolData());
this.addBlockToUse(block.getLocation(), simpleBlock);
block.setType(simpleBlock.getType());
block.setData(simpleBlock.getData());
}
event.getEntity().remove();
}
示例2: onProjectileHit
@EventHandler
public void onProjectileHit(ProjectileHitEvent event) {
if (event.getEntityType() != EntityType.FISHING_HOOK &&
event.getEntityType() != EntityType.SNOWBALL &&
event.getEntityType() != EntityType.EGG) return;
ProjectileSource shooter = ((Projectile) event.getEntity()).getShooter();
if (shooter != null && shooter instanceof Player && event.getHitEntity() instanceof Damageable) {
((Damageable) event.getHitEntity()).damage(0.01, (Player) shooter);
}
}
示例3: getType
public EntityType getType() {
return EntityType.SNOWBALL;
}