Category

Network (rnet)

Watch, change, block, delay and send Minecraft packets.

rnet works with the packets between the client and the server. The same library is also available as raknet and netty, which are aliases. Java Edition uses Netty, so rnet.edition is "java" and rnet.transport is "netty".

Use it only on servers you own or have permission to test.

Pages in this category

  • Subscribing: on, once, intercept, wait, log, record
  • Rules: block, drop, delay, lag, set, dup, blink, flush
  • Packets: the packet object and its fields
  • Sending: build and send packets, and helper functions
  • Inspection: known, top, rate, stats, aliases and schemas

Quick examples

-- Watch where the server moves you
rnet.on("move_player_pos", function(p)
  print(p.x, p.y, p.z)
end, "out")

-- Never send swing packets
rnet.block("swing")

-- Fake lag on everything you send
rnet.lag(300)

-- Change chat on the way out
rnet.intercept("chat", function(p)
  p.message = p.message:upper()
end)

Patterns

Most functions take a pattern that chooses which packets they apply to.

PatternMatches
"move_player_pos"A Mojang packet id. The minecraft: prefix is optional
"class_2828"A class name
"move_*"A prefix or wildcard. * matches anything
"*"Every packet
"Move"A friendly alias

Matching is case-insensitive. Functions that subscribe (on, once, intercept, log, record) also accept a table of 1 to 128 patterns.

Directions

ValueMeaning
"out"Packets you send to the server
"in"Packets the server sends to you
nil or "both"Both

These alternative spellings are also accepted: "outgoing", "c2s", "send", "serverbound" for out, and "incoming", "s2c", "recv", "clientbound" for in.

Performance

Handlers run for every matching packet. Subscribing to "*" on a busy connection is expensive, so use specific patterns where you can. Up to 128 packet events are delivered per frame.

rnet itself

rnet is read-only. Assigning to it raises rnet is read-only.

rnet.reset()

Removes all subscriptions and rules and releases every held packet.

rnet.help()

Prints a one-line list of the functions to the console.

In this category