本文整理汇总了Java中org.bukkit.entity.ThrownExpBottle类的典型用法代码示例。如果您正苦于以下问题:Java ThrownExpBottle类的具体用法?Java ThrownExpBottle怎么用?Java ThrownExpBottle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ThrownExpBottle类属于org.bukkit.entity包,在下文中一共展示了ThrownExpBottle类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: launchProjectile
import org.bukkit.entity.ThrownExpBottle; //导入依赖的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
示例2: callExpBottleEvent
import org.bukkit.entity.ThrownExpBottle; //导入依赖的package包/类
public static ExpBottleEvent callExpBottleEvent(net.minecraft.entity.Entity entity, int exp) {
ThrownExpBottle bottle = (ThrownExpBottle) entity.getBukkitEntity();
ExpBottleEvent event = new ExpBottleEvent(bottle, exp);
Bukkit.getPluginManager().callEvent(event);
return event;
}
开发者ID:UraniumMC,项目名称:Uranium,代码行数:7,代码来源:CraftEventFactory.java
示例3: ExpBottleEvent
import org.bukkit.entity.ThrownExpBottle; //导入依赖的package包/类
public ExpBottleEvent(final ThrownExpBottle bottle, final int exp) {
super(bottle);
this.exp = exp;
}
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:5,代码来源:ExpBottleEvent.java
示例4: getEntity
import org.bukkit.entity.ThrownExpBottle; //导入依赖的package包/类
@Override
public ThrownExpBottle getEntity() {
return (ThrownExpBottle) entity;
}
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:5,代码来源:ExpBottleEvent.java
示例5: callExpBottleEvent
import org.bukkit.entity.ThrownExpBottle; //导入依赖的package包/类
public static ExpBottleEvent callExpBottleEvent(Entity entity, int exp) {
ThrownExpBottle bottle = (ThrownExpBottle) entity.getBukkitEntity();
ExpBottleEvent event = new ExpBottleEvent(bottle, exp);
Bukkit.getPluginManager().callEvent(event);
return event;
}
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:7,代码来源:CraftEventFactory.java
示例6: onClick
import org.bukkit.entity.ThrownExpBottle; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onClick(PlayerInteractEvent e) {
if(e.getPlayer().getItemInHand().getType() != null){
if(e.getPlayer().getItemInHand().getType() == Material.EXP_BOTTLE){
e.setCancelled(true);
e.getPlayer().updateInventory();
if(DexCore.getCurrencySystem().hasEnoughGC(e.getPlayer().getUniqueId().toString(), 30)){
DexCore.getCurrencySystem().removeGC(e.getPlayer().getUniqueId().toString(), 30);
}else{
e.getPlayer().sendMessage(ChatColor.BLUE + "Gadget > " + ChatColor.GRAY + "You don't have enough points!");
return;
}
if(!cooldowntask.containsKey(e.getPlayer().getName())){
final Player p = e.getPlayer();
p.launchProjectile(ThrownExpBottle.class,
p.getLocation().getDirection().multiply(1));
timeleft.put(p.getName(), 10.0);
cooldowntask.put(p.getName(), new BukkitRunnable() {
@Override
public void run() {
if(timeleft.get(p.getName()) == 0.0){
cooldowntask.remove(p.getName());
timeleft.remove(p.getName());
cancel();
}else{
timeleft.put(p.getName(), timeleft.get(p.getName()) - 0.5);
}
}
});
cooldowntask.get(p.getName()).runTaskTimer(Hub.instance, 10, 10);
}else{
e.getPlayer().sendMessage(ChatColor.BLUE + "Gadget > " + ChatColor.GRAY + " You must wait for " + ChatColor.RED + timeleft.get(e.getPlayer().getName()) + ChatColor.GRAY + " seconds.");
}
}
}
}
开发者ID:devBuzzy,项目名称:Dexoria-Hub,代码行数:45,代码来源:PaintGrenade.java
示例7: PoreExpBottleEvent
import org.bukkit.entity.ThrownExpBottle; //导入依赖的package包/类
public PoreExpBottleEvent(EntityEvent handle) {
super(null, -1);
this.handle = checkNotNull(handle, "handle");
checkState(handle.getEntity() instanceof org.spongepowered.api.entity.projectile.ThrownExpBottle,
"Bad entity type");
}
开发者ID:LapisBlue,项目名称:Pore,代码行数:7,代码来源:PoreExpBottleEvent.java
示例8: getEntity
import org.bukkit.entity.ThrownExpBottle; //导入依赖的package包/类
@Override
public ThrownExpBottle getEntity() {
return (ThrownExpBottle) PoreThrownExpBottle.of(this.getHandle().getEntity());
}
开发者ID:LapisBlue,项目名称:Pore,代码行数:5,代码来源:PoreExpBottleEvent.java
示例9: ExpBottleEvent
import org.bukkit.entity.ThrownExpBottle; //导入依赖的package包/类
public ExpBottleEvent(ThrownExpBottle bottle, int exp) {
super(bottle);
}
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:ExpBottleEvent.java
示例10: getEntity
import org.bukkit.entity.ThrownExpBottle; //导入依赖的package包/类
public ThrownExpBottle getEntity() {
return null;
}
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:ExpBottleEvent.java
注:本文中的org.bukkit.entity.ThrownExpBottle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论