示例#1
0
  public void sendToLocation(Player p, float offset, float offsetVert, int amt) {
    try {
      Object packet =
          Class.forName(
                  "net.minecraft.server."
                      + ReflectionUtil.getVersionString()
                      + ".PacketPlayOutWorldParticles")
              .getConstructors()[0]
              .newInstance();
      ReflectionUtil.setValue(packet, "a", name); // Particle ID
      ReflectionUtil.setValue(packet, "b", (float) p.getLocation().getX()); // X Coord
      ReflectionUtil.setValue(packet, "c", (float) p.getLocation().getY()); // Y Coord
      ReflectionUtil.setValue(packet, "d", (float) p.getLocation().getZ()); // Z Coord
      ReflectionUtil.setValue(packet, "e", offset); // X Offset
      ReflectionUtil.setValue(packet, "f", offsetVert); // Y Offset
      ReflectionUtil.setValue(packet, "g", offset); // Z Offset
      ReflectionUtil.setValue(packet, "h", defaultSpeed); // Speed (Data)
      ReflectionUtil.setValue(packet, "i", amt); // Amount of Particles Spawned

      Object nmsPlayer = ReflectionUtil.getMethod(p.getClass(), "getHandle").invoke(p);
      Object con = nmsPlayer.getClass().getField("playerConnection").get(nmsPlayer);
      ReflectionUtil.getMethod(con.getClass(), "sendPacket").invoke(con, packet);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
示例#2
0
 public void sendToLocation(Packet63WorldParticles packet, Location l) throws Exception {
   ReflectionUtil.setValue(packet, "a", particleName);
   ReflectionUtil.setValue(packet, "b", (float) l.getX());
   ReflectionUtil.setValue(packet, "c", (float) l.getY());
   ReflectionUtil.setValue(packet, "d", (float) l.getZ());
   ReflectionUtil.setValue(packet, "e", new Random().nextFloat());
   ReflectionUtil.setValue(packet, "f", new Random().nextFloat());
   ReflectionUtil.setValue(packet, "g", new Random().nextFloat());
   ReflectionUtil.setValue(packet, "h", defaultSpeed);
   ReflectionUtil.setValue(packet, "i", particleAmount);
   ReflectionUtil.sendPacketToLocation(l, packet);
 }
示例#3
0
 public void sendToLocation(Location l) throws Exception {
   Object packet =
       Class.forName(
               "net.minecraft.server."
                   + ReflectionUtil.getVersionString()
                   + ".Packet63WorldParticles")
           .getConstructors()[0]
           .newInstance();
   ReflectionUtil.setValue(packet, "a", particleName);
   ReflectionUtil.setValue(packet, "b", (float) l.getX());
   ReflectionUtil.setValue(packet, "c", (float) l.getY());
   ReflectionUtil.setValue(packet, "d", (float) l.getZ());
   ReflectionUtil.setValue(packet, "e", new Random().nextFloat());
   ReflectionUtil.setValue(packet, "f", new Random().nextFloat());
   ReflectionUtil.setValue(packet, "g", new Random().nextFloat());
   ReflectionUtil.setValue(packet, "h", defaultSpeed);
   ReflectionUtil.setValue(packet, "i", particleAmount);
   ReflectionUtil.sendPacketToLocation(l, packet);
 }
示例#4
0
  public void sendToLocation(Location loc, float offset, float offsetVert, int amt) {
    try {
      Object packet =
          Class.forName(
                  "net.minecraft.server."
                      + ReflectionUtil.getVersionString()
                      + ".PacketPlayOutWorldParticles")
              .getConstructors()[0]
              .newInstance();
      ReflectionUtil.setValue(packet, "a", name); // Particle ID
      ReflectionUtil.setValue(packet, "b", (float) loc.getX()); // X Coord
      ReflectionUtil.setValue(packet, "c", (float) loc.getY()); // Y Coord
      ReflectionUtil.setValue(packet, "d", (float) loc.getZ()); // Z Coord
      ReflectionUtil.setValue(packet, "e", offset); // X Offset
      ReflectionUtil.setValue(packet, "f", offsetVert); // Y Offset
      ReflectionUtil.setValue(packet, "g", offset); // Z Offset
      ReflectionUtil.setValue(packet, "h", defaultSpeed); // Speed (Data)
      ReflectionUtil.setValue(packet, "i", amt); // Amount of Particles Spawned
      ReflectionUtil.sendPacketToLocation(loc, packet);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }