本文整理汇总了Java中org.bukkit.Material.isTransparent方法的典型用法代码示例。如果您正苦于以下问题:Java Material.isTransparent方法的具体用法?Java Material.isTransparent怎么用?Java Material.isTransparent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.isTransparent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRun
import org.bukkit.Material; //导入方法依赖的package包/类
@Override
public void onRun()
{
// Prevents an excess of particles
if (last != null && last.getX() == getEntity().getLocation().getX() && last.getZ() == getEntity().getLocation().getZ())
return;
last = getEntity().getLocation();
Block block = this.getEntity().getLocation().add(0, -0.4, 0).getBlock();
Material type = block.getType();
// If the step should be displayed or not
if (type.isBlock() && type.isSolid() && !type.isTransparent()) {
Location loc = getEntity().getLocation();
loc.setY(block.getY());
loc = loc.add(0, 1 + Math.random() / 100, 0);
Vector dir = VectorUtils.rotateAroundAxisY(getEntity().getLocation().getDirection().setY(0).normalize(), p ? 90 : -90).multiply(0.25);
display(ParticleEffect.FOOTSTEP, loc.add(dir.getX(), 0, dir.getZ()), 7, 0);
p = !p;
}
}
示例2: gunBulletHitGroundEvent
import org.bukkit.Material; //导入方法依赖的package包/类
/**
* It hit the ground maybe!
*
* @param event the impact event, we ignore any that aren't just blockhits
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void gunBulletHitGroundEvent(ProjectileHitEvent event) {
if (!(event.getEntity() instanceof Projectile)) return;
if (event.getHitBlock() == null) return;
Projectile bullet = (Projectile) event.getEntity();
StandardGun gun = bulletToGunMap.get(bullet.getName());
if (gun == null) return; // not a bullet from a gun.
Location begin = this.travelPaths.remove(bullet.getUniqueId());
Bullet bulletType = this.inFlightBullets.remove(bullet.getUniqueId());
if (begin == null || bulletType == null) {
AddGun.getPlugin().debug("Warning: bullet {1} claiming to be {0} but untracked -- from unloaded chunk?", gun.getBulletTag(), bullet.getUniqueId());
//bullet.remove();
return;
}
if (!bullet.getType().equals(bulletType.getEntityType())) {
AddGun.getPlugin().debug("Bullet {1} matching {0} but has different type?!", bulletType.getName(), bullet.getUniqueId());
//bullet.remove();
return;
}
Material block = event.getHitBlock().getType();
if (!block.isSolid() && block.isTransparent()) {
if (Material.LAVA.equals(block) || Material.STATIONARY_LAVA.equals(block)) {
// lava, it dies.
} else {
// respawn it
/*Location newBegin = event.getHitBlock().getLocation().clone();
if (hit instanceof Damageable) {
Damageable dhit = (Damageable) hit;
newBegin.add(bullet.getVelocity().normalize().multiply(dhit.getWidth() * 2));
} else {
newBegin.add(bullet.getVelocity().normalize().multiply(1.42)); // diagonalize!
}
AddGun.getPlugin().debug(" Just Missed at location {0}, spawning continue at {1} with velocity {2}",
end, newBegin, bullet.getVelocity());
Projectile continueBullet = gun.shoot(newBegin, bulletType, bullet.getShooter(), bullet.getVelocity(), true);
gun.postMiss(whereEnd, hit, bullet, continueBullet, bulletType);
*/
}
}
Location end = event.getHitBlock().getLocation().clone().add(0.5, 0.5, 0.5);
AddGun.getPlugin().debug("Warning: bullet {1} of {0} hit ground {2}", gun.getBulletTag(), bullet.getUniqueId(), end);
//gun.flightPath(begin, end, bulletType, true);
gun.postHit(new HitDigest(HitPart.MISS, end), null, bullet, bulletType );
//bullet.remove();
return;
}
示例3: isSafe
import org.bukkit.Material; //导入方法依赖的package包/类
public static boolean isSafe(Material material) {
return !(material == Material.CACTUS || material.isTransparent()) && material.isSolid();
}