@Override public void load() { String[] eff = RegexUtil.COLON_PATTERN.split(RegexUtil.EQUALS_PATTERN.split(getSign().getLine(2))[0], 2); try { effectID = Integer.parseInt(eff[0]); } catch (Exception e) { effectID = Effect.valueOf(eff[0]).getId(); } if (Effect.getById(effectID) == null) return; try { effectData = Integer.parseInt(eff[1]); } catch (Exception e) { effectData = 0; } try { times = Integer.parseInt(getSign().getLine(3)); } catch (Exception ignored) { times = 1; } try { String[] off = RegexUtil.COLON_PATTERN.split(RegexUtil.EQUALS_PATTERN.split(getSign().getLine(2))[1], 2); offset = new Vector( Double.parseDouble(off[0]), Double.parseDouble(off[1]), Double.parseDouble(off[2])); } catch (Exception e) { offset = new Vector(0, 1, 0); } }
private void spawnParticle(Game game, Player player, String effect) { for (Effect e : Effect.values()) { if (e.toString().equals(effect)) { player.getWorld().playEffect(player.getLocation(), e, 0); return; } } DvZPackets.sendParticles(player.getLocation(), effect, 0.3f, 0.3f, 0.5f, 5, 32); }
public <T> void playEffect(Location loc, Effect effect, T data) { if (data != null) { Validate.isTrue( data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!"); } else { Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!"); } int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data); playEffect(loc, effect, datavalue); }
@Override public String toString() { String ret = type.toString(); // TODO: Will data ever be null, or will it just be 0? if (data != null) ret += "@" + data.get(type); return ret; }
public void playEffect(Location loc, Effect effect, int data) { if (getHandle().field_71135_a == null) return; int packetData = effect.getId(); net.minecraft.network.packet.Packet61DoorChange packet = new net.minecraft.network.packet.Packet61DoorChange( packetData, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), data, false); getHandle().field_71135_a.func_72567_b(packet); }
public void playEffect(Location loc, Effect effect, int data) { if (getHandle().playerNetServerHandler == null) return; int packetData = effect.getId(); Packet61DoorChange packet = new Packet61DoorChange( packetData, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), data, false); getHandle().playerNetServerHandler.sendPacketToPlayer(packet); }
@Override public void run() { for (Player player : effects.playerList) { for (String particleEffect : (ArrayList<String>) player.getMetadata(effects.PARTICLE_KEY).get(0).value()) { player.getWorld().playEffect(player.getLocation(), Effect.valueOf(particleEffect), 7, 30); } } }
public void doEffect() { try { if (effectID == 0) return; if (effectID == 2001 && BlockType.fromID(effectData) == null) return; Block b = SignUtil.getBackBlock(BukkitUtil.toSign(getSign()).getBlock()); for (int i = 0; i < times; i++) { b.getWorld() .playEffect(b.getLocation().add(offset), Effect.getById(effectID), effectData, 50); } } catch (Exception ignored) { } }
public static ItemStack getIcon(Effect effect) { if (effect.getType() != Type.PARTICLE) { return null; } Material type; short data = 0; switch (effect) { case FIREWORKS_SPARK: type = Material.FIREWORK; break; case CRIT: type = Material.DIAMOND_SWORD; break; case MAGIC_CRIT: case POTION_SWIRL: case POTION_SWIRL_TRANSPARENT: case SPELL: type = Material.POTION; data = 64; break; case INSTANT_SPELL: type = Material.POTION; data = 16421; break; case WITCH_MAGIC: type = Material.MONSTER_EGG; data = 66; break; case NOTE: type = Material.NOTE_BLOCK; break; case PORTAL: type = Material.OBSIDIAN; break; case FLYING_GLYPH: type = Material.ENCHANTMENT_TABLE; break; case FLAME: type = Material.FLINT_AND_STEEL; break; case LAVA_POP: case LAVADRIP: type = Material.LAVA_BUCKET; break; case FOOTSTEP: type = Material.DIAMOND_BOOTS; break; case SPLASH: type = Material.BOAT; break; case EXPLOSION: case EXPLOSION_LARGE: case EXPLOSION_HUGE: type = Material.TNT; break; case COLOURED_DUST: type = Material.REDSTONE; break; case SNOWBALL_BREAK: type = Material.SNOW_BALL; break; case WATERDRIP: type = Material.WATER_BUCKET; break; case SNOW_SHOVEL: type = Material.SNOW; break; case SLIME: type = Material.SLIME_BALL; break; case HEART: type = Material.GOLDEN_APPLE; break; case HAPPY_VILLAGER: type = Material.INK_SACK; data = 15; break; case PARTICLE_SMOKE: case SMALL_SMOKE: case CLOUD: case VILLAGER_THUNDERCLOUD: case LARGE_SMOKE: case VOID_FOG: type = Material.PAPER; break; default: return null; } return new ItemStack(type, 1, data); }
@SuppressWarnings("deprecation") public SoundOrParticleEffectPacket(Effect effect, int x, int y, int z, int data) { this(effect.getId(), x, y, z, data, false); }