-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathShulkerPet.java
More file actions
34 lines (25 loc) · 1.14 KB
/
ShulkerPet.java
File metadata and controls
34 lines (25 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package io.github.thebusybiscuit.hotbarpets.pets;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import io.github.thebusybiscuit.hotbarpets.HotbarPets;
import io.github.thebusybiscuit.hotbarpets.SimpleBasePet;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
public class ShulkerPet extends SimpleBasePet {
private final HotbarPets plugin;
public ShulkerPet(HotbarPets plugin, SlimefunItemStack item, ItemStack food, ItemStack[] recipe) {
super(plugin.getItemGroup(), item, food, recipe);
this.plugin = plugin;
}
@Override
public void onUseItem(Player p) {
Arrow arrow = p.launchProjectile(Arrow.class);
arrow.addCustomEffect(new PotionEffect(PotionEffectType.LEVITATION, 10, 5), true);
arrow.setMetadata("hotbarpets_projectile", new FixedMetadataValue(plugin, true));
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_SHULKER_AMBIENT, 1.0F, 2.0F);
}
}