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


Java WitherSkull类代码示例

本文整理汇总了Java中org.bukkit.entity.WitherSkull的典型用法代码示例。如果您正苦于以下问题:Java WitherSkull类的具体用法?Java WitherSkull怎么用?Java WitherSkull使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WitherSkull类属于org.bukkit.entity包,在下文中一共展示了WitherSkull类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compare

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@Override
public Relation compare(final EntityData e, final ItemType i) {
	if (e instanceof Item)
		return Relation.get(i.isOfType(((Item) e).getItemStack()));
	if (e instanceof ThrownPotion)
		return Relation.get(i.isOfType(Material.POTION.getId(), PotionEffectUtils.guessData((ThrownPotion) e)));
	if (Skript.classExists("org.bukkit.entity.WitherSkull") && e instanceof WitherSkull)
		return Relation.get(i.isOfType(Material.SKULL_ITEM.getId(), (short) 1));
	if (entityMaterials.containsKey(e.getType()))
		return Relation.get(i.isOfType(entityMaterials.get(e.getType()).getId(), (short) 0));
	for (final Entry<Class<? extends Entity>, Material> m : entityMaterials.entrySet()) {
		if (m.getKey().isAssignableFrom(e.getType()))
			return Relation.get(i.isOfType(m.getValue().getId(), (short) 0));
	}
	return Relation.NOT_EQUAL;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:17,代码来源:DefaultComparators.java

示例2: onEntityDamageByEntityEvent

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@EventHandler
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent e){
    if(e.getEntity() instanceof WitherSkull)
    {
        if(e.getCause() == EntityDamageEvent.DamageCause.PROJECTILE)
        {
            if (e.getDamager() instanceof WitherSkull)
            {
                if (e.getEntity() instanceof Player)
                {
                    e.setDamage(20.0);
                }
            }
        }
    }
}
 
开发者ID:Khillynn,项目名称:RandomStuff,代码行数:17,代码来源:Quake.java

示例3: onChunkProtect

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@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();
		}
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:19,代码来源:ChunkProtectionEvent.java

示例4: onWitherSkullExplosion

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@EventHandler
public void onWitherSkullExplosion(EntityDamageByEntityEvent e) {
    if (!witherEnabled || e == null || !(e.getEntity() instanceof WitherSkull) || !plugin.isSkyAssociatedWorld(e.getEntity().getWorld())) {
        return;
    }
    // Find owner
    ProjectileSource shooter = ((WitherSkull) e.getEntity()).getShooter();
    if (shooter instanceof Wither) {
        handleWitherRampage(e, (Wither) shooter, e.getDamager().getLocation());
    }
}
 
开发者ID:rlf,项目名称:uSkyBlock,代码行数:12,代码来源:GriefEvents.java

示例5: onCast

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@Override
public CastResult onCast(User user, int power, String[] args) {
	Player player = user.getPlayer();
	player.launchProjectile(WitherSkull.class);
	player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 1.0F, 0F);
	return CastResult.SUCCESS;
}
 
开发者ID:mcardy,项目名称:Zephyrus-II,代码行数:8,代码来源:GrenadeSpell.java

示例6: onInteract

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@EventHandler
public void onInteract(PlayerInteractEvent e) {
    Location loc = e.getPlayer().getLocation();

    if(e.getAction() == Action.RIGHT_CLICK_AIR) {
        if(e.getPlayer().getItemInHand().getType() == Material.WOOD_HOE) {
            WitherSkull bullet = (WitherSkull) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation(), EntityType.WITHER_SKULL);
            bullet.setVelocity(e.getPlayer().getLocation().getDirection().multiply(1.5));
            bullet.getWorld().playEffect(loc, Effect.SMOKE, 0, 50);
            e.getPlayer().playSound(loc, Sound.GHAST_FIREBALL, 100, 0);
        }
    }
}
 
