initial code dump

This commit is contained in:
p2r3
2025-08-12 03:51:57 +03:00
parent 94b568d2ac
commit 269e8346eb
17 changed files with 5134 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.vscode
notchian
bareiron

3
build.sh Executable file
View File

@@ -0,0 +1,3 @@
rm bareiron
gcc main.c src/*.c -o bareiron
./bareiron

285
main.c Normal file
View File

@@ -0,0 +1,285 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME 0
#endif
#include <arpa/inet.h>
#include <unistd.h>
#include "src/globals.h"
#include "src/tools.h"
#include "src/varnum.h"
#include "src/packets.h"
void handlePacket (int client_fd, int length, int packet_id) {
int state = getClientState(client_fd);
switch (packet_id) {
case 0x00:
if (state == STATE_NONE) {
if (cs_handshake(client_fd)) break;
return;
} else if (state == STATE_LOGIN) {
if (cs_loginStart(client_fd)) break;
if (reservePlayerData(client_fd, recv_buffer + 17)) break;
if (sc_loginSuccess(client_fd, recv_buffer, recv_buffer + 17)) break;
return;
} else if (state == STATE_CONFIGURATION) {
if (cs_clientInformation(client_fd)) break;
if (sc_knownPacks(client_fd)) break;
if (sc_registries(client_fd)) break;
return;
}
break;
case 0x02:
if (state == STATE_CONFIGURATION) {
if (cs_pluginMessage(client_fd)) break;
return;
}
break;
case 0x03:
if (state == STATE_LOGIN) {
printf("Client Acknowledged Login\n\n");
setClientState(client_fd, STATE_CONFIGURATION);
return;
} else if (state == STATE_CONFIGURATION) {
printf("Client Acknowledged Configuration\n\n");
setClientState(client_fd, STATE_PLAY);
sc_loginPlay(client_fd);
short x = 8, y = 80, z = 8;
int8_t yaw = 0, pitch = 0;
restorePlayerPosition(client_fd, &x, &y, &z, &yaw, &pitch);
sc_synchronizePlayerPosition(client_fd, x, y, z, yaw * 180 / 127, pitch * 90 / 127);
short _x = x / 16, _z = z / 16;
uint8_t *inventory = getPlayerInventory(client_fd);
for (uint8_t i = 0; i < 82; i += 2) {
sc_setContainerSlot(client_fd, 0, serverSlotToClientSlot(i / 2), inventory[i + 1], inventory[i]);
}
sc_setDefaultSpawnPosition(client_fd, 8, 80, 8);
sc_startWaitingForChunks(client_fd);
sc_setCenterChunk(client_fd, _x, _z);
for (int i = -2; i <= 2; i ++) {
for (int j = -2; j <= 2; j ++) {
sc_chunkDataAndUpdateLight(client_fd, _x + i, _z + j);
}
}
return;
}
break;
case 0x07:
if (state == STATE_CONFIGURATION) {
printf("Received Client's Known Packs\n");
printf(" Finishing configuration\n\n");
sc_finishConfiguration(client_fd);
}
break;
case 0x0C:
if (state == STATE_PLAY) {
// client tick
return;
}
break;
case 0x11:
if (state == STATE_PLAY) {
cs_clickContainer(client_fd);
return;
}
break;
case 0x1D:
case 0x1E:
if (state == STATE_PLAY) {
double x, y, z;
float yaw, pitch;
if (packet_id == 0x1D) cs_setPlayerPosition(client_fd, &x, &y, &z);
else cs_setPlayerPositionAndRotation(client_fd, &x, &y, &z, &yaw, &pitch);
short cx = x + 0.5, cy = y, cz = z + 0.5;
short px, py, pz;
restorePlayerPosition (client_fd, &px, &py, &pz, NULL, NULL);
short _x = (cx < 0 ? cx - 16 : cx) / 16, _z = (cz < 0 ? cz - 16 : cz) / 16;
short dx = _x - (px < 0 ? px - 16 : px) / 16, dz = _z - (pz < 0 ? pz - 16 : pz) / 16;
if (dx != 0 || dz != 0) {
printf("sending new chunks (%d, %d)\n", _x, _z);
sc_setCenterChunk(client_fd, _x, _z);
clock_t start, end;
int count = 0;
start = clock();
if (dx != 0 && dz != 0) {
sc_chunkDataAndUpdateLight(client_fd, _x + dx * 2, _z - dx);
sc_chunkDataAndUpdateLight(client_fd, _x + dx * 2, _z);
sc_chunkDataAndUpdateLight(client_fd, _x + dx * 2, _z + dz);
sc_chunkDataAndUpdateLight(client_fd, _x + dx * 2, _z + dz * 2);
sc_chunkDataAndUpdateLight(client_fd, _x + dx, _z + dz * 2);
sc_chunkDataAndUpdateLight(client_fd, _x, _z + dz * 2);
sc_chunkDataAndUpdateLight(client_fd, _x - dz, _z + dz * 2);
count += 5;
} else {
for (int i = -2; i <= 2; i ++) {
count ++;
sc_chunkDataAndUpdateLight(client_fd, _x + dx * 2 + i * dz, _z + dz * 2 + i * dx);
printf("(%d, %d) ", _x + dx * 2 + i * dz, _z + dz * 2 + i * dx);
}
printf("\n");
}
end = clock();
double total_ms = (double)(end - start) / CLOCKS_PER_SEC * 1000;
printf("generated %d chunks in %.0f ms (%.2f ms per chunk)\n", count, total_ms, total_ms / count);
}
if (packet_id == 0x1D) savePlayerPosition(client_fd, cx, cy, cz);
else savePlayerPositionAndRotation(client_fd, cx, cy, cz, yaw / 180.0f * 127.0f, pitch / 90.0f * 127.0f);
return;
}
break;
case 0x34:
if (state == STATE_PLAY) {
cs_setHeldItem(client_fd);
return;
}
break;
case 0x28:
if (state == STATE_PLAY) {
cs_playerAction(client_fd);
return;
}
break;
case 0x3F:
if (state == STATE_PLAY) {
cs_useItemOn(client_fd);
return;
}
break;
default: break;
}
if (packet_id < 16) printf("Unknown/bad packet: 0x0%X, length: %d, state: %d\n\n", packet_id, length, state);
else printf("Unknown/bad packet: 0x%X, length: %d, state: %d\n\n", packet_id, length, state);
recv_count = recv(client_fd, recv_buffer, length, 0);
}
int main () {
memset(block_changes, 0xFF, sizeof(block_changes));
int server_fd, client_fd, opt = 1;
struct sockaddr_in server_addr, client_addr;
socklen_t addr_len = sizeof(client_addr);
struct sockaddr_in addr;
// Create socket
server_fd = socket(AF_INET, SOCK_STREAM, 0);
if (server_fd == -1) {
perror("socket failed");
exit(EXIT_FAILURE);
}
if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
perror("socket options failed");
exit(EXIT_FAILURE);
}
// Bind socket to IP/port
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = INADDR_ANY;
server_addr.sin_port = htons(PORT);
if (bind(server_fd, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) {
perror("bind failed");
close(server_fd);
exit(EXIT_FAILURE);
}
// Listen for incoming connections
if (listen(server_fd, 5) < 0) {
perror("listen failed");
close(server_fd);
exit(EXIT_FAILURE);
}
printf("Server listening on port %d...\n", PORT);
while (true) {
// Accept a connection
client_fd = accept(server_fd, (struct sockaddr *)&client_addr, &addr_len);
if (client_fd < 0) {
perror("accept failed");
close(server_fd);
exit(EXIT_FAILURE);
}
printf("Client connected.\n");
struct timespec time_now;
struct timespec keepalive_last;
clock_gettime(CLOCK_REALTIME, &time_now);
clock_gettime(CLOCK_REALTIME, &keepalive_last);
while (true) {
if (getClientState(client_fd) == STATE_PLAY) {
clock_gettime(CLOCK_REALTIME, &time_now);
if (time_now.tv_sec - keepalive_last.tv_sec > 10) {
sc_keepAlive(client_fd);
clock_gettime(CLOCK_REALTIME, &keepalive_last);
}
}
int length = readVarInt(client_fd);
if (length == VARNUM_ERROR) break;
int packet_id = readVarInt(client_fd);
if (packet_id == VARNUM_ERROR) break;
handlePacket(client_fd, length - sizeVarInt(packet_id), packet_id);
if (recv_count == -1) break;
}
setClientState(client_fd, STATE_NONE);
clearPlayerFD(client_fd);
close(client_fd);
printf("Connection closed.\n");
}
close(server_fd);
printf("Server closed.\n");
return 0;
}

101
src/build_registries.js Normal file
View File

@@ -0,0 +1,101 @@
const fs = require("fs");
const path = require("path");
// Write an integer as a varint
function writeVarInt(value) {
const bytes = [];
while (true) {
if ((value & ~0x7F) === 0) {
bytes.push(value);
return Buffer.from(bytes);
}
bytes.push((value & 0x7F) | 0x80);
value >>>= 7;
}
}
// Serialize a single registry
function serializeRegistry(name, entries) {
const parts = [];
// Write 0x07
parts.push(Buffer.from([0x07]));
// Registry name
const nameBuf = Buffer.from(name, "utf8");
parts.push(writeVarInt(nameBuf.length));
parts.push(nameBuf);
// Entry count
const entryKeys = Object.keys(entries);
parts.push(writeVarInt(entryKeys.length));
// Serialize entries
for (const entryName of entryKeys) {
const entryBuf = Buffer.from(entryName, "utf8");
parts.push(writeVarInt(entryBuf.length));
parts.push(entryBuf);
parts.push(Buffer.from([0x00]));
}
// Combine all parts
const fullData = Buffer.concat(parts);
// Prepend the length of this registry block as a varint
const lengthBuf = writeVarInt(fullData.length);
return Buffer.concat([lengthBuf, fullData]);
}
// Convert to C-style hex byte array string
function toCArray(buffer) {
const hexBytes = [...buffer].map(b => `0x${b.toString(16).padStart(2, "0")}`);
const lines = [];
for (let i = 0; i < hexBytes.length; i += 12) {
lines.push(" " + hexBytes.slice(i, i + 12).join(", "));
}
return lines.join(",\n");
}
// Main function
function convert() {
const inputPath = path.join(__dirname, "registries.json");
const outputPath = path.join(__dirname, "registries.c");
const headerPath = path.join(__dirname, "registries.h");
const json = JSON.parse(fs.readFileSync(inputPath, "utf8"));
const buffers = [];
for (const [registryName, entries] of Object.entries(json)) {
buffers.push(serializeRegistry(registryName, entries));
}
const output = Buffer.concat(buffers);
const cArray = toCArray(output);
const finalCode = `\
#include <stdint.h>
#include "registries.h"
uint8_t registries_bin[] = {
${cArray}
};
`;
const headerCode = `\
#ifndef H_REGISTRIES
#define H_REGISTRIES
#include <stdint.h>
extern uint8_t registries_bin[${output.length}];
#endif
`;
fs.writeFileSync(outputPath, finalCode);
fs.writeFileSync(headerPath, headerCode);
console.log("Done. Wrote to `registries.c` and `registries.h`");
}
convert();

25
src/globals.c Normal file
View File

@@ -0,0 +1,25 @@
#include <stdio.h>
#include <stdint.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "globals.h"
ssize_t recv_count;
uint8_t recv_buffer[256] = {0};
uint32_t world_seed = 0xA103DE6C;
uint8_t block_changes[50 * 1024];
int block_changes_count = 0;
uint8_t player_data[(
16 + // UUID
4 + // File descriptor
2 + // X position (short)
2 + // Y position (short)
2 + // Z position (short)
2 + // Angles (both, i8)
1 + // Hotbar slot
82 // Inventory
) * MAX_PLAYERS];
int player_data_size = 16 + 4 + 2 + 2 + 2 + 2 + 1 + 82;

39
src/globals.h Normal file
View File

@@ -0,0 +1,39 @@
#ifndef H_GLOBALS
#define H_GLOBALS
#include <stdint.h>
#define true 1
#define false 0
#define PORT 25565
#define MAX_PLAYERS 16
#define GAMEMODE 0
#define STATE_NONE 0
#define STATE_STATUS 1
#define STATE_LOGIN 2
#define STATE_TRANSFER 3
#define STATE_CONFIGURATION 4
#define STATE_PLAY 5
extern ssize_t recv_count;
extern uint8_t recv_buffer[256];
extern uint32_t world_seed;
extern uint8_t block_changes[50 * 1024];
extern int block_changes_count;
extern uint8_t player_data[(
16 + // UUID
4 + // File descriptor
2 + // X position (short)
2 + // Y position (short)
2 + // Z position (short)
2 + // Angles (both, i8)
1 + // Hotbar slot
82 // Inventory
) * MAX_PLAYERS];
extern int player_data_size;
#endif

576
src/packets.c Normal file
View File

@@ -0,0 +1,576 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "globals.h"
#include "tools.h"
#include "varnum.h"
#include "registries.h"
#include "worldgen.h"
// C->S Handshake
int cs_handshake (int client_fd) {
printf("Received Handshake:\n");
printf(" Protocol version: %d\n", readVarInt(client_fd));
readString(client_fd);
if (recv_count == -1) return 1;
printf(" Server address: %s\n", recv_buffer);
printf(" Server port: %u\n", readUint16(client_fd));
int intent = readVarInt(client_fd);
if (intent == VARNUM_ERROR) return 1;
printf(" Intent: %d\n\n", intent);
setClientState(client_fd, intent);
return 0;
}
// C->S Login Start
// Leaves player name and UUID at indexes 0 and 17 of recv_buffer, respectively
int cs_loginStart (int client_fd) {
printf("Received Login Start:\n");
readString(client_fd);
if (recv_count == -1) return 1;
printf(" Player name: %s\n", recv_buffer);
recv_count = recv(client_fd, recv_buffer + 17, 16, MSG_WAITALL);
if (recv_count == -1) return 1;
printf(" Player UUID: ");
for (int i = 17; i < 33; i ++) printf("%x", recv_buffer[i]);
printf("\n\n");
return 0;
}
// S->C Login Success
int sc_loginSuccess (int client_fd, char *name, char *uuid) {
printf("Sending Login Success...\n\n");
int name_length = strlen(name);
writeVarInt(client_fd, 1 + 16 + sizeVarInt(name_length) + name_length + 1);
writeVarInt(client_fd, 0x02);
send(client_fd, uuid, 16, 0);
writeVarInt(client_fd, name_length);
send(client_fd, name, name_length, 0);
writeVarInt(client_fd, 0);
return 0;
}
int cs_clientInformation (int client_fd) {
int tmp;
printf("Received Client Information:\n");
readString(client_fd);
if (recv_count == -1) return 1;
printf(" Locale: %s\n", recv_buffer);
tmp = readByte(client_fd);
if (recv_count == -1) return 1;
printf(" View distance: %d\n", tmp);
tmp = readVarInt(client_fd);
if (recv_count == -1) return 1;
printf(" Chat mode: %d\n", tmp);
tmp = readByte(client_fd);
if (recv_count == -1) return 1;
if (tmp) printf(" Chat colors: on\n", tmp);
else printf(" Chat colors: off\n", tmp);
tmp = readByte(client_fd);
if (recv_count == -1) return 1;
printf(" Skin parts: %d\n", tmp);
tmp = readVarInt(client_fd);
if (recv_count == -1) return 1;
if (tmp) printf(" Main hand: right\n", tmp);
else printf(" Main hand: left\n", tmp);
tmp = readByte(client_fd);
if (recv_count == -1) return 1;
if (tmp) printf(" Text filtering: on\n", tmp);
else printf(" Text filtering: off\n", tmp);
tmp = readByte(client_fd);
if (recv_count == -1) return 1;
if (tmp) printf(" Allow listing: on\n", tmp);
else printf(" Allow listing: off\n", tmp);
tmp = readVarInt(client_fd);
if (recv_count == -1) return 1;
printf(" Particles: %d\n\n", tmp);
return 0;
}
// S->C Clientbound Known Packs
int sc_knownPacks (int client_fd) {
printf("Sending Server's Known Packs\n\n");
char known_packs[] = {
0x0e, 0x01, 0x09, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x04, 0x63,
0x6f, 0x72, 0x65, 0x06, 0x31, 0x2e, 0x32, 0x31,
0x2e, 0x38
};
writeVarInt(client_fd, 24);
send(client_fd, &known_packs, 24, 0);
return 0;
}
// C->S Serverbound Plugin Message
int cs_pluginMessage (int client_fd) {
printf("Received Plugin Message:\n");
readString(client_fd);
if (recv_count == -1) return 1;
printf(" Channel: \"%s\"\n", recv_buffer);
if (strcmp(recv_buffer, "minecraft:brand") == 0) {
readString(client_fd);
if (recv_count == -1) return 1;
printf(" Brand: \"%s\"\n", recv_buffer);
}
printf("\n");
return 0;
}
// S->C Finish Configuration
int sc_finishConfiguration (int client_fd) {
writeVarInt(client_fd, 1);
writeVarInt(client_fd, 0x03);
return 0;
}
// S->C Login (play)
int sc_loginPlay (int client_fd) {
writeVarInt(client_fd, 69 + sizeVarInt(MAX_PLAYERS));
writeByte(client_fd, 0x2B);
// entity id
uint32_t entity_id = getClientIndex(client_fd);
send(client_fd, &entity_id, 4, 0);
// hardcore
writeByte(client_fd, false);
// dimensions
writeVarInt(client_fd, 1);
writeVarInt(client_fd, 19);
const char *dimension = "minecraft:overworld";
send(client_fd, dimension, 19, 0);
// maxplayers
writeVarInt(client_fd, MAX_PLAYERS);
// view distance
writeVarInt(client_fd, 2);
// sim distance
writeVarInt(client_fd, 2);
// reduced debug info
writeByte(client_fd, 0);
// respawn screen
writeByte(client_fd, true);
// limited crafting
writeByte(client_fd, false);
// dimension id
writeVarInt(client_fd, 0);
// dimension name
writeVarInt(client_fd, 19);
send(client_fd, dimension, 19, 0);
// hashed seed
writeUint64(client_fd, 0x0123456789ABCDEF);
// gamemode
writeByte(client_fd, GAMEMODE);
// previous gamemode
writeByte(client_fd, 0xFF);
// is debug
writeByte(client_fd, 0);
// is flat
writeByte(client_fd, 0);
// has death location
writeByte(client_fd, 0);
// portal cooldown
writeVarInt(client_fd, 0);
// sea level
writeVarInt(client_fd, 63);
// secure chat
writeByte(client_fd, 0);
return 0;
}
// S->C Synchronize Player Position
int sc_synchronizePlayerPosition (int client_fd, double x, double y, double z, float yaw, float pitch) {
writeVarInt(client_fd, 61 + sizeVarInt(-1));
writeByte(client_fd, 0x41);
// Teleport ID
writeVarInt(client_fd, -1);
// Position
writeDouble(client_fd, x);
writeDouble(client_fd, y);
writeDouble(client_fd, z);
// Velocity
writeDouble(client_fd, 0);
writeDouble(client_fd, 0);
writeDouble(client_fd, 0);
// Angles (Yaw/Pitch)
writeFloat(client_fd, yaw);
writeFloat(client_fd, pitch);
// Flags
writeUint32(client_fd, 0);
return 0;
}
// S->C Set Default Spawn Position
int sc_setDefaultSpawnPosition (int client_fd, long x, long y, long z) {
writeVarInt(client_fd, sizeVarInt(0x5A) + 12);
writeVarInt(client_fd, 0x5A);
writeUint64(client_fd, ((x & 0x3FFFFFF) << 38) | ((z & 0x3FFFFFF) << 12) | (y & 0xFFF));
writeFloat(client_fd, 0);
}
// S->C Game Event 13 (Start waiting for level chunks)
int sc_startWaitingForChunks (int client_fd) {
writeVarInt(client_fd, 6);
writeByte(client_fd, 0x22);
writeByte(client_fd, 13);
writeUint32(client_fd, 0);
return 0;
}
// S->C Set Center Chunk
int sc_setCenterChunk (int client_fd, int x, int y) {
writeVarInt(client_fd, 1 + sizeVarInt(x) + sizeVarInt(y));
writeByte(client_fd, 0x57);
writeVarInt(client_fd, x);
writeVarInt(client_fd, y);
return 0;
}
// S->C Chunk Data and Update Light
int sc_chunkDataAndUpdateLight (int client_fd, int _x, int _z) {
int palette_size = 0;
for (int i = 0; i < 256; i ++) palette_size += sizeVarInt(block_palette[i]);
const int chunk_data_size = (4101 + sizeVarInt(256) + palette_size) * 24;
writeVarInt(client_fd, 17 + sizeVarInt(chunk_data_size) + chunk_data_size);
writeByte(client_fd, 0x27);
writeUint32(client_fd, _x);
writeUint32(client_fd, _z);
writeVarInt(client_fd, 0); // omit heightmaps
writeVarInt(client_fd, chunk_data_size);
int x = _x * 16, z = _z * 16, y;
// send chunk sections
for (int i = 0; i < 24; i ++) {
y = i * 16 - 64;
writeUint16(client_fd, 4096); // block count
writeByte(client_fd, 8); // bits per entry
writeVarInt(client_fd, 256);
for (int j = 0; j < 256; j ++) writeVarInt(client_fd, block_palette[j]);
for (int j = 0; j < 4096; j += 8) {
for (int k = j + 7; k >= j; k --) {
writeByte(client_fd, getBlockAt(
k % 16 + x,
k / 256 + y,
k / 16 % 16 + z
));
}
}
// biome data
writeByte(client_fd, 0); // bits per entry
writeByte(client_fd, 21); // palette (forest)
}
writeVarInt(client_fd, 0); // omit block entities
// light data
writeVarInt(client_fd, 0);
writeVarInt(client_fd, 0);
writeVarInt(client_fd, 0);
writeVarInt(client_fd, 0);
writeVarInt(client_fd, 0);
writeVarInt(client_fd, 0);
return 0;
}
// S->C Clientbound Keep Alive (play)
int sc_keepAlive (int client_fd) {
writeVarInt(client_fd, 9);
writeByte(client_fd, 0x26);
writeUint64(client_fd, 0);
}
// S->C Set Container Slot
int sc_setContainerSlot (int client_fd, int container, uint16_t slot, uint8_t count, uint8_t item) {
writeVarInt(client_fd,
1 +
sizeVarInt(container) +
1 + 2 +
sizeVarInt(count) +
(count > 0 ? sizeVarInt(item) + 2 : 0)
);
writeByte(client_fd, 0x14);
writeVarInt(client_fd, container);
writeVarInt(client_fd, 0);
writeUint16(client_fd, slot);
writeVarInt(client_fd, count);
if (count > 0) {
writeVarInt(client_fd, item);
writeVarInt(client_fd, 0);
writeVarInt(client_fd, 0);
}
return 0;
}
// C->S Player Action
int cs_playerAction (int client_fd) {
uint8_t action = readByte(client_fd);
int64_t pos = readInt64(client_fd);
int x = pos >> 38;
int y = pos << 52 >> 52;
int z = pos << 26 >> 38;
readByte(client_fd); // ignore face
int sequence = readVarInt(client_fd);
if ((action == 0 && GAMEMODE == 1)) {
// block was mined in creative
makeBlockChange(x, y, z, 0);
} else if (action == 2) {
// block was mined in survival
uint8_t block = getBlockAt(x, y, z);
uint8_t item;
if (block == B_oak_leaves) {
if (sequence % 40 < 2) item = I_oak_sapling;
else item = I_air;
} else item = B_to_I[block];
uint8_t *inventory = getPlayerInventory(client_fd);
makeBlockChange(x, y, z, 0);
int slot_pair = -1;
for (int i = 0; i < 36 * 2; i += 2) {
if (inventory[i] == item && inventory[i+1] < 64) {
slot_pair = i;
break;
}
}
if (slot_pair == -1) {
for (int i = 0; i < 36 * 2; i += 2) {
if (inventory[i] == 0 || inventory[i+1] == 0) {
slot_pair = i;
break;
}
}
}
if (item && slot_pair != -1) {
uint8_t slot = serverSlotToClientSlot(slot_pair / 2);
inventory[slot_pair] = item;
inventory[slot_pair + 1] ++;
sc_setContainerSlot(client_fd, 0, slot, inventory[slot_pair + 1], item);
}
}
return 0;
}
// C->S Use Item On
int cs_useItemOn (int client_fd) {
uint8_t hand = readByte(client_fd);
uint64_t pos = readUint64(client_fd);
int x = pos >> 38;
int y = pos << 52 >> 52;
int z = pos << 26 >> 38;
uint8_t face = readByte(client_fd);
// ignore cursor position
readUint32(client_fd);
readUint32(client_fd);
readUint32(client_fd);
// ignore "inside block" and "world border hit"
readByte(client_fd);
readByte(client_fd);
int sequence = readVarInt(client_fd);
// first, get pointer to player inventory
uint8_t *inventory = getPlayerInventory(client_fd);
// then, get pointer to selected hotbar slot
// the hotbar position is in address (inventory - 1)
uint8_t *slot = inventory + (*(inventory - 1)) * 2;
// the inventory is split into id-amount pairs, get the amount address
uint8_t *amount = slot + 1;
// convert the item id to a block id
uint8_t block = I_to_B[*slot];
// if the selected item doesn't correspond to a block, exit
if (block == 0) return 0;
// if the selected slot doesn't hold any items, exit
if (*amount == 0) return 0;
// decrease item amount in selected slot
*amount = *amount - 1;
// clear item id in slot if amount is zero
if (*amount == 0) *slot = 0;
switch (face) {
case 0: makeBlockChange(x, y - 1, z, block); break;
case 1: makeBlockChange(x, y + 1, z, block); break;
case 2: makeBlockChange(x, y, z - 1, block); break;
case 3: makeBlockChange(x, y, z + 1, block); break;
case 4: makeBlockChange(x - 1, y, z, block); break;
case 5: makeBlockChange(x + 1, y, z, block); break;
default: break;
}
return 0;
}
int cs_clickContainer (int client_fd) {
int window_id = readVarInt(client_fd);
readVarInt(client_fd); // ignore state id
readUint16(client_fd); // ignore clicked slot number
readByte(client_fd); // ignore button
readVarInt(client_fd); // ignore operation mode
int changes_count = readVarInt(client_fd);
uint8_t *inventory = getPlayerInventory(client_fd);
uint8_t slot, count;
int item, tmp;
for (int i = 0; i < changes_count; i ++) {
slot = clientSlotToServerSlot(readUint16(client_fd));
if (!readByte(client_fd)) { // no item?
if (slot != 255) {
inventory[slot * 2] = 0;
inventory[slot * 2 + 1] = 0;
}
continue;
}
item = readVarInt(client_fd);
count = (uint8_t)readVarInt(client_fd);
// ignore components
tmp = readVarInt(client_fd);
recv(client_fd, recv_buffer, tmp, MSG_WAITALL);
tmp = readVarInt(client_fd);
recv(client_fd, recv_buffer, tmp, MSG_WAITALL);
if (item <= 255 && count > 0) {
inventory[slot * 2] = (uint8_t)item;
inventory[slot * 2 + 1] = count;
}
}
return 0;
}
// C->S Set Player Position And Rotation
int cs_setPlayerPositionAndRotation (int client_fd, double *x, double *y, double *z, float *yaw, float *pitch) {
*x = readDouble(client_fd);
*y = readDouble(client_fd);
*z = readDouble(client_fd);
*yaw = readFloat(client_fd);
*pitch = readFloat(client_fd);
// ignore flags
readByte(client_fd);
return 0;
}
// C->S Set Player Position
int cs_setPlayerPosition (int client_fd, double *x, double *y, double *z) {
*x = readDouble(client_fd);
*y = readDouble(client_fd);
*z = readDouble(client_fd);
// ignore flags
readByte(client_fd);
return 0;
}
// C->S Set Held Item (serverbound)
int cs_setHeldItem (int client_fd) {
uint8_t *hotbar = getPlayerInventory(client_fd) - 1;
*hotbar = (uint8_t)readUint16(client_fd);
return 0;
}
// S->C Registry Data (Multiple packets)
int sc_registries (int client_fd) {
printf("Sending Registries\n\n");
send(client_fd, registries_bin, sizeof(registries_bin), 0);
char wolf_sound_variant[] = { 0x07, 0x1c, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x6f, 0x6c, 0x66, 0x5f, 0x73, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x07, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x61, 0x6e, 0x67, 0x72, 0x79, 0x00, 0x0d, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x62, 0x69, 0x67, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x63, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x75, 0x74, 0x65, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x67, 0x72, 0x75, 0x6d, 0x70, 0x79, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x70, 0x75, 0x67, 0x6c, 0x69, 0x6e, 0x00, 0x0d, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x61, 0x64, 0x00 };
char pig_variant[] = { 0x07, 0x15, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x70, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x03, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x6f, 0x6c, 0x64, 0x00, 0x13, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x61, 0x72, 0x6d, 0x00 };
char frog_variant[] = { 0x07, 0x16, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x66, 0x72, 0x6f, 0x67, 0x5f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x03, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x6f, 0x6c, 0x64, 0x00, 0x13, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x61, 0x72, 0x6d, 0x00 };
char cat_variant[] = { 0x07, 0x15, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x61, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x0b, 0x13, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x61, 0x6c, 0x6c, 0x5f, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x00, 0x1b, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x62, 0x72, 0x69, 0x74, 0x69, 0x73, 0x68, 0x5f, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x68, 0x61, 0x69, 0x72, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x61, 0x6c, 0x69, 0x63, 0x6f, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6a, 0x65, 0x6c, 0x6c, 0x69, 0x65, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x70, 0x65, 0x72, 0x73, 0x69, 0x61, 0x6e, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x72, 0x61, 0x67, 0x64, 0x6f, 0x6c, 0x6c, 0x00, 0x0d, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x72, 0x65, 0x64, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x69, 0x61, 0x6d, 0x65, 0x73, 0x65, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x74, 0x61, 0x62, 0x62, 0x79, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x68, 0x69, 0x74, 0x65, 0x00 };
char cow_variant[] = { 0x07, 0x15, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x6f, 0x77, 0x5f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x03, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x6f, 0x6c, 0x64, 0x00, 0x13, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x61, 0x72, 0x6d, 0x00 };
char chicken_variant[] = { 0x07, 0x19, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x68, 0x69, 0x63, 0x6b, 0x65, 0x6e, 0x5f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x03, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x6f, 0x6c, 0x64, 0x00, 0x13, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x61, 0x72, 0x6d, 0x00 };
writeVarInt(client_fd, sizeof(wolf_sound_variant));
send(client_fd, &wolf_sound_variant, sizeof(wolf_sound_variant), 0);
writeVarInt(client_fd, sizeof(pig_variant));
send(client_fd, &pig_variant, sizeof(pig_variant), 0);
writeVarInt(client_fd, sizeof(frog_variant));
send(client_fd, &frog_variant, sizeof(frog_variant), 0);
writeVarInt(client_fd, sizeof(cat_variant));
send(client_fd, &cat_variant, sizeof(cat_variant), 0);
writeVarInt(client_fd, sizeof(cow_variant));
send(client_fd, &cow_variant, sizeof(cow_variant), 0);
writeVarInt(client_fd, sizeof(chicken_variant));
send(client_fd, &chicken_variant, sizeof(chicken_variant), 0);
return 0;
}

28
src/packets.h Normal file
View File

@@ -0,0 +1,28 @@
#ifndef H_PACKETS
#define H_PACKETS
int cs_handshake (int client_fd);
int cs_loginStart (int client_fd);
int cs_clientInformation (int client_fd);
int cs_pluginMessage (int client_fd);
int cs_playerAction (int client_fd);
int cs_useItemOn (int client_fd);
int cs_setPlayerPositionAndRotation (int client_fd, double *x, double *y, double *z, float *yaw, float *pitch);
int cs_setPlayerPosition (int client_fd, double *x, double *y, double *z);
int cs_setHeldItem (int client_fd);
int cs_clickContainer (int client_fd);
int sc_loginSuccess (int client_fd, char *name, char *uuid);
int sc_knownPacks (int client_fd);
int sc_finishConfiguration (int client_fd);
int sc_loginPlay (int client_fd);
int sc_synchronizePlayerPosition (int client_fd, double x, double y, double z, float yaw, float pitch);
int sc_setDefaultSpawnPosition (int client_fd, long x, long y, long z);
int sc_startWaitingForChunks (int client_fd);
int sc_setCenterChunk (int client_fd, int x, int y);
int sc_chunkDataAndUpdateLight (int client_fd, int _x, int _z);
int sc_keepAlive (int client_fd);
int sc_setContainerSlot (int client_fd, int container, uint16_t slot, uint8_t count, uint8_t item);
int sc_registries(int client_fd);
#endif

490
src/registries.c Normal file
View File

@@ -0,0 +1,490 @@
#include <stdint.h>
#include "registries.h"
// Binary contents of required "Registry Data" packets
uint8_t registries_bin[] = {
0x8c, 0x08, 0x07, 0x18, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x62, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x70, 0x61, 0x74,
0x74, 0x65, 0x72, 0x6e, 0x2b, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x62, 0x61, 0x73, 0x65, 0x00, 0x10, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x62, 0x6f, 0x72, 0x64,
0x65, 0x72, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x62, 0x72, 0x69, 0x63, 0x6b, 0x73, 0x00, 0x10, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x69, 0x72, 0x63,
0x6c, 0x65, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x63, 0x72, 0x65, 0x65, 0x70, 0x65, 0x72, 0x00, 0x0f, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x72, 0x6f,
0x73, 0x73, 0x00, 0x16, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x63, 0x75, 0x72, 0x6c, 0x79, 0x5f, 0x62, 0x6f, 0x72, 0x64,
0x65, 0x72, 0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x64, 0x69, 0x61, 0x67, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x6c,
0x65, 0x66, 0x74, 0x00, 0x18, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x64, 0x69, 0x61, 0x67, 0x6f, 0x6e, 0x61, 0x6c, 0x5f,
0x72, 0x69, 0x67, 0x68, 0x74, 0x00, 0x1a, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x64, 0x69, 0x61, 0x67, 0x6f, 0x6e, 0x61,
0x6c, 0x5f, 0x75, 0x70, 0x5f, 0x6c, 0x65, 0x66, 0x74, 0x00, 0x1b, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x64, 0x69, 0x61,
0x67, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x75, 0x70, 0x5f, 0x72, 0x69, 0x67,
0x68, 0x74, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x66, 0x6c, 0x6f, 0x77, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x66, 0x6c, 0x6f, 0x77, 0x65, 0x72,
0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x67, 0x6c, 0x6f, 0x62, 0x65, 0x00, 0x12, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x67, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e,
0x74, 0x00, 0x15, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x67, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x75, 0x70,
0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x67, 0x75, 0x73, 0x74, 0x65, 0x72, 0x00, 0x19, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x68, 0x61, 0x6c, 0x66, 0x5f, 0x68,
0x6f, 0x72, 0x69, 0x7a, 0x6f, 0x6e, 0x74, 0x61, 0x6c, 0x00, 0x20, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x68, 0x61, 0x6c,
0x66, 0x5f, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x6f, 0x6e, 0x74, 0x61, 0x6c,
0x5f, 0x62, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x00, 0x17, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x68, 0x61, 0x6c, 0x66, 0x5f,
0x76, 0x65, 0x72, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x00, 0x1d, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x68, 0x61, 0x6c, 0x66,
0x5f, 0x76, 0x65, 0x72, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x72, 0x69,
0x67, 0x68, 0x74, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x6d, 0x6f, 0x6a, 0x61, 0x6e, 0x67, 0x00, 0x10, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x70, 0x69, 0x67,
0x6c, 0x69, 0x6e, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x72, 0x68, 0x6f, 0x6d, 0x62, 0x75, 0x73, 0x00, 0x0f,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x6b,
0x75, 0x6c, 0x6c, 0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x74, 0x72,
0x69, 0x70, 0x65, 0x73, 0x00, 0x1c, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x73, 0x71, 0x75, 0x61, 0x72, 0x65, 0x5f, 0x62,
0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x5f, 0x6c, 0x65, 0x66, 0x74, 0x00, 0x1d,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x71,
0x75, 0x61, 0x72, 0x65, 0x5f, 0x62, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x5f,
0x72, 0x69, 0x67, 0x68, 0x74, 0x00, 0x19, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x71, 0x75, 0x61, 0x72, 0x65, 0x5f,
0x74, 0x6f, 0x70, 0x5f, 0x6c, 0x65, 0x66, 0x74, 0x00, 0x1a, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x71, 0x75, 0x61,
0x72, 0x65, 0x5f, 0x74, 0x6f, 0x70, 0x5f, 0x72, 0x69, 0x67, 0x68, 0x74,
0x00, 0x18, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x73, 0x74, 0x72, 0x61, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x63, 0x72, 0x6f,
0x73, 0x73, 0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x73, 0x74, 0x72, 0x69, 0x70, 0x65, 0x5f, 0x62, 0x6f, 0x74,
0x74, 0x6f, 0x6d, 0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x73, 0x74, 0x72, 0x69, 0x70, 0x65, 0x5f, 0x63, 0x65,
0x6e, 0x74, 0x65, 0x72, 0x00, 0x19, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x73, 0x74, 0x72, 0x69, 0x70, 0x65, 0x5f, 0x64,
0x6f, 0x77, 0x6e, 0x6c, 0x65, 0x66, 0x74, 0x00, 0x1a, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x74, 0x72, 0x69, 0x70,
0x65, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x72, 0x69, 0x67, 0x68, 0x74, 0x00,
0x15, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73,
0x74, 0x72, 0x69, 0x70, 0x65, 0x5f, 0x6c, 0x65, 0x66, 0x74, 0x00, 0x17,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x74,
0x72, 0x69, 0x70, 0x65, 0x5f, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x00,
0x16, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73,
0x74, 0x72, 0x69, 0x70, 0x65, 0x5f, 0x72, 0x69, 0x67, 0x68, 0x74, 0x00,
0x14, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73,
0x74, 0x72, 0x69, 0x70, 0x65, 0x5f, 0x74, 0x6f, 0x70, 0x00, 0x19, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x74, 0x72, 0x69,
0x61, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x62, 0x6f, 0x74, 0x74, 0x6f, 0x6d,
0x00, 0x16, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x74, 0x72, 0x69, 0x61, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x74, 0x6f, 0x70,
0x00, 0x1a, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x74, 0x72, 0x69, 0x61, 0x6e, 0x67, 0x6c, 0x65, 0x73, 0x5f, 0x62, 0x6f,
0x74, 0x74, 0x6f, 0x6d, 0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x74, 0x72, 0x69, 0x61, 0x6e, 0x67, 0x6c, 0x65,
0x73, 0x5f, 0x74, 0x6f, 0x70, 0x00, 0xe0, 0x01, 0x07, 0x13, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x68, 0x61, 0x74,
0x5f, 0x74, 0x79, 0x70, 0x65, 0x07, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x68, 0x61, 0x74, 0x00, 0x17, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x65, 0x6d, 0x6f,
0x74, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x00, 0x1e,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6d, 0x73,
0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x69, 0x6e,
0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x00, 0x1e, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6d, 0x73, 0x67, 0x5f, 0x63, 0x6f,
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x6f, 0x75, 0x74, 0x67, 0x6f, 0x69,
0x6e, 0x67, 0x00, 0x15, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x73, 0x61, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
0x64, 0x00, 0x23, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x6d, 0x73, 0x67, 0x5f, 0x63, 0x6f,
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x69,
0x6e, 0x67, 0x00, 0x23, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x6d, 0x73, 0x67, 0x5f, 0x63,
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x6f, 0x75, 0x74, 0x67, 0x6f,
0x69, 0x6e, 0x67, 0x00, 0xb5, 0x08, 0x07, 0x15, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x64, 0x61, 0x6d, 0x61, 0x67, 0x65,
0x5f, 0x74, 0x79, 0x70, 0x65, 0x30, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x61, 0x72, 0x72, 0x6f, 0x77, 0x00, 0x1b,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x62, 0x61,
0x64, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x61, 0x77, 0x6e, 0x5f, 0x70, 0x6f,
0x69, 0x6e, 0x74, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x63, 0x61, 0x63, 0x74, 0x75, 0x73, 0x00, 0x12, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x61, 0x6d,
0x70, 0x66, 0x69, 0x72, 0x65, 0x00, 0x12, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x72, 0x61, 0x6d, 0x6d, 0x69, 0x6e,
0x67, 0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x64, 0x72, 0x61, 0x67, 0x6f, 0x6e, 0x5f, 0x62, 0x72, 0x65, 0x61,
0x74, 0x68, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x64, 0x72, 0x6f, 0x77, 0x6e, 0x00, 0x11, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x64, 0x72, 0x79, 0x5f, 0x6f,
0x75, 0x74, 0x00, 0x15, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x70, 0x65, 0x61, 0x72,
0x6c, 0x00, 0x13, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x0e,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x66, 0x61,
0x6c, 0x6c, 0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x66, 0x61, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x6e,
0x76, 0x69, 0x6c, 0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x66, 0x61, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x62,
0x6c, 0x6f, 0x63, 0x6b, 0x00, 0x1c, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x66, 0x61, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x5f,
0x73, 0x74, 0x61, 0x6c, 0x61, 0x63, 0x74, 0x69, 0x74, 0x65, 0x00, 0x12,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x66, 0x69,
0x72, 0x65, 0x62, 0x61, 0x6c, 0x6c, 0x00, 0x13, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x66, 0x69, 0x72, 0x65, 0x77, 0x6f,
0x72, 0x6b, 0x73, 0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x66, 0x6c, 0x79, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f,
0x77, 0x61, 0x6c, 0x6c, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x66, 0x72, 0x65, 0x65, 0x7a, 0x65, 0x00, 0x11,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x67, 0x65,
0x6e, 0x65, 0x72, 0x69, 0x63, 0x00, 0x16, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63,
0x5f, 0x6b, 0x69, 0x6c, 0x6c, 0x00, 0x13, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x68, 0x6f, 0x74, 0x5f, 0x66, 0x6c, 0x6f,
0x6f, 0x72, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x69, 0x6e, 0x5f, 0x66, 0x69, 0x72, 0x65, 0x00, 0x11, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x69, 0x6e, 0x5f,
0x77, 0x61, 0x6c, 0x6c, 0x00, 0x18, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x69, 0x6e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74,
0x5f, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6c, 0x61, 0x76, 0x61, 0x00, 0x18,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6c, 0x69,
0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x62, 0x6f, 0x6c, 0x74,
0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x6d, 0x61, 0x67, 0x69, 0x63, 0x00, 0x14, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x6d, 0x6f, 0x62, 0x5f, 0x61, 0x74, 0x74,
0x61, 0x63, 0x6b, 0x00, 0x1d, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x6d, 0x6f, 0x62, 0x5f, 0x61, 0x74, 0x74, 0x61, 0x63,
0x6b, 0x5f, 0x6e, 0x6f, 0x5f, 0x61, 0x67, 0x67, 0x72, 0x6f, 0x00, 0x18,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6d, 0x6f,
0x62, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6c, 0x65,
0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x72, 0x65, 0x00, 0x16, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6f, 0x75, 0x74, 0x5f, 0x6f,
0x66, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00, 0x18, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6f, 0x75, 0x74, 0x73, 0x69,
0x64, 0x65, 0x5f, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x00, 0x17, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x70, 0x6c, 0x61,
0x79, 0x65, 0x72, 0x5f, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x00, 0x1a,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x70, 0x6c,
0x61, 0x79, 0x65, 0x72, 0x5f, 0x65, 0x78, 0x70, 0x6c, 0x6f, 0x73, 0x69,
0x6f, 0x6e, 0x00, 0x14, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x73, 0x6f, 0x6e, 0x69, 0x63, 0x5f, 0x62, 0x6f, 0x6f, 0x6d,
0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x73, 0x70, 0x69, 0x74, 0x00, 0x14, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x73, 0x74, 0x61, 0x6c, 0x61, 0x67, 0x6d, 0x69,
0x74, 0x65, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x73, 0x74, 0x61, 0x72, 0x76, 0x65, 0x00, 0x0f, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x74, 0x69, 0x6e,
0x67, 0x00, 0x1a, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x73, 0x77, 0x65, 0x65, 0x74, 0x5f, 0x62, 0x65, 0x72, 0x72, 0x79,
0x5f, 0x62, 0x75, 0x73, 0x68, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x74, 0x68, 0x6f, 0x72, 0x6e, 0x73, 0x00,
0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x74,
0x68, 0x72, 0x6f, 0x77, 0x6e, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x74, 0x72, 0x69, 0x64, 0x65, 0x6e, 0x74,
0x00, 0x1f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x75, 0x6e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64,
0x5f, 0x66, 0x69, 0x72, 0x65, 0x62, 0x61, 0x6c, 0x6c, 0x00, 0x15, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x69, 0x6e,
0x64, 0x5f, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x00, 0x10, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x69, 0x74, 0x68,
0x65, 0x72, 0x00, 0x16, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x77, 0x69, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x73, 0x6b, 0x75,
0x6c, 0x6c, 0x00, 0x74, 0x07, 0x18, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x64, 0x69, 0x6d, 0x65, 0x6e, 0x73, 0x69, 0x6f,
0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x04, 0x13, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x6f,
0x72, 0x6c, 0x64, 0x00, 0x19, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x6f, 0x72, 0x6c, 0x64,
0x5f, 0x63, 0x61, 0x76, 0x65, 0x73, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x74, 0x68, 0x65, 0x5f, 0x65, 0x6e,
0x64, 0x00, 0x14, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x74, 0x68, 0x65, 0x5f, 0x6e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x00,
0xc2, 0x07, 0x07, 0x1a, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x76,
0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x32, 0x0f, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x61, 0x6c, 0x62, 0x61, 0x6e, 0x00,
0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x61,
0x7a, 0x74, 0x65, 0x63, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x61, 0x7a, 0x74, 0x65, 0x63, 0x32, 0x00, 0x12,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x62, 0x61,
0x63, 0x6b, 0x79, 0x61, 0x72, 0x64, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x62, 0x61, 0x72, 0x6f, 0x71, 0x75,
0x65, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x62, 0x6f, 0x6d, 0x62, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x62, 0x6f, 0x75, 0x71, 0x75, 0x65, 0x74,
0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x62, 0x75, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x6b, 0x75, 0x6c,
0x6c, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x62, 0x75, 0x73, 0x74, 0x00, 0x12, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x61, 0x76, 0x65, 0x62, 0x69, 0x72,
0x64, 0x00, 0x12, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x69, 0x6e, 0x67, 0x00, 0x0f, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x6f, 0x74,
0x61, 0x6e, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x63, 0x6f, 0x75, 0x72, 0x62, 0x65, 0x74, 0x00, 0x11, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x72, 0x65,
0x65, 0x62, 0x65, 0x74, 0x00, 0x15, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x64, 0x6f, 0x6e, 0x6b, 0x65, 0x79, 0x5f, 0x6b,
0x6f, 0x6e, 0x67, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x65, 0x61, 0x72, 0x74, 0x68, 0x00, 0x11, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x65, 0x6e, 0x64, 0x62,
0x6f, 0x73, 0x73, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x66, 0x65, 0x72, 0x6e, 0x00, 0x12, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x66, 0x69, 0x67, 0x68, 0x74,
0x65, 0x72, 0x73, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x66, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x00, 0x0e,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x66, 0x69,
0x72, 0x65, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x67, 0x72, 0x61, 0x68, 0x61, 0x6d, 0x00, 0x10, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x68, 0x75, 0x6d, 0x62,
0x6c, 0x65, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x6b, 0x65, 0x62, 0x61, 0x62, 0x00, 0x11, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6c, 0x6f, 0x77, 0x6d, 0x69,
0x73, 0x74, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, 0x14, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6d, 0x65, 0x64, 0x69, 0x74,
0x61, 0x74, 0x69, 0x76, 0x65, 0x00, 0x0d, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x6f, 0x72, 0x62, 0x00, 0x12, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6f, 0x77, 0x6c, 0x65,
0x6d, 0x6f, 0x6e, 0x73, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x70, 0x61, 0x73, 0x73, 0x61, 0x67, 0x65, 0x00,
0x12, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x70,
0x69, 0x67, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x00, 0x0f, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x70, 0x6c, 0x61, 0x6e, 0x74,
0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x00, 0x0e, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x70, 0x6f, 0x6e, 0x64, 0x00,
0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x70,
0x6f, 0x6f, 0x6c, 0x00, 0x16, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x70, 0x72, 0x61, 0x69, 0x72, 0x69, 0x65, 0x5f, 0x72,
0x69, 0x64, 0x65, 0x00, 0x0d, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x73, 0x65, 0x61, 0x00, 0x12, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x6b, 0x65, 0x6c, 0x65, 0x74,
0x6f, 0x6e, 0x00, 0x19, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x73, 0x6b, 0x75, 0x6c, 0x6c, 0x5f, 0x61, 0x6e, 0x64, 0x5f,
0x72, 0x6f, 0x73, 0x65, 0x73, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x74, 0x61, 0x67, 0x65, 0x00, 0x14,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x75,
0x6e, 0x66, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x73, 0x00, 0x10, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x75, 0x6e, 0x73,
0x65, 0x74, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x74, 0x69, 0x64, 0x65, 0x73, 0x00, 0x12, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x75, 0x6e, 0x70, 0x61, 0x63,
0x6b, 0x65, 0x64, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x76, 0x6f, 0x69, 0x64, 0x00, 0x12, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x61, 0x6e, 0x64, 0x65,
0x72, 0x65, 0x72, 0x00, 0x13, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x77, 0x61, 0x73, 0x74, 0x65, 0x6c, 0x61, 0x6e, 0x64,
0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x77, 0x61, 0x74, 0x65, 0x72, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x69, 0x6e, 0x64, 0x00, 0x10, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x69, 0x74,
0x68, 0x65, 0x72, 0x00, 0xd2, 0x01, 0x07, 0x17, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x74, 0x72, 0x69, 0x6d, 0x5f, 0x6d,
0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x0a, 0x12, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x61, 0x6d, 0x65, 0x74, 0x68,
0x79, 0x73, 0x74, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x63, 0x6f, 0x70, 0x70, 0x65, 0x72, 0x00, 0x11, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x64, 0x69, 0x61,
0x6d, 0x6f, 0x6e, 0x64, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x64, 0x00,
0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x67,
0x6f, 0x6c, 0x64, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x69, 0x72, 0x6f, 0x6e, 0x00, 0x0f, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6c, 0x61, 0x70, 0x69, 0x73,
0x00, 0x13, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x6e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x69, 0x74, 0x65, 0x00, 0x10, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x71, 0x75, 0x61,
0x72, 0x74, 0x7a, 0x00, 0x12, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x72, 0x65, 0x64, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x00,
0xc7, 0x02, 0x07, 0x16, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x74, 0x72, 0x69, 0x6d, 0x5f, 0x70, 0x61, 0x74, 0x74, 0x65,
0x72, 0x6e, 0x12, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x62, 0x6f, 0x6c, 0x74, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x6f, 0x61, 0x73, 0x74, 0x00,
0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x64,
0x75, 0x6e, 0x65, 0x00, 0x0d, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x65, 0x79, 0x65, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x66, 0x6c, 0x6f, 0x77, 0x00, 0x0e,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x68, 0x6f,
0x73, 0x74, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x72, 0x61, 0x69, 0x73, 0x65, 0x72, 0x00, 0x0d, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x72, 0x69, 0x62, 0x00,
0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73,
0x65, 0x6e, 0x74, 0x72, 0x79, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x68, 0x61, 0x70, 0x65, 0x72, 0x00,
0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73,
0x69, 0x6c, 0x65, 0x6e, 0x63, 0x65, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x6e, 0x6f, 0x75, 0x74, 0x00,
0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73,
0x70, 0x69, 0x72, 0x65, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x74, 0x69, 0x64, 0x65, 0x00, 0x0d, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x76, 0x65, 0x78, 0x00,
0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77,
0x61, 0x72, 0x64, 0x00, 0x13, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x77, 0x61, 0x79, 0x66, 0x69, 0x6e, 0x64, 0x65, 0x72,
0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x77, 0x69, 0x6c, 0x64, 0x00, 0xb8, 0x01, 0x07, 0x16, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x6f, 0x6c, 0x66, 0x5f,
0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x09, 0x0f, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x61, 0x73, 0x68, 0x65, 0x6e,
0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x62, 0x6c, 0x61, 0x63, 0x6b, 0x00, 0x12, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x68, 0x65, 0x73, 0x74, 0x6e, 0x75,
0x74, 0x00, 0x0e, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x70, 0x61, 0x6c, 0x65, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x72, 0x75, 0x73, 0x74, 0x79, 0x00, 0x0f,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x6e,
0x6f, 0x77, 0x79, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x73, 0x70, 0x6f, 0x74, 0x74, 0x65, 0x64, 0x00, 0x11,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x74,
0x72, 0x69, 0x70, 0x65, 0x64, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x6f, 0x6f, 0x64, 0x73, 0x00, 0x9d,
0x0c, 0x07, 0x18, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x67, 0x65, 0x6e, 0x2f, 0x62, 0x69,
0x6f, 0x6d, 0x65, 0x40, 0x12, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x62, 0x61, 0x64, 0x6c, 0x61, 0x6e, 0x64, 0x73, 0x00,
0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x62,
0x61, 0x6d, 0x62, 0x6f, 0x6f, 0x5f, 0x6a, 0x75, 0x6e, 0x67, 0x6c, 0x65,
0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x62, 0x61, 0x73, 0x61, 0x6c, 0x74, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61,
0x73, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x62, 0x65, 0x61, 0x63, 0x68, 0x00, 0x16, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x62, 0x69, 0x72, 0x63, 0x68, 0x5f,
0x66, 0x6f, 0x72, 0x65, 0x73, 0x74, 0x00, 0x16, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x68, 0x65, 0x72, 0x72, 0x79,
0x5f, 0x67, 0x72, 0x6f, 0x76, 0x65, 0x00, 0x14, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x63, 0x6f, 0x6c, 0x64, 0x5f, 0x6f,
0x63, 0x65, 0x61, 0x6e, 0x00, 0x18, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x63, 0x72, 0x69, 0x6d, 0x73, 0x6f, 0x6e, 0x5f,
0x66, 0x6f, 0x72, 0x65, 0x73, 0x74, 0x00, 0x15, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x64, 0x61, 0x72, 0x6b, 0x5f, 0x66,
0x6f, 0x72, 0x65, 0x73, 0x74, 0x00, 0x19, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x64, 0x65, 0x65, 0x70, 0x5f, 0x63, 0x6f,
0x6c, 0x64, 0x5f, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x00, 0x13, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x64, 0x65, 0x65, 0x70,
0x5f, 0x64, 0x61, 0x72, 0x6b, 0x00, 0x1b, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x64, 0x65, 0x65, 0x70, 0x5f, 0x66, 0x72,
0x6f, 0x7a, 0x65, 0x6e, 0x5f, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x00, 0x1d,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x64, 0x65,
0x65, 0x70, 0x5f, 0x6c, 0x75, 0x6b, 0x65, 0x77, 0x61, 0x72, 0x6d, 0x5f,
0x6f, 0x63, 0x65, 0x61, 0x6e, 0x00, 0x14, 0x6d, 0x69, 0x6e, 0x65, 0x63,
0x72, 0x61, 0x66, 0x74, 0x3a, 0x64, 0x65, 0x65, 0x70, 0x5f, 0x6f, 0x63,
0x65, 0x61, 0x6e, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x64, 0x65, 0x73, 0x65, 0x72, 0x74, 0x00, 0x19, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x64, 0x72, 0x69,
0x70, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x5f, 0x63, 0x61, 0x76, 0x65, 0x73,
0x00, 0x15, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x65, 0x6e, 0x64, 0x5f, 0x62, 0x61, 0x72, 0x72, 0x65, 0x6e, 0x73, 0x00,
0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x65,
0x6e, 0x64, 0x5f, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x61, 0x6e, 0x64, 0x73,
0x00, 0x16, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x65, 0x6e, 0x64, 0x5f, 0x6d, 0x69, 0x64, 0x6c, 0x61, 0x6e, 0x64, 0x73,
0x00, 0x19, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x65, 0x72, 0x6f, 0x64, 0x65, 0x64, 0x5f, 0x62, 0x61, 0x64, 0x6c, 0x61,
0x6e, 0x64, 0x73, 0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x66, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x66, 0x6f,
0x72, 0x65, 0x73, 0x74, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x66, 0x6f, 0x72, 0x65, 0x73, 0x74, 0x00, 0x16,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x66, 0x72,
0x6f, 0x7a, 0x65, 0x6e, 0x5f, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x00, 0x16,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x66, 0x72,
0x6f, 0x7a, 0x65, 0x6e, 0x5f, 0x70, 0x65, 0x61, 0x6b, 0x73, 0x00, 0x16,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x66, 0x72,
0x6f, 0x7a, 0x65, 0x6e, 0x5f, 0x72, 0x69, 0x76, 0x65, 0x72, 0x00, 0x0f,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x67, 0x72,
0x6f, 0x76, 0x65, 0x00, 0x14, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x70, 0x69, 0x6b, 0x65,
0x73, 0x00, 0x16, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x6a, 0x61, 0x67, 0x67, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x61, 0x6b,
0x73, 0x00, 0x10, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x6a, 0x75, 0x6e, 0x67, 0x6c, 0x65, 0x00, 0x18, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6c, 0x75, 0x6b, 0x65, 0x77,
0x61, 0x72, 0x6d, 0x5f, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x00, 0x14, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6c, 0x75, 0x73,
0x68, 0x5f, 0x63, 0x61, 0x76, 0x65, 0x73, 0x00, 0x18, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6d, 0x61, 0x6e, 0x67, 0x72,
0x6f, 0x76, 0x65, 0x5f, 0x73, 0x77, 0x61, 0x6d, 0x70, 0x00, 0x10, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6d, 0x65, 0x61,
0x64, 0x6f, 0x77, 0x00, 0x19, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x6d, 0x75, 0x73, 0x68, 0x72, 0x6f, 0x6f, 0x6d, 0x5f,
0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6e, 0x65, 0x74, 0x68, 0x65, 0x72,
0x5f, 0x77, 0x61, 0x73, 0x74, 0x65, 0x73, 0x00, 0x0f, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6f, 0x63, 0x65, 0x61, 0x6e,
0x00, 0x21, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x6f, 0x6c, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x77, 0x74, 0x68, 0x5f, 0x62,
0x69, 0x72, 0x63, 0x68, 0x5f, 0x66, 0x6f, 0x72, 0x65, 0x73, 0x74, 0x00,
0x1f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6f,
0x6c, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x77, 0x74, 0x68, 0x5f, 0x70, 0x69,
0x6e, 0x65, 0x5f, 0x74, 0x61, 0x69, 0x67, 0x61, 0x00, 0x21, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x6f, 0x6c, 0x64, 0x5f,
0x67, 0x72, 0x6f, 0x77, 0x74, 0x68, 0x5f, 0x73, 0x70, 0x72, 0x75, 0x63,
0x65, 0x5f, 0x74, 0x61, 0x69, 0x67, 0x61, 0x00, 0x10, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x70, 0x6c, 0x61, 0x69, 0x6e,
0x73, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x72, 0x69, 0x76, 0x65, 0x72, 0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x61, 0x76, 0x61, 0x6e, 0x6e,
0x61, 0x00, 0x19, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x73, 0x61, 0x76, 0x61, 0x6e, 0x6e, 0x61, 0x5f, 0x70, 0x6c, 0x61,
0x74, 0x65, 0x61, 0x75, 0x00, 0x1b, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72,
0x61, 0x66, 0x74, 0x3a, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x5f, 0x65, 0x6e,
0x64, 0x5f, 0x69, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x73, 0x00, 0x15, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x6e, 0x6f,
0x77, 0x79, 0x5f, 0x62, 0x65, 0x61, 0x63, 0x68, 0x00, 0x16, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x6e, 0x6f, 0x77,
0x79, 0x5f, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0x73, 0x00, 0x16, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x6e, 0x6f, 0x77,
0x79, 0x5f, 0x73, 0x6c, 0x6f, 0x70, 0x65, 0x73, 0x00, 0x15, 0x6d, 0x69,
0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x6e, 0x6f, 0x77,
0x79, 0x5f, 0x74, 0x61, 0x69, 0x67, 0x61, 0x00, 0x1a, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x6f, 0x75, 0x6c, 0x5f,
0x73, 0x61, 0x6e, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x6c, 0x65, 0x79, 0x00,
0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73,
0x70, 0x61, 0x72, 0x73, 0x65, 0x5f, 0x6a, 0x75, 0x6e, 0x67, 0x6c, 0x65,
0x00, 0x15, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x73, 0x74, 0x6f, 0x6e, 0x79, 0x5f, 0x70, 0x65, 0x61, 0x6b, 0x73, 0x00,
0x15, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73,
0x74, 0x6f, 0x6e, 0x79, 0x5f, 0x73, 0x68, 0x6f, 0x72, 0x65, 0x00, 0x1a,
0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x73, 0x75,
0x6e, 0x66, 0x6c, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x70, 0x6c, 0x61, 0x69,
0x6e, 0x73, 0x00, 0x0f, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x73, 0x77, 0x61, 0x6d, 0x70, 0x00, 0x0f, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x74, 0x61, 0x69, 0x67, 0x61,
0x00, 0x11, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a,
0x74, 0x68, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x00, 0x12, 0x6d, 0x69, 0x6e,
0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x74, 0x68, 0x65, 0x5f, 0x76,
0x6f, 0x69, 0x64, 0x00, 0x14, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61,
0x66, 0x74, 0x3a, 0x77, 0x61, 0x72, 0x6d, 0x5f, 0x6f, 0x63, 0x65, 0x61,
0x6e, 0x00, 0x17, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74,
0x3a, 0x77, 0x61, 0x72, 0x70, 0x65, 0x64, 0x5f, 0x66, 0x6f, 0x72, 0x65,
0x73, 0x74, 0x00, 0x1a, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x77, 0x69, 0x6e, 0x64, 0x73, 0x77, 0x65, 0x70, 0x74, 0x5f,
0x66, 0x6f, 0x72, 0x65, 0x73, 0x74, 0x00, 0x22, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x69, 0x6e, 0x64, 0x73, 0x77,
0x65, 0x70, 0x74, 0x5f, 0x67, 0x72, 0x61, 0x76, 0x65, 0x6c, 0x6c, 0x79,
0x5f, 0x68, 0x69, 0x6c, 0x6c, 0x73, 0x00, 0x19, 0x6d, 0x69, 0x6e, 0x65,
0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x69, 0x6e, 0x64, 0x73, 0x77,
0x65, 0x70, 0x74, 0x5f, 0x68, 0x69, 0x6c, 0x6c, 0x73, 0x00, 0x1b, 0x6d,
0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0x3a, 0x77, 0x69, 0x6e,
0x64, 0x73, 0x77, 0x65, 0x70, 0x74, 0x5f, 0x73, 0x61, 0x76, 0x61, 0x6e,
0x6e, 0x61, 0x00, 0x19, 0x6d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66,
0x74, 0x3a, 0x77, 0x6f, 0x6f, 0x64, 0x65, 0x64, 0x5f, 0x62, 0x61, 0x64,
0x6c, 0x61, 0x6e, 0x64, 0x73, 0x00
};
// Block-to-item mapping
uint8_t B_to_I[] = { 0, 1, 2, 3, 4, 5, 6, 7, 27, 28, 29, 30, 35, 36, 37, 38, 39, 40, 41, 42, 177, 43, 44, 45, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 0, 59, 60, 62, 63, 61, 70, 71, 66, 67, 64, 65, 80, 134, 135, 136, 137, 138, 139, 141, 140, 142, 143, 144, 147, 149, 150, 151, 152, 153, 154, 155, 148, 156, 170, 171, 172, 173, 174, 175, 176, 178, 179, 159, 160, 161, 162, 163, 164, 165, 166, 167, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 76, 77, 197, 0, 198, 199, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 201, 202, 203, 207, 204, 209, 210, 211, 0, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 244, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 243, 242, 247, 248, 92, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 79, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // 256
// Item-to-block mapping
uint8_t I_to_B[] = { 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 9, 10, 11, 0, 0, 0, 0, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 0, 0, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 40, 38, 39, 45, 46, 43, 44, 0, 0, 41, 42, 228, 229, 0, 0, 101, 102, 182, 183, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, 0, 169, 184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 49, 50, 51, 52, 53, 55, 54, 56, 57, 58, 0, 0, 59, 67, 60, 61, 62, 63, 64, 65, 66, 68, 0, 0, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 69, 70, 71, 72, 73, 74, 75, 20, 76, 77, 0, 0, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 0, 103, 105, 106, 107, 128, 129, 130, 132, 0, 0, 131, 0, 133, 134, 135, 0, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 0, 0, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 166, 165, 154, 0, 0, 167, 168, 0, 0, 0, 0, 0, 0, 0 }; // 256
// Block palette
uint16_t block_palette[] = { 0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 26, 27, 28, 29, 31, 33, 35, 37, 39, 41, 43, 50, 85, 86, 118, 119, 123, 124, 125, 129, 130, 131, 132, 133, 134, 135, 137, 140, 143, 146, 149, 152, 155, 158, 161, 164, 166, 169, 172, 175, 178, 181, 184, 187, 190, 193, 196, 199, 202, 205, 208, 211, 214, 217, 220, 223, 226, 229, 232, 235, 238, 241, 244, 247, 250, 279, 307, 335, 363, 391, 419, 447, 475, 503, 531, 559, 560, 561, 562, 563, 564, 565, 567, 578, 579, 580, 582, 1734, 1750, 1766, 1782, 1798, 1814, 1830, 1846, 1862, 1878, 1894, 1910, 1926, 1942, 1958, 1974, 2000, 2024, 2041, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2063, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107, 2108, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2141, 2142, 2206, 2399, 2400, 2401, 2919, 2927, 2949, 3019, 4338, 4339, 4340, 4341, 4342, 4350, 4359, 4367, 4399, 4431, 4463, 4495, 4527, 4559, 4591, 4623, 4655, 4697, 4751, 4759, 4789, 4971, 5035, 5099, 5163, 5227, 5291, 5355, 5419, 5483, 5547, 5611, 5675, 5811, 5827, 5839, 5893, 5895, 5897, 5899, 5901, 5903, 5905, 5907, 5909, 5911, 5913, 5915, 5916, 5935, 5950, 5958, 5959, 5960, 5976, 5977, 5978, 5995, 6027, 6028, 6029, 6030, 6032, 6035, 6037, 6042, 6045, 6049, 6053, 6063, 6124, 6125, 6126, 6127 };

528
src/registries.h Normal file
View File

@@ -0,0 +1,528 @@
#ifndef H_REGISTRIES
#define H_REGISTRIES
#include <stdint.h>
extern uint8_t registries_bin[5718];
extern uint8_t B_to_I[256]; // Block-to-item mapping
extern uint8_t I_to_B[256]; // Item-to-block mapping
extern uint16_t block_palette[256]; // Block palette
// Block identifiers
#define B_acacia_hanging_sign 206
#define B_acacia_leaves 91
#define B_acacia_log 52
#define B_acacia_planks 17
#define B_acacia_pressure_plate 222
#define B_acacia_sapling 29
#define B_acacia_sign 192
#define B_acacia_wood 74
#define B_air 0
#define B_allium 157
#define B_andesite 6
#define B_azalea_leaves 96
#define B_azure_bluet 158
#define B_bamboo_block 59
#define B_bamboo_hanging_sign 214
#define B_bamboo_mosaic 24
#define B_bamboo_planks 23
#define B_bamboo_pressure_plate 227
#define B_bamboo_sign 198
#define B_basalt 244
#define B_bedrock 34
#define B_birch_hanging_sign 205
#define B_birch_leaves 89
#define B_birch_log 50
#define B_birch_planks 15
#define B_birch_pressure_plate 220
#define B_birch_sapling 27
#define B_birch_sign 191
#define B_birch_wood 72
#define B_black_bed 124
#define B_black_wool 152
#define B_blue_bed 120
#define B_blue_orchid 156
#define B_blue_wool 148
#define B_bookshelf 173
#define B_bricks 171
#define B_brown_bed 121
#define B_brown_mushroom 167
#define B_brown_wool 149
#define B_bush 132
#define B_cactus 235
#define B_cactus_flower 236
#define B_cake 250
#define B_carved_pumpkin 248
#define B_cherry_hanging_sign 207
#define B_cherry_leaves 92
#define B_cherry_log 53
#define B_cherry_planks 18
#define B_cherry_pressure_plate 223
#define B_cherry_sapling 30
#define B_cherry_sign 193
#define B_cherry_wood 75
#define B_chest 181
#define B_chiseled_bookshelf 174
#define B_chiseled_sandstone 106
#define B_clay 237
#define B_coal_ore 45
#define B_coarse_dirt 10
#define B_cobblestone 12
#define B_cobblestone_stairs 202
#define B_cobweb 128
#define B_cornflower 164
#define B_crafting_table 185
#define B_creaking_heart 179
#define B_crimson_hanging_sign 211
#define B_cut_sandstone 107
#define B_cyan_bed 118
#define B_cyan_wool 146
#define B_dandelion 153
#define B_dark_oak_hanging_sign 209
#define B_dark_oak_leaves 93
#define B_dark_oak_log 54
#define B_dark_oak_planks 19
#define B_dark_oak_pressure_plate 224
#define B_dark_oak_sapling 31
#define B_dark_oak_sign 195
#define B_dark_oak_wood 76
#define B_dead_bush 131
#define B_deepslate_coal_ore 46
#define B_deepslate_diamond_ore 183
#define B_deepslate_gold_ore 42
#define B_deepslate_iron_ore 44
#define B_deepslate_lapis_ore 102
#define B_deepslate_redstone_ore 229
#define B_detector_rail 126
#define B_diamond_block 184
#define B_diamond_ore 182
#define B_diorite 4
#define B_dirt 9
#define B_dispenser 104
#define B_farmland 187
#define B_fern 130
#define B_flowering_azalea_leaves 97
#define B_furnace 188
#define B_glass 100
#define B_glowstone 247
#define B_gold_block 169
#define B_gold_ore 41
#define B_granite 2
#define B_grass_block 8
#define B_gravel 39
#define B_gray_bed 116
#define B_gray_wool 144
#define B_green_bed 122
#define B_green_wool 150
#define B_ice 233
#define B_iron_block 170
#define B_iron_door 217
#define B_iron_ore 43
#define B_jack_o_lantern 249
#define B_jukebox 239
#define B_jungle_hanging_sign 208
#define B_jungle_leaves 90
#define B_jungle_log 51
#define B_jungle_planks 16
#define B_jungle_pressure_plate 221
#define B_jungle_sapling 28
#define B_jungle_sign 194
#define B_jungle_wood 73
#define B_ladder 200
#define B_lapis_block 103
#define B_lapis_ore 101
#define B_lever 215
#define B_light_blue_bed 112
#define B_light_blue_stained_glass 255
#define B_light_blue_wool 140
#define B_light_gray_bed 117
#define B_light_gray_wool 145
#define B_lily_of_the_valley 166
#define B_lime_bed 114
#define B_lime_wool 142
#define B_magenta_bed 111
#define B_magenta_stained_glass 254
#define B_magenta_wool 139
#define B_mangrove_hanging_sign 213
#define B_mangrove_leaves 95
#define B_mangrove_log 56
#define B_mangrove_planks 22
#define B_mangrove_pressure_plate 226
#define B_mangrove_propagule 33
#define B_mangrove_roots 57
#define B_mangrove_sign 197
#define B_mangrove_wood 77
#define B_mossy_cobblestone 175
#define B_muddy_mangrove_roots 58
#define B_nether_gold_ore 47
#define B_netherrack 241
#define B_note_block 108
#define B_oak_door 199
#define B_oak_fence 240
#define B_oak_hanging_sign 203
#define B_oak_leaves 87
#define B_oak_log 48
#define B_oak_planks 13
#define B_oak_pressure_plate 218
#define B_oak_sapling 25
#define B_oak_sign 189
#define B_oak_stairs 180
#define B_oak_wood 70
#define B_obsidian 176
#define B_orange_bed 110
#define B_orange_stained_glass 253
#define B_orange_tulip 160
#define B_orange_wool 138
#define B_oxeye_daisy 163
#define B_pale_oak_hanging_sign 210
#define B_pale_oak_leaves 94
#define B_pale_oak_log 55
#define B_pale_oak_planks 21
#define B_pale_oak_pressure_plate 225
#define B_pale_oak_sapling 32
#define B_pale_oak_sign 196
#define B_pale_oak_wood 20
#define B_pink_bed 115
#define B_pink_tulip 162
#define B_pink_wool 143
#define B_piston 136
#define B_podzol 11
#define B_polished_andesite 7
#define B_polished_basalt 245
#define B_polished_diorite 5
#define B_polished_granite 3
#define B_poppy 155
#define B_powered_rail 125
#define B_purple_bed 119
#define B_purple_wool 147
#define B_rail 201
#define B_red_bed 123
#define B_red_mushroom 168
#define B_red_sand 38
#define B_red_tulip 159
#define B_red_wool 151
#define B_redstone_ore 228
#define B_redstone_torch 230
#define B_repeater 251
#define B_sand 36
#define B_sandstone 105
#define B_seagrass 135
#define B_short_dry_grass 133
#define B_short_grass 129
#define B_snow 232
#define B_snow_block 234
#define B_soul_sand 242
#define B_soul_soil 243
#define B_soul_torch 246
#define B_spawner 178
#define B_sponge 98
#define B_spruce_hanging_sign 204
#define B_spruce_leaves 88
#define B_spruce_log 49
#define B_spruce_planks 14
#define B_spruce_pressure_plate 219
#define B_spruce_sapling 26
#define B_spruce_sign 190
#define B_spruce_wood 71
#define B_sticky_piston 127
#define B_stone 1
#define B_stone_button 231
#define B_stone_pressure_plate 216
#define B_stripped_acacia_log 63
#define B_stripped_acacia_wood 82
#define B_stripped_bamboo_block 69
#define B_stripped_birch_log 61
#define B_stripped_birch_wood 80
#define B_stripped_cherry_log 64
#define B_stripped_cherry_wood 83
#define B_stripped_dark_oak_log 65
#define B_stripped_dark_oak_wood 84
#define B_stripped_jungle_log 62
#define B_stripped_jungle_wood 81
#define B_stripped_mangrove_log 68
#define B_stripped_mangrove_wood 86
#define B_stripped_oak_log 67
#define B_stripped_oak_wood 78
#define B_stripped_pale_oak_log 66
#define B_stripped_pale_oak_wood 85
#define B_stripped_spruce_log 60
#define B_stripped_spruce_wood 79
#define B_sugar_cane 238
#define B_suspicious_gravel 40
#define B_suspicious_sand 37
#define B_tall_dry_grass 134
#define B_tnt 172
#define B_torch 177
#define B_torchflower 154
#define B_warped_hanging_sign 212
#define B_water 35
#define B_wet_sponge 99
#define B_wheat 186
#define B_white_bed 109
#define B_white_stained_glass 252
#define B_white_tulip 161
#define B_white_wool 137
#define B_wither_rose 165
#define B_yellow_bed 113
#define B_yellow_wool 141
// Item identifiers
#define I_acacia_leaves 186
#define I_acacia_log 138
#define I_acacia_planks 40
#define I_acacia_sapling 53
#define I_acacia_wood 175
#define I_air 0
#define I_allium 234
#define I_amethyst_block 88
#define I_ancient_debris 82
#define I_andesite 6
#define I_azalea 205
#define I_azalea_leaves 191
#define I_azure_bluet 235
#define I_bamboo_block 147
#define I_bamboo_mosaic 48
#define I_bamboo_planks 45
#define I_bedrock 58
#define I_birch_leaves 184
#define I_birch_log 136
#define I_birch_planks 38
#define I_birch_sapling 51
#define I_birch_wood 173
#define I_black_wool 228
#define I_blue_orchid 233
#define I_blue_wool 224
#define I_brown_mushroom 247
#define I_brown_wool 225
#define I_budding_amethyst 89
#define I_bush 204
#define I_calcite 11
#define I_cherry_leaves 187
#define I_cherry_log 139
#define I_cherry_planks 41
#define I_cherry_sapling 54
#define I_cherry_wood 176
#define I_chiseled_copper 98
#define I_chiseled_sandstone 199
#define I_chiseled_tuff 16
#define I_chiseled_tuff_bricks 25
#define I_closed_eyeblossom 231
#define I_coal_block 83
#define I_coal_ore 64
#define I_coarse_dirt 29
#define I_cobbled_deepslate 9
#define I_cobblestone 35
#define I_cobweb 201
#define I_copper_block 91
#define I_copper_ore 68
#define I_cornflower 241
#define I_crimson_fungus 249
#define I_crimson_hyphae 180
#define I_crimson_nylium 33
#define I_crimson_planks 46
#define I_crimson_roots 251
#define I_crimson_stem 145
#define I_cut_copper 102
#define I_cut_copper_slab 110
#define I_cut_copper_stairs 106
#define I_cut_sandstone 200
#define I_cyan_wool 222
#define I_dandelion 229
#define I_dark_oak_leaves 188
#define I_dark_oak_log 141
#define I_dark_oak_planks 42
#define I_dark_oak_sapling 55
#define I_dark_oak_wood 178
#define I_dead_bush 207
#define I_deepslate 8
#define I_deepslate_coal_ore 65
#define I_deepslate_copper_ore 69
#define I_deepslate_diamond_ore 79
#define I_deepslate_emerald_ore 75
#define I_deepslate_gold_ore 71
#define I_deepslate_iron_ore 67
#define I_deepslate_lapis_ore 77
#define I_deepslate_redstone_ore 73
#define I_diamond_block 93
#define I_diamond_ore 78
#define I_diorite 4
#define I_dirt 28
#define I_dripstone_block 26
#define I_emerald_ore 74
#define I_exposed_chiseled_copper 99
#define I_exposed_copper 95
#define I_exposed_cut_copper 103
#define I_exposed_cut_copper_slab 111
#define I_exposed_cut_copper_stairs 107
#define I_fern 203
#define I_firefly_bush 208
#define I_flowering_azalea 206
#define I_flowering_azalea_leaves 192
#define I_glass 195
#define I_gold_block 92
#define I_gold_ore 70
#define I_granite 2
#define I_grass_block 27
#define I_gravel 63
#define I_gray_wool 220
#define I_green_wool 226
#define I_heavy_core 87
#define I_iron_block 90
#define I_iron_ore 66
#define I_jungle_leaves 185
#define I_jungle_log 137
#define I_jungle_planks 39
#define I_jungle_sapling 52
#define I_jungle_wood 174
#define I_lapis_block 197
#define I_lapis_ore 76
#define I_light_blue_wool 216
#define I_light_gray_wool 221
#define I_lily_of_the_valley 242
#define I_lime_wool 218
#define I_magenta_wool 215
#define I_mangrove_leaves 190
#define I_mangrove_log 142
#define I_mangrove_planks 44
#define I_mangrove_propagule 57
#define I_mangrove_roots 143
#define I_mangrove_wood 179
#define I_mud 32
#define I_muddy_mangrove_roots 144
#define I_nether_gold_ore 80
#define I_nether_quartz_ore 81
#define I_nether_sprouts 253
#define I_netherite_block 94
#define I_oak_leaves 182
#define I_oak_log 134
#define I_oak_planks 36
#define I_oak_sapling 49
#define I_oak_wood 171
#define I_open_eyeblossom 230
#define I_orange_tulip 237
#define I_orange_wool 214
#define I_oxeye_daisy 240
#define I_oxidized_chiseled_copper 101
#define I_oxidized_copper 97
#define I_oxidized_cut_copper 105
#define I_oxidized_cut_copper_slab 113
#define I_oxidized_cut_copper_stairs 109
#define I_pale_oak_leaves 189
#define I_pale_oak_log 140
#define I_pale_oak_planks 43
#define I_pale_oak_sapling 56
#define I_pale_oak_wood 177
#define I_pink_tulip 239
#define I_pink_wool 219
#define I_pitcher_plant 245
#define I_podzol 30
#define I_polished_andesite 7
#define I_polished_deepslate 10
#define I_polished_diorite 5
#define I_polished_granite 3
#define I_polished_tuff 17
#define I_polished_tuff_slab 18
#define I_polished_tuff_stairs 19
#define I_polished_tuff_wall 20
#define I_poppy 232
#define I_purple_wool 223
#define I_raw_copper_block 85
#define I_raw_gold_block 86
#define I_raw_iron_block 84
#define I_red_mushroom 248
#define I_red_sand 62
#define I_red_tulip 236
#define I_red_wool 227
#define I_redstone_ore 72
#define I_rooted_dirt 31
#define I_sand 59
#define I_sandstone 198
#define I_sea_pickle 212
#define I_seagrass 211
#define I_short_dry_grass 209
#define I_short_grass 202
#define I_sponge 193
#define I_spore_blossom 246
#define I_spruce_leaves 183
#define I_spruce_log 135
#define I_spruce_planks 37
#define I_spruce_sapling 50
#define I_spruce_wood 172
#define I_stone 1
#define I_stripped_acacia_log 152
#define I_stripped_acacia_wood 163
#define I_stripped_bamboo_block 170
#define I_stripped_birch_log 150
#define I_stripped_birch_wood 161
#define I_stripped_cherry_log 153
#define I_stripped_cherry_wood 164
#define I_stripped_crimson_hyphae 168
#define I_stripped_crimson_stem 157
#define I_stripped_dark_oak_log 154
#define I_stripped_dark_oak_wood 165
#define I_stripped_jungle_log 151
#define I_stripped_jungle_wood 162
#define I_stripped_mangrove_log 156
#define I_stripped_mangrove_wood 167
#define I_stripped_oak_log 148
#define I_stripped_oak_wood 159
#define I_stripped_pale_oak_log 155
#define I_stripped_pale_oak_wood 166
#define I_stripped_spruce_log 149
#define I_stripped_spruce_wood 160
#define I_stripped_warped_hyphae 169
#define I_stripped_warped_stem 158
#define I_suspicious_gravel 61
#define I_suspicious_sand 60
#define I_tall_dry_grass 210
#define I_tinted_glass 196
#define I_torchflower 244
#define I_tuff 12
#define I_tuff_brick_slab 22
#define I_tuff_brick_stairs 23
#define I_tuff_brick_wall 24
#define I_tuff_bricks 21
#define I_tuff_slab 13
#define I_tuff_stairs 14
#define I_tuff_wall 15
#define I_twisting_vines 255
#define I_warped_fungus 250
#define I_warped_hyphae 181
#define I_warped_nylium 34
#define I_warped_planks 47
#define I_warped_roots 252
#define I_warped_stem 146
#define I_waxed_chiseled_copper 118
#define I_waxed_copper_block 114
#define I_waxed_cut_copper 122
#define I_waxed_cut_copper_slab 130
#define I_waxed_cut_copper_stairs 126
#define I_waxed_exposed_chiseled_copper 119
#define I_waxed_exposed_copper 115
#define I_waxed_exposed_cut_copper 123
#define I_waxed_exposed_cut_copper_slab 131
#define I_waxed_exposed_cut_copper_stairs 127
#define I_waxed_oxidized_chiseled_copper 121
#define I_waxed_oxidized_copper 117
#define I_waxed_oxidized_cut_copper 125
#define I_waxed_oxidized_cut_copper_slab 133
#define I_waxed_oxidized_cut_copper_stairs 129
#define I_waxed_weathered_chiseled_copper 120
#define I_waxed_weathered_copper 116
#define I_waxed_weathered_cut_copper 124
#define I_waxed_weathered_cut_copper_slab 132
#define I_waxed_weathered_cut_copper_stairs 128
#define I_weathered_chiseled_copper 100
#define I_weathered_copper 96
#define I_weathered_cut_copper 104
#define I_weathered_cut_copper_slab 112
#define I_weathered_cut_copper_stairs 108
#define I_weeping_vines 254
#define I_wet_sponge 194
#define I_white_tulip 238
#define I_white_wool 213
#define I_wither_rose 243
#define I_yellow_wool 217
#endif

2490
src/registries.json Normal file

File diff suppressed because it is too large Load Diff

288
src/tools.c Normal file
View File

@@ -0,0 +1,288 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "globals.h"
#include "varnum.h"
static uint64_t htonll (uint64_t value) {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
return ((uint64_t)htonl((uint32_t)(value >> 32))) |
((uint64_t)htonl((uint32_t)(value & 0xFFFFFFFF)) << 32);
#else
return value;
#endif
}
ssize_t writeByte (int client_fd, uint8_t byte) {
return send(client_fd, &byte, 1, 0);
}
ssize_t writeUint16 (int client_fd, uint16_t num) {
uint16_t be = htons(num);
return send(client_fd, &be, sizeof(be), 0);
}
ssize_t writeUint32 (int client_fd, uint32_t num) {
uint32_t be = htonl(num);
return send(client_fd, &be, sizeof(be), 0);
}
ssize_t writeUint64 (int client_fd, uint64_t num) {
uint64_t be = htonll(num);
return send(client_fd, &be, sizeof(be), 0);
}
ssize_t writeFloat (int client_fd, float num) {
uint32_t bits;
memcpy(&bits, &num, sizeof(bits));
bits = htonl(bits);
return send(client_fd, &bits, sizeof(bits), 0);
}
ssize_t writeDouble (int client_fd, double num) {
uint64_t bits;
memcpy(&bits, &num, sizeof(bits));
bits = htonll(bits);
return send(client_fd, &bits, sizeof(bits), 0);
}
uint8_t readByte (int client_fd) {
recv_count = recv(client_fd, recv_buffer, 1, MSG_WAITALL);
return recv_buffer[0];
}
uint16_t readUint16 (int client_fd) {
recv_count = recv(client_fd, recv_buffer, 2, MSG_WAITALL);
return ((uint16_t)recv_buffer[0] << 8) | recv_buffer[1];
}
uint32_t readUint32 (int client_fd) {
recv_count = recv(client_fd, recv_buffer, 4, MSG_WAITALL);
return ((uint32_t)recv_buffer[0] << 24) |
((uint32_t)recv_buffer[1] << 16) |
((uint32_t)recv_buffer[2] << 8) |
((uint32_t)recv_buffer[3]);
}
uint64_t readUint64 (int client_fd) {
recv_count = recv(client_fd, recv_buffer, 8, MSG_WAITALL);
return ((uint64_t)recv_buffer[0] << 56) |
((uint64_t)recv_buffer[1] << 48) |
((uint64_t)recv_buffer[2] << 40) |
((uint64_t)recv_buffer[3] << 32) |
((uint64_t)recv_buffer[4] << 24) |
((uint64_t)recv_buffer[5] << 16) |
((uint64_t)recv_buffer[6] << 8) |
((uint64_t)recv_buffer[7]);
}
int64_t readInt64 (int client_fd) {
recv_count = recv(client_fd, recv_buffer, 8, MSG_WAITALL);
return ((int64_t)recv_buffer[0] << 56) |
((int64_t)recv_buffer[1] << 48) |
((int64_t)recv_buffer[2] << 40) |
((int64_t)recv_buffer[3] << 32) |
((int64_t)recv_buffer[4] << 24) |
((int64_t)recv_buffer[5] << 16) |
((int64_t)recv_buffer[6] << 8) |
((int64_t)recv_buffer[7]);
}
float readFloat (int client_fd) {
uint32_t bytes = readUint32(client_fd);
float output;
memcpy(&output, &bytes, sizeof(output));
return output;
}
double readDouble (int client_fd) {
uint64_t bytes = readUint64(client_fd);
double output;
memcpy(&output, &bytes, sizeof(output));
return output;
}
void readString (int client_fd) {
uint32_t length = readVarInt(client_fd);
recv_count = recv(client_fd, recv_buffer, length, MSG_WAITALL);
recv_buffer[recv_count] = '\0';
}
int client_states[MAX_PLAYERS * 2];
void setClientState (int client_fd, int new_state) {
for (int i = 0; i < MAX_PLAYERS * 2; i += 2) {
if (client_states[i] != client_fd && client_states[i] != 0) continue;
client_states[i] = client_fd;
client_states[i + 1] = new_state;
}
}
int getClientState (int client_fd) {
for (int i = 0; i < MAX_PLAYERS * 2; i += 2) {
if (client_states[i] != client_fd) continue;
return client_states[i + 1];
}
return STATE_NONE;
}
int getClientIndex (int client_fd) {
for (int i = 0; i < MAX_PLAYERS * 2; i += 2) {
if (client_states[i] != client_fd) continue;
return i;
}
return -1;
}
int reservePlayerData (int client_fd, char *uuid) {
uint64_t tmp;
for (int i = 0; i < MAX_PLAYERS; i ++) {
memcpy(&tmp, player_data + i * player_data_size, 8);
if (memcmp(&tmp, uuid, 8) == 0) {
memcpy(player_data + i * player_data_size + 16, &client_fd, 4);
return 0;
}
if (tmp == 0) {
memcpy(player_data + i * player_data_size, uuid, 16);
memcpy(player_data + i * player_data_size + 16, &client_fd, 4);
player_data[i * player_data_size + 20] = 8;
player_data[i * player_data_size + 22] = 80;
player_data[i * player_data_size + 24] = 8;
return 0;
}
}
return 1;
}
void clearPlayerFD (int client_fd) {
int tmp;
for (int i = 0; i < MAX_PLAYERS; i ++) {
memcpy(&tmp, player_data + i * player_data_size + 16, 4);
if (tmp == client_fd) {
tmp = 0;
memcpy(player_data + i * player_data_size + 16, &tmp, 4);
break;
}
}
}
int savePlayerPosition (int client_fd, short x, short y, short z) {
int tmp;
for (int i = 0; i < MAX_PLAYERS; i ++) {
if (memcmp(&client_fd, player_data + i * player_data_size + 16, 4) == 0) {
memcpy(player_data + i * player_data_size + 20, &x, 2);
memcpy(player_data + i * player_data_size + 22, &y, 2);
memcpy(player_data + i * player_data_size + 24, &z, 2);
return 0;
}
}
return 1;
}
int savePlayerPositionAndRotation (int client_fd, short x, short y, short z, int8_t yaw, int8_t pitch) {
int tmp;
for (int i = 0; i < MAX_PLAYERS; i ++) {
if (memcmp(&client_fd, player_data + i * player_data_size + 16, 4) == 0) {
memcpy(player_data + i * player_data_size + 20, &x, 2);
memcpy(player_data + i * player_data_size + 22, &y, 2);
memcpy(player_data + i * player_data_size + 24, &z, 2);
memcpy(player_data + i * player_data_size + 26, &yaw, 1);
memcpy(player_data + i * player_data_size + 27, &pitch, 1);
return 0;
}
}
return 1;
}
int restorePlayerPosition (int client_fd, short *x, short *y, short *z, int8_t *yaw, int8_t *pitch) {
int tmp;
for (int i = 0; i < MAX_PLAYERS; i ++) {
if (memcmp(&client_fd, player_data + i * player_data_size + 16, 4) == 0) {
memcpy(x, player_data + i * player_data_size + 20, 2);
memcpy(y, player_data + i * player_data_size + 22, 2);
memcpy(z, player_data + i * player_data_size + 24, 2);
if (yaw != NULL) memcpy(yaw, player_data + i * player_data_size + 26, 1);
if (pitch != NULL) memcpy(pitch, player_data + i * player_data_size + 27, 1);
return 0;
}
}
return 1;
}
uint8_t *getPlayerInventory (int client_fd) {
int tmp;
for (int i = 0; i < MAX_PLAYERS; i ++) {
if (memcmp(&client_fd, player_data + i * player_data_size + 16, 4) == 0) {
return player_data + i * player_data_size + 29;
}
}
return NULL;
}
uint8_t serverSlotToClientSlot (uint8_t slot) {
if (slot >= 0 && slot <= 9) return slot + 36;
if (slot == 40) return 45;
if (slot >= 36 && slot <= 39) return 3 - (slot - 36) + 5;
}
uint8_t clientSlotToServerSlot (uint8_t slot) {
if (slot >= 36 && slot <= 44) return slot - 36;
if (slot == 45) return 40;
if (slot >= 5 && slot <= 8) return 4 - (slot - 5) + 36;
return 255;
}
uint8_t getBlockChange (short x, short y, short z) {
short tmp;
for (int i = 0; i < block_changes_count * 7; i += 7) {
if (block_changes[i + 6] == 0xFF) continue;
memcpy(&tmp, block_changes + i, 2);
if (x != tmp) continue;
memcpy(&tmp, block_changes + i + 2, 2);
if (y != tmp) continue;
memcpy(&tmp, block_changes + i + 4, 2);
if (z != tmp) continue;
return block_changes[i + 6];
}
return 0xFF;
}
void makeBlockChange (short x, short y, short z, uint8_t block) {
short tmp;
for (int i = 0; i < block_changes_count * 7; i += 7) {
memcpy(&tmp, block_changes + i, 2);
if (x != tmp) continue;
memcpy(&tmp, block_changes + i + 2, 2);
if (y != tmp) continue;
memcpy(&tmp, block_changes + i + 4, 2);
if (z != tmp) continue;
block_changes[i + 6] = block;
return;
}
int end = block_changes_count * 7;
memcpy(block_changes + end, &x, 2);
memcpy(block_changes + end + 2, &y, 2);
memcpy(block_changes + end + 4, &z, 2);
block_changes[end + 6] = block;
block_changes_count ++;
}

47
src/tools.h Normal file
View File

@@ -0,0 +1,47 @@
#ifndef H_TOOLS
#define H_TOOLS
#include <stdlib.h>
#include <unistd.h>
#include "globals.h"
static ssize_t recv_all (int client_fd, void *buffer, size_t length);
ssize_t writeByte (int client_fd, uint8_t byte);
ssize_t writeUint16 (int client_fd, uint16_t num);
ssize_t writeUint32 (int client_fd, uint32_t num);
ssize_t writeUint64 (int client_fd, uint64_t num);
ssize_t writeFloat (int client_fd, float num);
ssize_t writeDouble (int client_fd, double num);
uint8_t readByte (int client_fd);
uint16_t readUint16 (int client_fd);
uint32_t readUint32 (int client_fd);
uint64_t readUint64 (int client_fd);
int64_t readInt64 (int client_fd);
float readFloat (int client_fd);
double readDouble (int client_fd);
void readString (int client_fd);
extern int client_states[MAX_PLAYERS * 2];
void setClientState (int client_fd, int new_state);
int getClientState (int client_fd);
int getClientIndex (int client_fd);
int reservePlayerData (int client_fd, char *uuid);
void clearPlayerFD (int client_fd);
int savePlayerPositionAndRotation (int client_fd, short x, short y, short z, int8_t yaw, int8_t pitch);
int savePlayerPosition (int client_fd, short x, short y, short z);
int restorePlayerPosition (int client_fd, short *x, short *y, short *z, int8_t *yaw, int8_t *pitch);
uint8_t *getPlayerInventory (int client_fd);
uint8_t serverSlotToClientSlot (uint8_t slot);
uint8_t clientSlotToServerSlot (uint8_t slot);
uint8_t getBlockChange (short x, short y, short z);
void makeBlockChange (short x, short y, short z, uint8_t block);
#endif

49
src/varnum.c Normal file
View File

@@ -0,0 +1,49 @@
#include <stdint.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "varnum.h"
#include "globals.h"
#include "tools.h"
int32_t readVarInt (int client_fd) {
int32_t value = 0;
int position = 0;
uint8_t byte;
while (true) {
byte = readByte(client_fd);
if (recv_count != 1) return VARNUM_ERROR;
value |= (byte & SEGMENT_BITS) << position;
if ((byte & CONTINUE_BIT) == 0) break;
position += 7;
if (position >= 32) return VARNUM_ERROR;
}
return value;
}
int sizeVarInt (uint32_t value) {
int size = 1;
while ((value & ~SEGMENT_BITS) != 0) {
value >>= 7;
size ++;
}
return size;
}
void writeVarInt (int client_fd, uint32_t value) {
while (true) {
if ((value & ~SEGMENT_BITS) == 0) {
writeByte(client_fd, value);
return;
}
writeByte(client_fd, (value & SEGMENT_BITS) | CONTINUE_BIT);
value >>= 7;
}
}

14
src/varnum.h Normal file
View File

@@ -0,0 +1,14 @@
#ifndef H_VARNUM
#define H_VARNUM
#include <stdint.h>
#define SEGMENT_BITS 0x7F
#define CONTINUE_BIT 0x80
#define VARNUM_ERROR 0xFFFFFFFF
int32_t readVarInt (int client_fd);
int sizeVarInt (uint32_t value);
void writeVarInt (int client_fd, uint32_t value);
#endif

159
src/worldgen.c Normal file
View File

@@ -0,0 +1,159 @@
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "globals.h"
#include "tools.h"
#include "registries.h"
uint32_t getHash (const void *data, size_t len) {
const uint8_t *bytes = data;
uint32_t hash = 2166136261u;
for (size_t i = 0; i < len; i ++) {
hash ^= bytes[i];
hash *= 16777619u;
}
return hash;
}
int sapling (short x, short y, short z) {
uint8_t buf[10];
memcpy(buf, &x, 2);
memcpy(buf + 2, &y, 2);
memcpy(buf + 4, &z, 2);
memcpy(buf + 6, &world_seed, 4);
if (getHash(buf, sizeof(buf)) % 20 == 0) return B_oak_sapling;
return B_air;
}
uint32_t getChunkHash (short x, short z) {
uint8_t buf[8];
memcpy(buf, &x, 2);
memcpy(buf + 2, &z, 2);
memcpy(buf + 4, &world_seed, 4);
return getHash(buf, sizeof(buf));
}
int getCornerHeight (uint32_t hash) {
int height = 60 + hash % 8 + (hash >> 8) % 5;
if (height < 64) height -= (hash >> 16) % 5;
return height;
}
#define chunk_size 8
int interpolate (int a, int b, int c, int d, int x, int z) {
int top = a * (chunk_size - x) + b * x;
int bottom = c * (chunk_size - x) + d * x;
return (top * (chunk_size - z) + bottom * z) / (chunk_size * chunk_size);
}
int getHeightAt (int x, int z, uint32_t chunk_hash) {
int _x = x / chunk_size;
int _z = z / chunk_size;
int rx = x % chunk_size;
int rz = z % chunk_size;
if (rx < 0) { rx += chunk_size; _x -= 1; }
if (rz < 0) { rz += chunk_size; _z -= 1; }
if (rx == 0 && rz == 0) {
int height = getCornerHeight(chunk_hash);
if (height > 67) return height - 1;
} else {
return interpolate(
getCornerHeight(chunk_hash),
getCornerHeight(getChunkHash(_x + 1, _z)),
getCornerHeight(getChunkHash(_x, _z + 1)),
getCornerHeight(getChunkHash(_x + 1, _z + 1)),
rx, rz
);
}
}
uint8_t getBlockAt (int x, int y, int z) {
uint8_t block_change = getBlockChange(x, y, z);
if (block_change != 0xFF) return block_change;
if (y > 80) return B_air;
int _x = x / chunk_size;
int _z = z / chunk_size;
int rx = x % chunk_size;
int rz = z % chunk_size;
int height;
// make remainders positive and move the cell index when negative
if (rx < 0) { rx += chunk_size; _x -= 1; }
if (rz < 0) { rz += chunk_size; _z -= 1; }
uint32_t chunk_hash = getChunkHash(_x, _z);
if (rx == 0 && rz == 0) {
height = getCornerHeight(chunk_hash);
if (height > 67) height -= 1;
} else {
height = interpolate(
getCornerHeight(chunk_hash),
getCornerHeight(getChunkHash(_x + 1, _z)),
getCornerHeight(getChunkHash(_x, _z + 1)),
getCornerHeight(getChunkHash(_x + 1, _z + 1)),
rx, rz
);
}
if (y >= 64 && y > height) {
uint8_t tree_position = chunk_hash % (chunk_size * chunk_size);
short tree_x = tree_position % chunk_size;
if (tree_x < 3 || tree_x > chunk_size - 3) goto skip_tree;
tree_x += _x * chunk_size;
short tree_z = tree_position / chunk_size;
if (tree_z < 3 || tree_z > chunk_size - 3) goto skip_tree;
tree_z += _z * chunk_size;
uint8_t tree_y = getHeightAt(tree_x, tree_z, chunk_hash) + 1;
if (tree_y < 64) goto skip_tree;
if (x == tree_x && z == tree_z && y >= tree_y && y < tree_y + 6)
return B_oak_log;
uint8_t dx = x > tree_x ? x - tree_x : tree_x - x;
uint8_t dz = z > tree_z ? z - tree_z : tree_z - z;
if (dx < 3 && dz < 3 && y > tree_y + 2 && y < tree_y + 5) {
if (y == tree_y + 4 && dx == 2 && dz == 2 && (chunk_hash >> (x + z + y)) & 1) return B_air;
return B_oak_leaves;
}
if (dx < 2 && dz < 2 && y >= tree_y + 5 && y <= tree_y + 6) {
if (y == tree_y + 6 && dx == 1 && dz == 1 && (chunk_hash >> (x + z + y)) & 1) return B_air;
return B_oak_leaves;
}
}
skip_tree:
if (y >= 63 && y == height) return B_grass_block;
if (y < height - 3) return B_stone;
if (y <= height) return B_dirt;
if (y < 64) return B_water;
return B_air;
}

9
src/worldgen.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef H_WORLDGEN
#define H_WORLDGEN
#include <stdint.h>
uint8_t getBlockAt (int x, int y, int z);
void writeChunkSection (int client_fd, int _x, int _z, int i);
#endif