本文整理匯總了Java中org.bukkit.entity.Slime.setSize方法的典型用法代碼示例。如果您正苦於以下問題:Java Slime.setSize方法的具體用法?Java Slime.setSize怎麽用?Java Slime.setSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.entity.Slime
的用法示例。
在下文中一共展示了Slime.setSize方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: applyMountData
import org.bukkit.entity.Slime; //導入方法依賴的package包/類
@Override
public void applyMountData(Entity npc) {
super.applyMountData(npc);
if (!(npc instanceof Slime)) {
return;
}
Slime slime = (Slime) npc;
slime.setSize(size);
}
示例2: onCritical
import org.bukkit.entity.Slime; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onCritical(EntityDamageByEntityEvent e) {
if(e.getDamager() instanceof Player) {
if(e.getEntity() instanceof LivingEntity) {
LivingEntity attackedEntity = (LivingEntity) e.getEntity();
final Slime entity = (Slime) e.getDamager().getWorld().spawnEntity(attackedEntity.getEyeLocation(), EntityType.SLIME);
entity.setSize(1);
entity.setCustomName(ChatColor.translateAlternateColorCodes('&', "&e"+attackedEntity.getHealth() + "!"));
entity.getWorld().playEffect(entity.getLocation(), Effect.MOBSPAWNER_FLAMES, 100);
entitys.add(entity);
entity.damage(1);
}
}
}
示例3: initRunnable
import org.bukkit.entity.Slime; //導入方法依賴的package包/類
private Runnable initRunnable(Item i)
{
final Item f_i = i;
Runnable run = new Runnable()
{
public void run()
{
List<Block> slimeBlocks = new ArrayList<Block>();
slimeBlocks.add(f_i.getLocation().add(0, -1, 0).getBlock());
slimeBlocks.add(f_i.getLocation().add(0, -1, 1).getBlock());
slimeBlocks.add(f_i.getLocation().add(0, -1, -1).getBlock());
slimeBlocks.add(f_i.getLocation().add(1, -1, 0).getBlock());
slimeBlocks.add(f_i.getLocation().add(-1, -1, 0).getBlock());
slimeBlocks.add(f_i.getLocation().add(0, 0, 1).getBlock());
slimeBlocks.add(f_i.getLocation().add(0, 0, -1).getBlock());
slimeBlocks.add(f_i.getLocation().add(1, 0, 0).getBlock());
slimeBlocks.add(f_i.getLocation().add(-1, 0, 0).getBlock());
slimeBlocks.add(f_i.getLocation().add(1, 0, 1).getBlock());
slimeBlocks.add(f_i.getLocation().add(1, 0, -1).getBlock());
slimeBlocks.add(f_i.getLocation().add(-1, 0, 1).getBlock());
slimeBlocks.add(f_i.getLocation().add(-1, 0, -1).getBlock());
ItemStack i_f_i = ((Item)f_i).getItemStack();
Iterator<Block> it = slimeBlocks.iterator();
Block slimeBlock = null;
while(it.hasNext())
{
slimeBlock = it.next();
if(slimeBlock != null && slimeBlock.getType() == Material.SLIME_BLOCK && f_i.isOnGround())
{
if(i_f_i.getAmount() > 1)
i_f_i.setAmount(i_f_i.getAmount() - 1);
else
f_i.remove();
if(i_f_i.getAmount() <= 0)
f_i.remove();
slimeBlock.setType(Material.AIR);
Slime slime = (Slime)f_i.getWorld().spawnEntity(slimeBlock.getLocation(), EntityType.SLIME);
slime.setSize(2);
ParticleEffect.CLOUD.display(0.5f, 0.5f, 0.5f, 0.1f, 20, slimeBlock.getLocation().add(0.5, 0.5, 0.5), 64);
break;
}
}
}
};
return run;
}
示例4: run
import org.bukkit.entity.Slime; //導入方法依賴的package包/類
public void run(Location loc) {
Location l = loc.clone();
l.add(rand.nextDouble(), 0, rand.nextDouble());
Slime s = (Slime) l.getWorld().spawnEntity(loc, EntityType.SLIME);
s.setSize(1);
}