本文整理汇总了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;
}
示例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);
}
}
}
}
}
示例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();
}
}
}
示例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());
}
}
示例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;
}
示例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);
}
}
}
示例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();
}
示例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. :(
}
}
示例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);
}
}
示例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();
}
示例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;
}
示例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();
}
示例13: getBukkitEntity
import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@Override
public WitherSkull getBukkitEntity() {
return getCraftBukkitEntity();
}
示例14: disableExplosionWithers
import org.bukkit.entity.WitherSkull; //导入依赖的package包/类
@EventHandler
public void disableExplosionWithers(EntityExplodeEvent e) {
if(e.getEntity() instanceof WitherSkull) {
e.setCancelled(true);
}
}
示例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);
}