Java Code Examples for org.bukkit.FireworkEffect.Type#CREEPER

The following examples show how to use org.bukkit.FireworkEffect.Type#CREEPER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CraftMetaFirework.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
static Type getEffectType(int nbt) {
    switch (nbt) {
        case 0:
            return Type.BALL;
        case 1:
            return Type.BALL_LARGE;
        case 2:
            return Type.STAR;
        case 3:
            return Type.CREEPER;
        case 4:
            return Type.BURST;
        default:
            throw new IllegalArgumentException("Unknown effect type " + nbt);
    }
}
 
Example 2
Source File: CraftMetaFirework.java    From Thermos with GNU General Public License v3.0 6 votes vote down vote up
static Type getEffectType(int nbt) {
    switch (nbt) {
        case 0:
            return Type.BALL;
        case 1:
            return Type.BALL_LARGE;
        case 2:
            return Type.STAR;
        case 3:
            return Type.CREEPER;
        case 4:
            return Type.BURST;
        default:
            throw new IllegalStateException(Integer.toString(nbt)); // Spigot
    }
}
 
Example 3
Source File: Tools.java    From ce with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static Firework shootFirework(Location loc, Random rand) {
    int type = rand.nextInt(5) + 1;
    Firework firework = loc.getWorld().spawn(loc, Firework.class);
    FireworkMeta meta = firework.getFireworkMeta();
    Type ft = null;
    switch (type) {
    case 1:
        ft = Type.BALL;
        break;
    case 2:
        ft = Type.BALL_LARGE;
        break;
    case 3:
        ft = Type.BURST;
        break;
    case 4:
        ft = Type.CREEPER;
        break;
    case 5:
        ft = Type.STAR;
        break;
    }
    FireworkEffect effect = FireworkEffect.builder().flicker(rand.nextBoolean()).withColor(fireworkColor(rand.nextInt(16) + 1)).withFade(fireworkColor(rand.nextInt(16) + 1))
            .trail(rand.nextBoolean()).with(ft).trail(rand.nextBoolean()).build();
    meta.addEffect(effect);
    firework.setFireworkMeta(meta);
    return firework;
}