Java 类org.bukkit.entity.Fireball 实例源码
项目:SuperiorCraft
文件:LongRangeWeapon.java
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent e) {
if ((e.getDamager() instanceof Arrow) && (((Arrow) e.getDamager()).getShooter() instanceof Player) && e.getDamager().getCustomName() == name) {
e.setDamage(e.getDamage() + damage);
if (effect != null) {
((LivingEntity) e.getEntity()).addPotionEffect(effect);
}
}
if ((e.getDamager() instanceof Fireball) && (((Fireball) e.getDamager()).getShooter() instanceof Player) && e.getDamager().getCustomName() == name) {
e.setDamage(e.getDamage() + damage);
}
if ((e.getDamager() instanceof Snowball) && (((Snowball) e.getDamager()).getShooter() instanceof Player) && e.getDamager().getCustomName() == name) {
e.setDamage(e.getDamage() + damage);
}
}
项目:SuperiorCraft
文件:LongRangeWeapon.java
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent e) {
if ((e.getDamager() instanceof Arrow) && (((Arrow) e.getDamager()).getShooter() instanceof Player) && e.getDamager().getCustomName() == name) {
e.setDamage(e.getDamage() + damage);
if (effect != null) {
((LivingEntity) e.getEntity()).addPotionEffect(effect);
}
}
if ((e.getDamager() instanceof Fireball) && (((Fireball) e.getDamager()).getShooter() instanceof Player) && e.getDamager().getCustomName() == name) {
e.setDamage(e.getDamage() + damage);
}
if ((e.getDamager() instanceof Snowball) && (((Snowball) e.getDamager()).getShooter() instanceof Player) && e.getDamager().getCustomName() == name) {
e.setDamage(e.getDamage() + damage);
}
}
项目:world-of-icerealm
文件:FireDamageModifier.java
@EventHandler(priority = EventPriority.NORMAL)
public void onMonsterDamage(EntityDamageEvent event)
{
if (event instanceof EntityDamageByEntityEvent)
{
EntityDamageByEntityEvent entityDamageByEntityEvent = (EntityDamageByEntityEvent) event;
//logger.info(entityDamageByEntityEvent.getDamager());
if(entityDamageByEntityEvent.getDamager() instanceof Fireball)
{
Fireball fb = (Fireball) entityDamageByEntityEvent.getDamager();
if (fb.getShooter() instanceof Player)
{
if (fb instanceof SmallFireball)
{
entityDamageByEntityEvent.setDamage(entityDamageByEntityEvent.getDamage() * 3);
}
else // Big fireball
{
entityDamageByEntityEvent.setDamage(entityDamageByEntityEvent.getDamage() * 5);
}
}
}
}
}
项目:BlockLocker
文件:BlockDestroyListener.java
@EventHandler(ignoreCancelled = true)
public void onEntityExplodeEvent(EntityExplodeEvent event) {
AttackType attackType = AttackType.UNKNOWN;
Entity attacker = event.getEntity();
if (attacker instanceof TNTPrimed) {
attackType = AttackType.TNT;
} else if (attacker instanceof Creeper) {
attackType = AttackType.CREEPER;
} else if (attacker instanceof Fireball) {
if (((Fireball) attacker).getShooter() instanceof Ghast) {
attackType = AttackType.GHAST;
}
}
if (plugin.getChestSettings().allowDestroyBy(attackType)) {
return;
}
for (Iterator<Block> it = event.blockList().iterator(); it.hasNext();) {
Block block = it.next();
if (isProtected(block)) {
it.remove();
}
}
}
项目:Zephyrus-II
文件:RodOfFire.java
@Override
public void onInteract(PlayerInteractEvent event) {
event.setCancelled(true);
Player player = event.getPlayer();
User user = Zephyrus.getUser(player);
Block block = (Block) user.getTarget(this).getTarget();
int delay = user.getDelay(getInternalName());
if (delay > 0) {
Language.sendError("item.delay", player,
"[SECONDS]", delay + "");
return;
}
if (Zephyrus.getHookManager().canBuild(player, block)) {
if (getLevel(player.getItemInHand().getItemMeta().getLore()) > 5) {
player.launchProjectile(Fireball.class);
} else {
player.launchProjectile(SmallFireball.class);
}
user.setDelay(getName(), levelToDelay(getLevel(player.getItemInHand().getItemMeta().getLore())));
return;
}
Language.sendError("item.rodoffire.failure", player);
}
项目:StarQuestCode
文件:DroneFighter.java
public void fireOnTarget(){
lastFired = System.currentTimeMillis();
Vector target = toTarget();
Vector target2 = target.clone().multiply(5);
//System.out.println("addition: " + target2);
//System.out.println("SOUND");
//myGhast.getWorld().playSound(myGhast.getLocation(), Sound.GHAST_DEATH, 2.0f, (float) (Math.random() * 3.0f));
Location fireLoc = myGhast.getLocation().clone().add(target2);
//System.out.println("fireloc: " + fireLoc);
//Fireball f = (Fireball) myGhast.getWorld().spawnEntity(fireLoc, EntityType.FIREBALL);
//f.setDirection(target);
Projectile proj = myGhast.getWorld().spawn(fireLoc, Fireball.class);
// launchProjectile(this.projectileClass, finalVec);
// finally, set the shooter
proj.setVelocity(target);
Fireball f = (Fireball) proj;
if(myGhast.getWorld().getName().startsWith("Trinitos_")){
f.setIsIncendiary(false);
f.setYield(2.0F);
} else {
f.setIsIncendiary(true);
f.setYield(1.5F);
}
}
项目:xEssentials-deprecated-bukkit
文件:ChunkProtectionEvent.java
@EventHandler
public void onChunkProtect(ChunkLoadEvent e) {
for(Entity entity : e.getChunk().getEntities()) {
if(entity instanceof WitherSkull) {
WitherSkull wither = (WitherSkull) entity;
if(pl.getConfiguration().getDebugConfig().isEnabled()) {
xEssentials.log("removed wither skull at: {" + wither.getWorld().getName() + ", " + wither.getLocation().getBlockX() + ", " + wither.getLocation().getBlockY() + ", " + wither.getLocation().getBlockZ() + "} to prevent lag", LogType.INFO);
}
wither.remove();
} else if(entity instanceof Fireball) {
Fireball fb = (Fireball) entity;
if(pl.getConfiguration().getDebugConfig().isEnabled()) {
xEssentials.log("removed fireball at: {" + fb.getWorld().getName() + ", " + fb.getLocation().getBlockX() + ", " + fb.getLocation().getBlockY() + ", " + fb.getLocation().getBlockZ() + "} to prevent lag", LogType.INFO);
}
fb.remove();
}
}
}
项目:xEssentials-deprecated-bukkit
文件:ChunkProtectionEvent.java
@EventHandler
public void onChunkProtect(ChunkUnloadEvent e) {
for(Entity entity : e.getChunk().getEntities()) {
if(entity instanceof WitherSkull) {
WitherSkull wither = (WitherSkull) entity;
if(pl.getConfiguration().getDebugConfig().isEnabled()) {
xEssentials.log("removed wither skull at: {" + wither.getWorld().getName() + ", " + wither.getLocation().getBlockX() + ", " + wither.getLocation().getBlockY() + ", " + wither.getLocation().getBlockZ() + "} to prevent lag", LogType.INFO);
}
wither.remove();
} else if(entity instanceof Fireball) {
Fireball fb = (Fireball) entity;
if(pl.getConfiguration().getDebugConfig().isEnabled()) {
xEssentials.log("removed fireball at: {" + fb.getWorld().getName() + ", " + fb.getLocation().getBlockX() + ", " + fb.getLocation().getBlockY() + ", " + fb.getLocation().getBlockZ() + "} to prevent lag", LogType.INFO);
}
fb.remove();
}
}
}
项目:AddGun
文件:Bullet.java
/**
* Based on the parameters in this bullet, configure some stuff.
*
* @param bullet the newly minted projectile
* @param world the world it inhabits
* @param shooter who shot it
* @param velocity The gun's intrinsic velocity. Might be ignored.
*/
public void configureBullet(Projectile bullet, World world, ProjectileSource shooter, Vector velocity) {
bullet.setVelocity(velocity);
bullet.setFireTicks(this.fireTicks);
if (bullet instanceof Fireball) {
((Fireball) bullet).setIsIncendiary(Math.random() < this.fireChance);
}
}
项目:ArchersBattle
文件:FireBall.java
@Override
public void launch(Player p, Vector vector) {
Fireball fb = p.launchProjectile(Fireball.class);
if (vector == null) {
fb.setVelocity(p.getEyeLocation().getDirection().multiply(2));
} else {
fb.setVelocity(vector.multiply(2));
}
fb.setMetadata("skill_type", new FixedMetadataValue(Main.getInstance(), getName()));
CooldownManager.getInstance().add(p);
}
项目:ArchersBattle
文件:FireBall.java
@Override
public void launchList(Player p, List<Vector> vectors) {
p.sendMessage(String.valueOf(vectors.size()));
for(Vector v:vectors){
Fireball fb = p.launchProjectile(Fireball.class);
fb.setDirection(v.multiply(2));
fb.setMetadata("skill_type", new FixedMetadataValue(Main.getInstance(), getName()));
}
CooldownManager.getInstance().add(p);
}
项目:Recreator
文件:ItemRedstoneCannon.java
@Override
public void run(PlayerInteractEvent evt) {
Player player = evt.getPlayer();
if (CooldownTicker.can(this, player) || evt.getItem().getItemMeta().getLore().contains("§6高速射击")) {
Inventory inv = player.getInventory();
if (!inv.contains(Material.SULPHUR)) {
AzureAPI.log(player, "你没有弹药! 需要 " + ChatColor.RED + "火药" + ChatColor.GOLD + " 作为弹药");
AzureAPI.playSound(player, Sound.ENTITY_ITEM_BREAK);
return;
}
int slot = inv.first(Material.SULPHUR);
ItemStack ammo = inv.getItem(slot);
int amount = ammo.getAmount();
if (amount > 1) {
ammo.setAmount(amount - 1);
inv.setItem(slot, ammo);
} else {
inv.setItem(slot, null);
}
Location eye = player.getEyeLocation();
Vector direction = eye.getDirection().multiply(2);
Projectile projectile = player.getWorld().spawn(eye.add(direction), Fireball.class);
projectile.setShooter(player);
projectile.setVelocity(direction);
AzureAPI.playSound(player, Sound.ITEM_FIRECHARGE_USE, true);
CooldownTicker.cooldown(this, player, TimeUnit.SECONDS, 3);
} else {
AzureAPI.playSound(player, Sound.UI_BUTTON_CLICK);
AzureAPI.log(player, "冷却时间还没有结束呢!");
}
}
项目:AsgardAscension
文件:PlayerListener.java
@EventHandler
public void onExplosionPrime(ExplosionPrimeEvent event) {
event.setFire(false);
if (event.getEntity() instanceof Fireball && event.getEntity().hasMetadata("ultimate")){
event.setRadius(0);
}
}
项目:Damocles
文件:MeteorShowerSpell.java
public void cast(Player source) {
Account account = new Account(source);
Character character = account.getLoadedCharacter();
if(character.getMana() < getCost()){
return;
}
character.setMana(character.getMana() - getCost());
World world = source.getWorld();
Location loc = source.getLocation();
new BukkitRunnable(){
int count = 0;
public void run(){
boolean d = false;
for(int i = 0; i < 6; i++){
int x = new Random().nextInt(getRange());
int z = new Random().nextInt(getRange());
if(d)
x = x*-1;
if(!d)
z = z*-1;
d = !d;
loc.add(x, 30, z);
Fireball ball = (Fireball)world.spawnEntity(loc, EntityType.FIREBALL);
loc.subtract(x, 30, z);
ball.setDirection(new Vector(0, -0.3, 0));
ball.setYield(2);
}
count++;
if(count > overSeconds())
this.cancel();
}
}.runTaskTimer(Cardinal.getPlugin(), 0, 20);
}
项目:world-of-icerealm
文件:BigFireballMagic.java
public void executeMagic(Player player)
{
Fireball fb = player.launchProjectile(Fireball.class);
fb.setIsIncendiary(true);
fb.setBounce(false);
fb.setShooter(player);
// fb.setVelocity(new Vector(1.0,0,0));
}
项目:Breakpoint
文件:AbilityManager.java
public static Fireball launchFireball(Player owner, Location loc, Vector vec)
{
World world = loc.getWorld();
Fireball fb = (Fireball) world.spawnEntity(loc.add(vec), EntityType.FIREBALL);
fb.setShooter(owner);
fb.setVelocity(vec.multiply(2.0));
world.playSound(loc, Sound.WITHER_SHOOT, 1F, 1F);
return fb;
}
项目:Breakpoint
文件:AbilityManager.java
public static Fireball launchSmallFireball(Player owner, Location loc, Vector vec)
{
World world = loc.getWorld();
Fireball fb = (Fireball) world.spawnEntity(loc.add(vec), EntityType.SMALL_FIREBALL);
fb.setShooter(owner);
fb.setVelocity(vec.multiply(2.0));
world.playSound(loc, Sound.GHAST_FIREBALL, 1F, 2F);
return fb;
}
项目:Breakpoint
文件:AbilityManager.java
public static Fireball launchFireball(Player owner, Location loc, Vector vec)
{
World world = loc.getWorld();
Fireball fb = (Fireball) world.spawnEntity(loc.add(vec), EntityType.FIREBALL);
fb.setShooter(owner);
fb.setVelocity(vec.multiply(2.0));
world.playSound(loc, Sound.WITHER_SHOOT, 1F, 1F);
return fb;
}
项目:Breakpoint
文件:AbilityManager.java
public static Fireball launchSmallFireball(Player owner, Location loc, Vector vec)
{
World world = loc.getWorld();
Fireball fb = (Fireball) world.spawnEntity(loc.add(vec), EntityType.SMALL_FIREBALL);
fb.setShooter(owner);
fb.setVelocity(vec.multiply(2.0));
world.playSound(loc, Sound.GHAST_FIREBALL, 1F, 2F);
return fb;
}
项目:uSkyBlock
文件:NetherTerraFormEvents.java
@EventHandler
public void onGhastExplode(EntityExplodeEvent event) {
if (event == null || event.getEntity() == null || !plugin.isSkyNether(event.getEntity().getWorld())) {
return; // Bail out, not our problem
}
// TODO: 23/09/2015 - R4zorax: Perhaps enable this when island has a certain level?
if (event.getEntity() instanceof Fireball) {
Fireball fireball = (Fireball) event.getEntity();
fireball.setIsIncendiary(false);
fireball.setFireTicks(0);
event.setCancelled(true);
}
}
项目:civcraft
文件:BlockListener.java
@EventHandler(priority = EventPriority.NORMAL)
public void onProjectileHitEvent(ProjectileHitEvent event) {
if (event.getEntity() instanceof Arrow) {
ArrowFiredCache afc = CivCache.arrowsFired.get(event.getEntity().getUniqueId());
if (afc != null) {
afc.setHit(true);
}
}
if (event.getEntity() instanceof Fireball) {
CannonFiredCache cfc = CivCache.cannonBallsFired.get(event.getEntity().getUniqueId());
if (cfc != null) {
cfc.setHit(true);
FireworkEffect fe = FireworkEffect.builder().withColor(Color.RED).withColor(Color.BLACK).flicker(true).with(Type.BURST).build();
Random rand = new Random();
int spread = 30;
for (int i = 0; i < 15; i++) {
int x = rand.nextInt(spread) - spread/2;
int y = rand.nextInt(spread) - spread/2;
int z = rand.nextInt(spread) - spread/2;
Location loc = event.getEntity().getLocation();
Location location = new Location(loc.getWorld(), loc.getX(),loc.getY(), loc.getZ());
location.add(x, y, z);
TaskMaster.syncTask(new FireWorkTask(fe, loc.getWorld(), loc, 5), rand.nextInt(30));
}
}
}
}
项目:civcraft
文件:CannonFiredCache.java
public CannonFiredCache(CannonTower fromTower, Location target, Fireball fireball) {
this.fromTower = fromTower;
this.target = target;
this.fireball = fireball;
this.uuid = fireball.getUniqueId();
expired = Calendar.getInstance();
expired.set(Calendar.SECOND, 30);
}
项目:MCPBukkit
文件:CraftLivingEntity.java
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile) {
net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
net.minecraft.entity.Entity launch = null;
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
} else if (Arrow.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
} else if (Fireball.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
Vector direction = location.getDirection().multiply(10);
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else {
launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
}
launch.func_70012_b(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
Validate.notNull(launch, "Projectile not supported");
world.func_72838_d(launch);
return (T) launch.getBukkitEntity();
}
项目:Uranium
文件:CraftLivingEntity.java
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
net.minecraft.entity.Entity launch = null;
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
} else if (Arrow.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityPotion(world, getHandle(), CraftItemStack.asNMSCopy(new ItemStack(Material.POTION, 1)));
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityExpBottle(world, getHandle());
} else if (Fish.class.isAssignableFrom(projectile) && getHandle() instanceof net.minecraft.entity.player.EntityPlayer) {
launch = new net.minecraft.entity.projectile.EntityFishHook(world, (net.minecraft.entity.player.EntityPlayer) getHandle());
} else if (Fireball.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
Vector direction = location.getDirection().multiply(10);
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else {
launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
}
((net.minecraft.entity.projectile.EntityFireball) launch).projectileSource = this;
launch.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
Validate.notNull(launch, "Projectile not supported");
if (velocity != null) {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}
world.spawnEntityInWorld(launch);
return (T) launch.getBukkitEntity();
}
项目:GlowNPC
文件:GlowNPC.java
@Override
public void damage(double amount, Entity source, DamageCause cause) {
// fire resistance
if (cause != null && hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) {
switch (cause) {
case PROJECTILE:
if (!(source instanceof Fireball)) {
break;
}
case FIRE:
case FIRE_TICK:
case LAVA:
return;
}
}
// armor damage protection
// formula source:
// http://minecraft.gamepedia.com/Armor#Damage_Protection
double defensePoints = getAttributeManager().getPropertyValue(Key.KEY_ARMOR);
double toughness = getAttributeManager().getPropertyValue(Key.KEY_ARMOR_TOUGHNESS);
amount = amount * (1
- Math.min(20.0, Math.max(defensePoints / 5.0, defensePoints - amount / (2.0 + toughness / 4.0))) / 25);
// fire event
NPCDamageEvent event;
if (source == null) {
event = new NPCDamageEvent(this, cause, amount);
} else {
event = new NPCDamageByEntityEvent(this, cause, amount, source);
}
if (!event.callEvent()) {
return;
}
// apply damage
amount = event.getFinalDamage();
setLastDamage(amount);
setHealth(health - amount);
playEffect(EntityEffect.HURT);
// play sounds, handle death
if (health > 0) {
Sound hurtSound = getHurtSound();
if (hurtSound != null && !isSilent()) {
world.playSound(location, hurtSound, getSoundVolume(), getSoundPitch());
}
}
setLastDamager(source);
}
项目:ThermosRebased
文件:CraftLivingEntity.java
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
net.minecraft.entity.Entity launch = null;
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
} else if (Arrow.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityPotion(world, getHandle(), CraftItemStack.asNMSCopy(new ItemStack(Material.POTION, 1)));
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityExpBottle(world, getHandle());
} else if (Fish.class.isAssignableFrom(projectile) && getHandle() instanceof net.minecraft.entity.player.EntityPlayer) {
launch = new net.minecraft.entity.projectile.EntityFishHook(world, (net.minecraft.entity.player.EntityPlayer) getHandle());
} else if (Fireball.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
Vector direction = location.getDirection().multiply(10);
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else {
launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
}
((net.minecraft.entity.projectile.EntityFireball) launch).projectileSource = this;
launch.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
Validate.notNull(launch, "Projectile not supported");
if (velocity != null) {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}
world.spawnEntityInWorld(launch);
return (T) launch.getBukkitEntity();
}
项目:Breakpoint
文件:AbilityManager.java
public static void fireballHit(Fireball fb)
{
Location loc = fb.getLocation();
showCracks(loc, 2);
smoke(loc, 16);
}
项目:Thermos
文件:CraftLivingEntity.java
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
net.minecraft.entity.Entity launch = null;
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
} else if (Arrow.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityPotion(world, getHandle(), CraftItemStack.asNMSCopy(new ItemStack(Material.POTION, 1)));
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityExpBottle(world, getHandle());
} else if (Fish.class.isAssignableFrom(projectile) && getHandle() instanceof net.minecraft.entity.player.EntityPlayer) {
launch = new net.minecraft.entity.projectile.EntityFishHook(world, (net.minecraft.entity.player.EntityPlayer) getHandle());
} else if (Fireball.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
Vector direction = location.getDirection().multiply(10);
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else {
launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
}
((net.minecraft.entity.projectile.EntityFireball) launch).projectileSource = this;
launch.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
Validate.notNull(launch, "Projectile not supported");
if (velocity != null) {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}
world.spawnEntityInWorld(launch);
return (T) launch.getBukkitEntity();
}
项目:KCauldron
文件:CraftLivingEntity.java
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
net.minecraft.entity.Entity launch = null;
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
} else if (Arrow.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityPotion(world, getHandle(), CraftItemStack.asNMSCopy(new ItemStack(Material.POTION, 1)));
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityExpBottle(world, getHandle());
} else if (Fish.class.isAssignableFrom(projectile) && getHandle() instanceof net.minecraft.entity.player.EntityPlayer) {
launch = new net.minecraft.entity.projectile.EntityFishHook(world, (net.minecraft.entity.player.EntityPlayer) getHandle());
} else if (Fireball.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
Vector direction = location.getDirection().multiply(10);
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else {
launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
}
((net.minecraft.entity.projectile.EntityFireball) launch).projectileSource = this;
launch.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
Validate.notNull(launch, "Projectile not supported");
if (velocity != null) {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}
world.spawnEntityInWorld(launch);
return (T) launch.getBukkitEntity();
}
项目:CauldronGit
文件:CraftLivingEntity.java
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
net.minecraft.entity.Entity launch = null;
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
} else if (Arrow.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityPotion(world, getHandle(), CraftItemStack.asNMSCopy(new ItemStack(Material.POTION, 1)));
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityExpBottle(world, getHandle());
} else if (Fish.class.isAssignableFrom(projectile) && getHandle() instanceof net.minecraft.entity.player.EntityPlayer) {
launch = new net.minecraft.entity.projectile.EntityFishHook(world, (net.minecraft.entity.player.EntityPlayer) getHandle());
} else if (Fireball.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
Vector direction = location.getDirection().multiply(10);
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else {
launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
}
((net.minecraft.entity.projectile.EntityFireball) launch).projectileSource = this;
launch.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
Validate.notNull(launch, "Projectile not supported");
if (velocity != null) {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}
world.spawnEntityInWorld(launch);
return (T) launch.getBukkitEntity();
}
项目:Cauldron-Old
文件:CraftLivingEntity.java
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
net.minecraft.entity.Entity launch = null;
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
} else if (Arrow.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityPotion(world, getHandle(), CraftItemStack.asNMSCopy(new ItemStack(Material.POTION, 1)));
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityExpBottle(world, getHandle());
} else if (Fish.class.isAssignableFrom(projectile) && getHandle() instanceof net.minecraft.entity.player.EntityPlayer) {
launch = new net.minecraft.entity.projectile.EntityFishHook(world, (net.minecraft.entity.player.EntityPlayer) getHandle());
} else if (Fireball.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
Vector direction = location.getDirection().multiply(10);
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else {
launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
}
((net.minecraft.entity.projectile.EntityFireball) launch).projectileSource = this;
launch.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
Validate.notNull(launch, "Projectile not supported");
if (velocity != null) {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}
world.spawnEntityInWorld(launch);
return (T) launch.getBukkitEntity();
}
项目:Cauldron-Reloaded
文件:CraftLivingEntity.java
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
net.minecraft.entity.Entity launch = null;
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
} else if (Arrow.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityPotion(world, getHandle(), CraftItemStack.asNMSCopy(new ItemStack(Material.POTION, 1)));
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityExpBottle(world, getHandle());
} else if (Fish.class.isAssignableFrom(projectile) && getHandle() instanceof net.minecraft.entity.player.EntityPlayer) {
launch = new net.minecraft.entity.projectile.EntityFishHook(world, (net.minecraft.entity.player.EntityPlayer) getHandle());
} else if (Fireball.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
Vector direction = location.getDirection().multiply(10);
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else {
launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
}
((net.minecraft.entity.projectile.EntityFireball) launch).projectileSource = this;
launch.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
Validate.notNull(launch, "Projectile not supported");
if (velocity != null) {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}
world.spawnEntityInWorld(launch);
return (T) launch.getBukkitEntity();
}
项目:Zephyr
文件:FirechargeSpell.java
@Override
public CastResult cast(SpellContext context) {
context.<Player>getPlayer().launchProjectile(Fireball.class);
return CastResult.SUCCESS;
}
项目:FFoKC
文件:CraftLivingEntity.java
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
net.minecraft.entity.Entity launch = null;
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
} else if (Arrow.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityPotion(world, getHandle(), CraftItemStack.asNMSCopy(new ItemStack(Material.POTION, 1)));
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityExpBottle(world, getHandle());
} else if (Fish.class.isAssignableFrom(projectile) && getHandle() instanceof net.minecraft.entity.player.EntityPlayer) {
launch = new net.minecraft.entity.projectile.EntityFishHook(world, (net.minecraft.entity.player.EntityPlayer) getHandle());
} else if (Fireball.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
Vector direction = location.getDirection().multiply(10);
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else {
launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
}
((net.minecraft.entity.projectile.EntityFireball) launch).projectileSource = this;
launch.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
Validate.notNull(launch, "Projectile not supported");
if (velocity != null) {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}
world.spawnEntityInWorld(launch);
return (T) launch.getBukkitEntity();
}
项目:Breakpoint
文件:AbilityManager.java
public static void fireballHit(Fireball fb)
{
Location loc = fb.getLocation();
showCracks(loc, 2);
smoke(loc, 16);
}
项目:civcraft
文件:CannonFiredCache.java
public Fireball getFireball() {
return fireball;
}
项目:civcraft
文件:CannonFiredCache.java
public void setFireball(Fireball fireball) {
this.fireball = fireball;
}
项目:Zephyrus-II
文件:FlareSpell.java
@Override
public CastResult onCast(User user, int power, String[] args) {
user.getPlayer().launchProjectile(Fireball.class);
return CastResult.SUCCESS;
}
项目:Cauldron
文件:CraftLivingEntity.java
@SuppressWarnings("unchecked")
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
net.minecraft.world.World world = ((CraftWorld) getWorld()).getHandle();
net.minecraft.entity.Entity launch = null;
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySnowball(world, getHandle());
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityEgg(world, getHandle());
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityEnderPearl(world, getHandle());
} else if (Arrow.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityArrow(world, getHandle(), 1);
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityPotion(world, getHandle(), CraftItemStack.asNMSCopy(new ItemStack(Material.POTION, 1)));
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.item.EntityExpBottle(world, getHandle());
} else if (Fish.class.isAssignableFrom(projectile) && getHandle() instanceof net.minecraft.entity.player.EntityPlayer) {
launch = new net.minecraft.entity.projectile.EntityFishHook(world, (net.minecraft.entity.player.EntityPlayer) getHandle());
} else if (Fireball.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
Vector direction = location.getDirection().multiply(10);
if (SmallFireball.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntitySmallFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else if (WitherSkull.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.entity.projectile.EntityWitherSkull(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else {
launch = new net.minecraft.entity.projectile.EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
}
((net.minecraft.entity.projectile.EntityFireball) launch).projectileSource = this;
launch.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
Validate.notNull(launch, "Projectile not supported");
if (velocity != null) {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}
world.spawnEntityInWorld(launch);
return (T) launch.getBukkitEntity();
}
项目:modules-extra
文件:ListenerBlockIgnite.java
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onIgnite(BlockIgniteEvent event)
{
BlockState oldState = event.getBlock().getState();
ActionBlock action;
switch (event.getCause())
{
case FIREBALL:
action = this.newAction(IgniteFireball.class, oldState.getWorld());
if (action != null)
{
ProjectileSource shooter = ((Fireball)event.getIgnitingEntity()).getShooter();
if (shooter instanceof Entity)
{
((IgniteFireball)action).setShooter((Entity)shooter);
if (shooter instanceof Ghast)
{
LivingEntity target = BukkitUtils.getTarget((Ghast)shooter);
if (target instanceof Player)
{
((IgniteFireball)action).setPlayer((Player)target);
}
}
else if (shooter instanceof Player)
{
((IgniteFireball)action).setPlayer((Player)shooter);
}
}
}
break;
case LAVA:
action = this.newAction(IgniteLava.class, oldState.getWorld());
if (action != null)
{
((IgniteLava)action).setSource(event.getIgnitingBlock().getLocation());
}
break;
case LIGHTNING:
action = this.newAction(IgniteLightning.class, oldState.getWorld());
break;
case FLINT_AND_STEEL:
action = this.newAction(IgniteLighter.class, oldState.getWorld());
if (action != null && event.getPlayer() != null)
{
((IgniteLighter)action).setPlayer(event.getPlayer());
}
break;
case ENDER_CRYSTAL:
case EXPLOSION:
action = this.newAction(IgniteOther.class, oldState.getWorld());
break;
case SPREAD:
return;
default:
this.module.getLog().warn("Unknown IgniteCause! {}", event.getCause().name());
return;
}
if (action != null)
{
action.setOldBlock(oldState);
action.setNewBlock(FIRE);
action.setLocation(oldState.getLocation());
this.logAction(action);
}
}