Java Code Examples for org.bukkit.Particle#REDSTONE
The following examples show how to use
org.bukkit.Particle#REDSTONE .
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: XParticle.java From XSeries with MIT License | 6 votes |
/** * Spawns a julia set. * https://en.wikipedia.org/wiki/Julia_set * * @param size the size of the image. * @param zoom the zoom ratio to the set. * @param colorScheme the color scheme for the julia set. * @param moveX the amount to move in the x axis. * @param moveY the amount to move in the y axis. * @see #mandelbrot(double, double, double, double, double, int, ParticleDisplay) * @since 4.0.0 */ public static void julia(double size, double zoom, int colorScheme, double moveX, double moveY, ParticleDisplay display) { display.particle = Particle.REDSTONE; double cx = -0.7; double cy = 0.27015; for (double x = -size; x < size; x += 0.1) { for (double y = -size; y < size; y += 0.1) { double zx = 1.5 * (size - size / 2) / (0.5 * zoom * size) + moveX; double zy = (y - size / 2) / (0.5 * zoom * size) + moveY; int i = colorScheme; while (zx * zx + zy * zy < 4 && i > 0) { double xtemp = zx * zx - zy * zy + cx;//Math.pow((zx * zx + zy * zy), (n / 2)) * (Math.cos(n * Math.atan2(zy, zx))) + cx; zy = 2 * zx * zy + cy; //Math.pow((zx * zx + zy * zy), (n / 2)) * Math.sin(n * Math.atan2(zy, zx)) + cy; zx = xtemp; i--; } java.awt.Color color = new java.awt.Color((i << 21) + (i << 10) + i * 8); display.data = new float[]{color.getRed(), color.getGreen(), color.getBlue(), 0.8f}; display.spawn(x, y, 0); } } }
Example 2
Source File: Effects.java From TabooLib with MIT License | 5 votes |
public static Effects parse(String in) { TMap map = TMap.parse(in); Effects effects = Effects.create(parseParticle(map.getName()), null); for (Map.Entry<String, String> entry : map.getContent().entrySet()) { switch (entry.getKey()) { case "offset": case "o": Double[] offset = Arrays.stream(entry.getValue().split(",")).map(NumberConversions::toDouble).toArray(Double[]::new); effects.offset(new double[] {offset.length > 0 ? offset[0] : 0, offset.length > 1 ? offset[1] : 0, offset.length > 2 ? offset[2] : 0}); break; case "speed": case "s": effects.speed(NumberConversions.toDouble(entry.getValue())); break; case "range": case "r": effects.range(NumberConversions.toDouble(entry.getValue())); break; case "count": case "c": case "amount": case "a": effects.count(NumberConversions.toInt(entry.getValue())); break; case "data": case "d": String[] data = entry.getValue().split(":"); if (effects.particle.getDataType().equals(ItemStack.class)) { effects.data(new ItemStack(Items.asMaterial(data[0]), 1, data.length > 1 ? NumberConversions.toShort(data[1]) : 0)); } else if (effects.particle.getDataType().equals(MaterialData.class)) { effects.data(new MaterialData(Items.asMaterial(data[0]), data.length > 1 ? NumberConversions.toByte(data[1]) : 0)); } else if (effects.particle == Particle.REDSTONE) { effects.data(new ColorData(Color.fromRGB(NumberConversions.toInt(data[0])), NumberConversions.toInt(data[1]))); } break; } } return effects; }
Example 3
Source File: ParticleHandlers.java From QualityArmory with GNU General Public License v3.0 | 5 votes |
public static void spawnGunParticles(Gun g, Location loc) { try { if (g.getParticle() != null) if (g.getParticle() == Particle.REDSTONE) { spawnParticle(g.getParticleR(), g.getParticleG(), g.getParticleB(), loc); } else if (g.getParticle() == Particle.BLOCK_CRACK || g.getParticle() == Particle.BLOCK_DUST || g.getParticle() == Particle.FALLING_DUST) { loc.getWorld().spawnParticle(g.getParticle(), loc, 1, g.getParticleMaterial().createBlockData()); } else { loc.getWorld().spawnParticle(g.getParticle(), loc, 1); } } catch (Error | Exception e4) { } }
Example 4
Source File: ParticleDisplay_13.java From EffectLib with MIT License | 5 votes |
@Override public void display(Particle particle, Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount, float size, Color color, Material material, byte materialData, double range, List<Player> targetPlayers) { // Legacy colorizeable particles if (color != null && (particle == Particle.SPELL_MOB || particle == Particle.SPELL_MOB_AMBIENT)) { displayLegacyColored(particle, center, speed, color, range, targetPlayers); return; } if (particle == Particle.ITEM_CRACK) { displayItem(particle, center, offsetX, offsetY, offsetZ, speed, amount, material, materialData, range, targetPlayers); return; } Object data = null; if (particle == Particle.BLOCK_CRACK || particle == Particle.BLOCK_DUST || particle == Particle.FALLING_DUST) { if (material == null || material == Material.AIR) { return; } data = material.createBlockData(); if (data == null) { return; } } if (particle == Particle.REDSTONE) { // color is required for 1.13 if (color == null) { color = Color.RED; } data = new Particle.DustOptions(color, size); } display(particle, center, offsetX, offsetY, offsetZ, speed, amount, data, range, targetPlayers); }
Example 5
Source File: ParticleDisplay.java From XSeries with MIT License | 3 votes |
/** * Builds a simple ParticleDisplay object with cross-version * compatible {@link org.bukkit.Particle.DustOptions} properties. * * @param location the location of the display. * @param size the size of the dust. * @return a redstone colored dust. * @see #simple(Location, Particle) * @since 1.0.0 */ @Nonnull public static ParticleDisplay colored(@Nullable Location location, int r, int g, int b, float size) { ParticleDisplay dust = new ParticleDisplay(Particle.REDSTONE, location, 1, 0, 0, 0, 0); dust.data = new float[]{r, g, b, size}; return dust; }