本文整理匯總了Java中org.bukkit.entity.FallingBlock.setGravity方法的典型用法代碼示例。如果您正苦於以下問題:Java FallingBlock.setGravity方法的具體用法?Java FallingBlock.setGravity怎麽用?Java FallingBlock.setGravity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.entity.FallingBlock
的用法示例。
在下文中一共展示了FallingBlock.setGravity方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fireCannon
import org.bukkit.entity.FallingBlock; //導入方法依賴的package包/類
private void fireCannon(Location cannon, Location target) {
FallingBlock entity = cannon.getWorld().spawnFallingBlock(cannon, new MaterialData(Material.COAL_BLOCK));
this.playParticles(entity.getLocation());
entity.setGravity(true);
entity.setDropItem(false);
entity.setHurtEntities(false);
entity.setInvulnerable(true);
this.moveToward(entity, target, 2D);
new BukkitRunnable() {
public void run() {
if(entity.isDead()) {
this.cancel();
} else {
entity.setTicksLived(1);
}
}
}.runTaskTimer(this.getAPI().getPlugin(), 0, 20L);
totalCannonShots++;
}
示例2: spawnPoint
import org.bukkit.entity.FallingBlock; //導入方法依賴的package包/類
private void spawnPoint() {
final Location spawnLocation = spawnLocations.get(new Random().nextInt(spawnLocations.size()));
for(Map.Entry<Location, Object[]> entry : this.currentLocations.entrySet()) {
if(spawnLocation.distance(entry.getKey()) >= 1D) continue;
return;
}
PointType pointType = PointType.fetch();
FallingBlock entity = spawnLocation.getWorld().spawnFallingBlock(spawnLocation, pointType.getMaterialData());
entity.setGravity(false);
entity.setDropItem(false);
entity.setHurtEntities(false);
entity.setInvulnerable(true);
entity.setCustomName(pointType.getTranslation());
entity.setCustomNameVisible(true);
new BukkitRunnable() {
public void run() {
if(entity.isDead()) {
this.cancel();
} else {
entity.setTicksLived(1);
entity.teleport(spawnLocation);
}
}
}.runTaskTimer(this.getAPI().getPlugin(), 0, 20L);
this.currentLocations.put(spawnLocation, new Object[]{pointType, entity});
}