コード例 #1
0
 @Override
 public PacketBlockBreakAnimation setEntityId(Player player) {
   Object nmsPlayer =
       ReflectionAPI.invokeMethod(player, ReflectionAPI.getMethod(player, "getHandle"));
   return this.setEntityId(
       (int) ReflectionAPI.invokeMethod(nmsPlayer, ReflectionAPI.getMethod(nmsPlayer, "getId")));
 }
コード例 #2
0
 public CraftPacketBlockBreakAnimation(Player player, Location blockLocation, byte destroyStage) {
   Object nmsPlayer =
       ReflectionAPI.invokeMethod(player, ReflectionAPI.getMethod(player, "getHandle"));
   this.entityId =
       (int) ReflectionAPI.invokeMethod(nmsPlayer, ReflectionAPI.getMethod(nmsPlayer, "getId"));
   this.blockLocation = blockLocation;
   this.destroyStage = destroyStage;
 }
コード例 #3
0
 @Override
 public void send(Player player) {
   // Get packet class
   Class<?> packetClass = ReflectionAPI.getNmsClass("PacketPlayOutBlockBreakAnimation");
   // Create packet
   Object packet =
       ReflectionAPI.newInstance(
           ReflectionAPI.getConstructor(
               packetClass,
               Integer.class,
               ReflectionAPI.getNmsClass("BlockPosition"),
               Integer.class),
           this.entityId,
           BlockPositionWrapper.fromLocation(this.blockLocation),
           this.destroyStage);
   // Send the packet.
   ReflectionAPI.NmsClass.sendPacket(player, packet);
 }