本文整理匯總了Java中org.bukkit.entity.Ocelot.setCatType方法的典型用法代碼示例。如果您正苦於以下問題:Java Ocelot.setCatType方法的具體用法?Java Ocelot.setCatType怎麽用?Java Ocelot.setCatType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.entity.Ocelot
的用法示例。
在下文中一共展示了Ocelot.setCatType方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCommand
import org.bukkit.entity.Ocelot; //導入方法依賴的package包/類
@Override
protected void onCommand(CommandSender sender, String[] args) {
Player p = (Player) sender;
Ocelot cat = (Ocelot) p.getWorld().spawnEntity(p.getLocation(), EntityType.OCELOT);
if (cat == null)
return; // Probably in a protected area.
cat.setCatType(Utils.randElement(Ocelot.Type.values()));
cat.setTamed(true);
cat.setBaby();
cat.setVelocity(p.getEyeLocation().getDirection().multiply(2));
Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> {
cat.getWorld().createExplosion(cat.getLocation(), 0F);
cat.remove();
}, 20L);
}
示例2: run
import org.bukkit.entity.Ocelot; //導入方法依賴的package包/類
public void run(PAUser user, String label, String... args) {
final Ocelot o = (Ocelot) user.getLoc().getWorld().spawnEntity(user.getLoc(), EntityType.OCELOT);
o.setCatType(Ocelot.Type.values()[r.nextInt(Ocelot.Type.values().length)]);
o.setSitting(true);
o.setTamed(true);
o.setAge(r.nextInt(2));
o.setCustomName(Utils.colorize("&dGateteeeeeee"));
o.setCustomNameVisible(true);
o.setNoDamageTicks(Integer.MAX_VALUE);
o.setVelocity(user.getPlayer().getLocation().getDirection().multiply(2));
PAServer.users.forEach(u -> u.sendSound(Sounds.CAT_MEOW));
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
PAServer.users.forEach(u -> u.sendSound(Sounds.EXPLODE));
ParticleEffect.EXPLOSION_HUGE.send(plugin.getServer().getOnlinePlayers(), o.getLocation(), 0, 0, 0, 1, 20, 50);
o.remove();
}, 60);
}
示例3: throwKittyCannon
import org.bukkit.entity.Ocelot; //導入方法依賴的package包/類
private void throwKittyCannon(final World world, Player player, Location hookLoc) {
int i = random.nextInt(Ocelot.Type.values().length);
final Ocelot cat = (Ocelot) throwMob(world, player, hookLoc, EntityType.OCELOT);
cat.setCatType(Ocelot.Type.values()[i]);
cat.setTamed(true);
cat.setBaby();
mainInstance.scheduleSyncDelayedTask(new Runnable() {
@Override
public void run() {
final Location catLoc = cat.getLocation();
cat.remove();
world.createExplosion(catLoc.getX(), catLoc.getY(), catLoc.getZ(), 2.0F, false, false);
}
}, 20);
}
示例4: run
import org.bukkit.entity.Ocelot; //導入方法依賴的package包/類
@Override
protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception
{
final EntityType cat = EntityType.OCELOT;
final Ocelot ocelot = (Ocelot)user.getPlayer().getWorld().spawn(user.getPlayer().getEyeLocation(), cat.getEntityClass());
if (ocelot == null)
{
return;
}
final int i = random.nextInt(Ocelot.Type.values().length);
ocelot.setCatType(Ocelot.Type.values()[i]);
ocelot.setTamed(true);
ocelot.setVelocity(user.getPlayer().getEyeLocation().getDirection().multiply(2));
ess.getPlugin().scheduleSyncDelayedTask(
new Runnable()
{
@Override
public void run()
{
final Location loc = ocelot.getLocation();
ocelot.remove();
loc.getWorld().createExplosion(loc, 0F);
}
}, 20);
}
示例5: apply
import org.bukkit.entity.Ocelot; //導入方法依賴的package包/類
@Override
public boolean apply(Entity entity) {
PreCon.notNull(entity);
PreCon.isValid(entity instanceof Ocelot, "org.bukkit.entity.Ocelot expected.");
Ocelot ocelot = (Ocelot)entity;
ocelot.setCatType(_type);
ocelot.setSitting(_isSitting);
return true;
}
示例6: onSpawn
import org.bukkit.entity.Ocelot; //導入方法依賴的package包/類
@Override
public void onSpawn() {
Ocelot ocelot = (Ocelot) getNPC().getEntity();
if (catType != null) ocelot.setCatType(catType);
}