当前位置: 首页>>代码示例>>Java>>正文


Java Material.isTransparent方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:23,代码来源:StepEffect.java

示例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;
	}
 
开发者ID:ProgrammerDan,项目名称:AddGun,代码行数:65,代码来源:Guns.java

示例3: isSafe

import org.bukkit.Material; //导入方法依赖的package包/类
public static boolean isSafe(Material material) {
    return !(material == Material.CACTUS || material.isTransparent()) && material.isSolid();
}
 
开发者ID:Project-Coalesce,项目名称:UHC,代码行数:4,代码来源:Blocks.java


注:本文中的org.bukkit.Material.isTransparent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。