continue; firework.addEffect(charge.getEffect());
@Override public void addEffect(MCFireworkEffect effect) { fm.addEffect((FireworkEffect) effect.getHandle()); }
public void partyMode(MinigamePlayer player){ if(onPartyMode()){ Location loc = player.getPlayer().getLocation(); Firework firework = (Firework) player.getPlayer().getWorld().spawnEntity(loc, EntityType.FIREWORK); FireworkMeta fwm = firework.getFireworkMeta(); Random chance = new Random(); Type type = Type.BALL_LARGE; if(chance.nextInt(100) < 50){ type = Type.BALL; } Color col = Color.fromRGB(chance.nextInt(255), chance.nextInt(255), chance.nextInt(255)); FireworkEffect effect = FireworkEffect.builder().with(type).withColor(col).flicker(chance.nextBoolean()).trail(chance.nextBoolean()).build(); fwm.addEffect(effect); fwm.setPower(1); firework.setFireworkMeta(fwm); } }
ItemStack itemStack = new ItemStack(fireworkMaterial); FireworkMeta meta = (FireworkMeta) itemStack.getItemMeta(); meta.addEffect(effect); meta.setPower(power); itemStack.setItemMeta(meta);
public void spawnFireworks(Player player) { int power = Misc.getRandom().nextInt(3) + 1; Type fireworkType = Type.values()[Misc.getRandom().nextInt(Type.values().length)]; double varX = Misc.getRandom().nextGaussian() * 3; double varZ = Misc.getRandom().nextGaussian() * 3; Firework fireworks = (Firework) player.getWorld().spawnEntity(player.getLocation().add(varX, 0, varZ), EntityType.FIREWORK); FireworkMeta fireworkmeta = fireworks.getFireworkMeta(); FireworkEffect effect = FireworkEffect.builder().flicker(Misc.getRandom().nextBoolean()).withColor(colorChoose()).withFade(colorChoose()).with(fireworkType).trail(Misc.getRandom().nextBoolean()).build(); fireworkmeta.addEffect(effect); fireworkmeta.setPower(power); fireworks.setFireworkMeta(fireworkmeta); }
@Override public MCFirework launchFirework(MCLocation l, int strength, List<MCFireworkEffect> effects) { Firework firework = (Firework) w.spawnEntity(((BukkitMCLocation) l).asLocation(), EntityType.FIREWORK); FireworkMeta meta = firework.getFireworkMeta(); meta.setPower(strength); for(MCFireworkEffect effect : effects) { meta.addEffect((FireworkEffect) effect.getHandle()); } firework.setFireworkMeta(meta); return new BukkitMCFirework(firework); }
protected void detonate(Location location, Vector v) { final Firework fw = (Firework) location.getWorld().spawnEntity(location.add(v), EntityType.FIREWORK); location.subtract(v); FireworkMeta meta = fw.getFireworkMeta(); meta.setPower(0); for (int i = 0; i < intensity; i++) { meta.addEffect(firework); } fw.setFireworkMeta(meta); fw.detonate(); } }
public static void fireworkParticleShower(Player player, Color color) { Location location = player.getLocation(); location.setY(location.getY() + (player.isInsideVehicle() ? 1.0 : -1.0)); location.setPitch(-90); Firework firework = (Firework) player.getWorld().spawnEntity(location, EntityType.FIREWORK); firework.setMetadata(mcMMO.funfettiMetadataKey, new FixedMetadataValue(mcMMO.p, null)); FireworkMeta fireworkMeta = firework.getFireworkMeta(); FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(color).with((Config.getInstance().getLargeFireworks() ? Type.BALL_LARGE : Type.BALL)).trail(true).build(); fireworkMeta.addEffect(effect); fireworkMeta.addEffect(effect); fireworkMeta.setPower(0); firework.setFireworkMeta(fireworkMeta); }
fireworkMeta.addEffect(FireworkEffect.builder() .flicker(false) .withColor(Color.SILVER)
FireworkMeta meta = ensureMeta(res); for (DataKey sub : root.getRelative("firework.effects").getIntegerSubKeys()) { meta.addEffect(deserialiseFireworkEffect(sub));