2 definitions by chipmunk minecraft
node-minecraft-protocol is a Minecraft protocol library for node.js, based on node-protodef. It is available on npm as minecraft-protocol, and allows you to create clients, servers, and to otherwise serialize and deserialize packets.
// Example code for node-minecraft-protocol:
const nmp = require('minecraft-protocol')
const client = nmp.createClient({ host: 'localhost', port: 25565, username: 'amonger' })
client.on('login', packet => {
client.write('chat', { message: 'Hello, world!' })
})
const nmp = require('minecraft-protocol')
const client = nmp.createClient({ host: 'localhost', port: 25565, username: 'amonger' })
client.on('login', packet => {
client.write('chat', { message: 'Hello, world!' })
})
by chipmunk minecraft March 11, 2023
MCProtocolLib is a Minecraft protocol library written in the Java programming language. It can be used to create clients, servers, and to otherwise create and parse packets.
// Here is an example of an MCProtocolLib client
// version: 1.19.2
import com.github.steveice10.mc.protocol.MinecraftProtocol;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket;
import com.github.steveice10.packetlib.Session;
import com.github.steveice10.packetlib.event.session.SessionAdapter;
import com.github.steveice10.packetlib.packet.Packet;
import com.github.steveice10.packetlib.tcp.TcpClientSession;
import java.time.Instant;
import java.util.ArrayList;
public class Example {
public static void main (String args) {
Session client = new TcpClientSession("localhost", 25565, new MinecraftProtocol("Player"), null);
client.addListener(new SessionAdapter() {
@Override
public void packetReceived (Session session, Packet packet) {
if (packet instanceof ClientboundLoginPacket) {
session.send(new ServerboundChatPacket("Hello, world!", Instant.now().toEpochMilli(), 0, new byte0, false, new ArrayList<>(), null));
}
}
});
client.connect();
}
}
// version: 1.19.2
import com.github.steveice10.mc.protocol.MinecraftProtocol;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket;
import com.github.steveice10.packetlib.Session;
import com.github.steveice10.packetlib.event.session.SessionAdapter;
import com.github.steveice10.packetlib.packet.Packet;
import com.github.steveice10.packetlib.tcp.TcpClientSession;
import java.time.Instant;
import java.util.ArrayList;
public class Example {
public static void main (String args) {
Session client = new TcpClientSession("localhost", 25565, new MinecraftProtocol("Player"), null);
client.addListener(new SessionAdapter() {
@Override
public void packetReceived (Session session, Packet packet) {
if (packet instanceof ClientboundLoginPacket) {
session.send(new ServerboundChatPacket("Hello, world!", Instant.now().toEpochMilli(), 0, new byte0, false, new ArrayList<>(), null));
}
}
});
client.connect();
}
}
by chipmunk minecraft June 5, 2023