开发者ID:Khillynn,项目名称:RandomStuff,代码行数:14,代码来源:Quake.java

示例7: doOnRightClick

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@Override
public void doOnRightClick(Racer racer, Action action)
{
    racer.getPlayer().sendMessage(getMessage());
    Location loc = racer.getPlayer().getEyeLocation();
    WitherSkull skull = (WitherSkull) loc.getWorld().spawnEntity(loc, EntityType.WITHER_SKULL);
    skull.setShooter(racer.getPlayer());
    skull.setVelocity(loc.getDirection().multiply(EquestrianDash.plugin.getConfig().getDouble("Powerups.Wither.SpeedMultiplier")));
    racer.getPlayer().getInventory().clear();
}
 
开发者ID:ColonelHedgehog,项目名称:Equestrian-Dash,代码行数:11,代码来源:WitherPowerup.java

示例8: onExplode

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@EventHandler
public void onExplode(final EntityExplodeEvent event)
{
    final Entity e = event.getEntity();
    //e.getServer().broadcastMessage("Exploded me!");
    event.blockList().clear();
    try
    {
        ItemBox ib = plugin.getItemBoxRegistry().getByLocation(e.getLocation());
        if (ib != null)
        {
            ib.respawn();
            event.setCancelled(true);
        }
        else if (event.getEntity() instanceof WitherSkull)
        {
            WitherSkull w = (WitherSkull) event.getEntity();
            if (w.isCharged())
            {
                w.getWorld().strikeLightning(w.getLocation());
            }
        }
    }
    catch(Exception ex)
    {
        // PLEASE DON'T KILL ME, JAVA GODS, I CAN'T FIGURE OUT WHY IT'S CRASHING. :(
    }
}
 
开发者ID:ColonelHedgehog,项目名称:Equestrian-Dash,代码行数:29,代码来源:EntityExplodeListener.java

示例9: disableExplosionWithers

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@EventHandler
public void disableExplosionWithers(EntityExplodeEvent e) {
	if(e.getEntity() instanceof WitherSkull) {
		e.setCancelled(true);
	} else if(e.getEntity() instanceof Wither) {
		e.setCancelled(true);
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:9,代码来源:DisableWitherGriefEvent.java

示例10: launchProjectile

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@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();
}
 
开发者ID:agaricusb,项目名称:MCPBukkit,代码行数:34,代码来源:CraftLivingEntity.java

示例11: run

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@Override
public boolean run(Player player, String[] args, int power) {
	if (blockBreak(player)) {
		return false;
	}
	player.launchProjectile(WitherSkull.class);
	Effects.playEffect(Sound.WITHER_SHOOT, player.getLocation());
	return true;
}
 
开发者ID:mcardy,项目名称:Zephyrus,代码行数:10,代码来源:Grenade.java

示例12: launchProjectile

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@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();
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:45,代码来源:CraftLivingEntity.java

示例13: getBukkitEntity

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@Override
public WitherSkull getBukkitEntity() {
    return getCraftBukkitEntity();
}
 
开发者ID:ase34,项目名称:flyingblocksapi,代码行数:5,代码来源:NativeFlyingBlockHandler.java

示例14: disableExplosionWithers

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@EventHandler
public void disableExplosionWithers(EntityExplodeEvent e) {
	if(e.getEntity() instanceof WitherSkull) {
		e.setCancelled(true);
	}
}
 
开发者ID:xize,项目名称:xEssentials_old_Source,代码行数:7,代码来源:witherGrief.java

示例15: onShootBow

import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@Override
public void onShootBow(EntityShootBowEvent event, DelayedPlayerDetails details) {
	Entity skull = event.getEntity().launchProjectile(WitherSkull.class);
	skull.setVelocity(event.getProjectile().getVelocity());
	event.setProjectile(skull);
}
 
开发者ID:goncalomb,项目名称:NBTEditor,代码行数:7,代码来源:WitherBow.java


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