Add Symbols Needed For RJ API

This commit is contained in:
Bigjango13 2025-02-24 19:55:32 -05:00 committed by TheBrokenRail
parent 00414e2250
commit 240d07e1ec
21 changed files with 82 additions and 21 deletions

View File

@ -20,7 +20,7 @@ jobs:
- ARMHF
name: Build
runs-on: ubuntu-latest
container: node:lts-bullseye
container: node:lts-bullseye # Minimum Supported OS
steps:
- name: Checkout Repository
uses: actions/checkout@v4
@ -53,7 +53,6 @@ jobs:
- ARMHF
name: Test
runs-on: ${{ startsWith(matrix.arch, 'ARM') && 'raspberry-pi' || 'ubuntu-latest' }}
container: node:lts-bullseye
steps:
- name: Checkout Repository
uses: actions/checkout@v4
@ -76,7 +75,6 @@ jobs:
needs: build
name: Build Example Mods
runs-on: ubuntu-latest
container: node:lts-bullseye
steps:
- name: Checkout Repository
uses: actions/checkout@v4
@ -84,7 +82,7 @@ jobs:
submodules: false
# Dependencies
- name: Install Dependencies
run: ./scripts/install-dependencies.mjs sdk amd64
run: ./scripts/install-dependencies.mjs sdk host
# SDK
- name: Download SDK
uses: actions/download-artifact@v3

@ -1 +1 @@
Subproject commit 16ab0983a7a56880cfbe2c0339ed22a04f7ec69f
Subproject commit 01a64f321d5f98a59d1432f659b8a9e11d3d60c6

View File

@ -21,7 +21,7 @@ void overwrite_call(void *addr, __attribute__((unused)) T *target_type, typename
void *overwrite_calls_manual(void *target, void *replacement, bool allow_no_callsites = false);
template <typename T>
void overwrite_calls(T *target, typename T::overwrite_type replacement) {
DEBUG("Overwriting Method: %s", target->name.c_str());
DEBUG("Overwriting Method: %s", target->name);
if (!target->overwrite(replacement)) {
ERR("Unable To Overwrite Method! Use patch_vtable() Instead!");
}
@ -50,7 +50,7 @@ void patch_address(void *addr, void *target);
// IMPORTANT NOTE: This does not affect subclasses.
template <typename T>
void patch_vtable(const T *target, typename T::ptr_type replacement) {
DEBUG("Patching VTable: %s", target->name.c_str());
DEBUG("Patching VTable: %s", target->name);
if (target->enabled) {
WARN("Use overwrite_calls() Instead!");
}

View File

@ -13,7 +13,7 @@ std::string chat_send_api_command(const Minecraft *minecraft, const std::string
ConnectedClient client;
client.sock = -1;
client.str = "";
client.time = 0;
client.lastBlockHitPoll = 0;
CommandServer *command_server = minecraft->command_server;
if (command_server != nullptr) {
return command_server->parse(client, str);

View File

@ -42,7 +42,7 @@ static void Minecraft_setIsCreativeMode_injection(Minecraft_setIsCreativeMode_t
}
// Disable CreatorMode-Specific API Features (Polling Block Hits) In SurvivalMode, This Is Preferable To Crashing
static unsigned char *Minecraft_getCreator_injection(Minecraft_getCreator_t original, Minecraft *minecraft) {
static ICreator *Minecraft_getCreator_injection(Minecraft_getCreator_t original, Minecraft *minecraft) {
if (is_survival) {
// SurvivalMode, Return nullptr
return nullptr;

View File

@ -66,7 +66,7 @@ static std::string get_world_name() {
// Create/Start World
static void start_world(Minecraft *minecraft) {
// Get World Name
std::string world_name = get_world_name();
const std::string world_name = get_world_name();
// Log
INFO("Loading World: %s", world_name.c_str());
@ -133,9 +133,8 @@ static void find_players(Minecraft *minecraft, const std::string &target_usernam
Level *level = get_level(minecraft);
const std::vector<Player *> players = get_players_in_level(level);
bool found_player = false;
for (std::size_t i = 0; i < players.size(); i++) {
for (Player *player : players) {
// Iterate Players
Player *player = players[i];
std::string username = get_player_username(player);
if (all_players || username == target_username) {
// Run Callback
@ -342,14 +341,14 @@ std::vector<ServerCommand> *server_get_commands(Minecraft *minecraft, ServerSide
.comment = "Print This Message",
.callback = [commands](__attribute__((unused)) const std::string &cmd) {
INFO("All Commands:");
int max_lhs_length = 0;
for (ServerCommand command : *commands) {
const int lhs_length = command.get_lhs_help().length();
std::string::size_type max_lhs_length = 0;
for (const ServerCommand &command : *commands) {
const std::string::size_type lhs_length = command.get_lhs_help().length();
if (lhs_length > max_lhs_length) {
max_lhs_length = lhs_length;
}
}
for (ServerCommand command : *commands) {
for (const ServerCommand &command : *commands) {
INFO("%s", command.get_full_help(max_lhs_length).c_str());
}
}
@ -368,10 +367,10 @@ static void handle_commands(Minecraft *minecraft) {
ServerSideNetworkHandler *server_side_network_handler = get_server_side_network_handler(minecraft);
if (server_side_network_handler != nullptr) {
// Generate Command List
std::vector<ServerCommand> *commands = server_get_commands(minecraft, server_side_network_handler);
const std::vector<ServerCommand> *commands = server_get_commands(minecraft, server_side_network_handler);
// Run
bool success = false;
for (ServerCommand command : *commands) {
for (const ServerCommand &command : *commands) {
const bool valid = command.has_args() ? data.rfind(command.name, 0) == 0 : data == command.name;
if (valid) {
command.callback(data.substr(command.name.length()));
@ -425,7 +424,7 @@ static bool is_ip_in_blacklist(const char *ip) {
std::string line;
while (std::getline(blacklist_file, line)) {
// Check Line
if (line.length() > 0 && line[0] != '#') {
if (!line.empty() && line[0] != '#') {
ips.push_back(line);
}
}

View File

@ -9,6 +9,11 @@ set(SRC
src/game/mode/GameMode.def
src/game/mode/CreatorMode.def
src/game/mode/SurvivalMode.def
src/game/mode/creator/Creator.def
src/game/mode/creator/EventList_Item.def
src/game/mode/creator/EventList_TileEvent.def
src/game/mode/creator/ICreator.def
src/game/mode/creator/TileEvent.def
src/game/NinecraftApp.def
src/game/GameRenderer.def
src/network/RakNetInstance.def
@ -66,6 +71,7 @@ set(SRC
src/entity/ArrowRenderer.def
src/entity/PaintingRenderer.def
src/entity/Throwable.def
src/entity/Particle.def
src/level/container/FillingContainer.def
src/level/container/Container.def
src/level/container/ContainerMenu.def
@ -137,6 +143,7 @@ set(SRC
src/gui/components/GuiComponent.def
src/gui/components/Button.def
src/gui/Gui.def
src/gui/GuiMessage.def
src/gui/components/IntRectangle.def
src/gui/components/RectangleArea.def
src/gui/components/ScrollingPane.def

View File

@ -2,6 +2,6 @@ size 0xc;
property uint sock = 0x0;
property std::string str = 0x4;
property int time = 0x8;
property int lastBlockHitPoll = 0x8;
mark-as-simple;

View File

@ -1,3 +1,10 @@
extends Entity;
vtable 0x10db20;
property bool is_critical = 0xd8;
property int hit_x = 0xdc;
property int hit_y = 0xe0;
property int hit_z = 0xe4;
property bool grounded = 0xf0;
property int flight_time = 0xf8;

View File

@ -0,0 +1,3 @@
extends Entity;
vtable 0x105b68;

View File

@ -12,7 +12,7 @@ method bool isCreativeMode() = 0x17270;
method void releaseMouse() = 0x15d30;
method void grabMouse() = 0x15d10;
method void leaveGame(bool save_remote_level) = 0x15ea0;
method uchar *getCreator() = 0x17538;
method ICreator *getCreator() = 0x17538;
method LevelStorageSource *getLevelSource() = 0x16e84;
method void handleMouseDown(int param_1, bool can_destroy) = 0x1584c;
method void handleBuildAction(uint *build_action_intention) = 0x15920;

View File

@ -1,5 +1,8 @@
extends GameMode;
size 0x1c;
vtable 0x102d00;
constructor (Minecraft *minecraft) = 0x1a044;
property Creator *creator = 0x4;

View File

@ -0,0 +1,7 @@
size 0x20;
extends ICreator;
vtable 0x1a0dc;
property EventList_TileEvent tileEvents = 0x4;
property int tick = 0x1c;

View File

@ -0,0 +1,6 @@
size 0x18;
property int tick = 0x0;
property TileEvent item = 0x4;
mark-as-simple;

View File

@ -0,0 +1,8 @@
size 0x18;
property int at = 0x0;
property int len = 0x4;
property int cap = 0x8;
property std::vector<EventList_Item> events = 0xc;
mark-as-simple;

View File

@ -0,0 +1,3 @@
vtable 0x102ca8;
virtual-method EventList_TileEvent &getTileEvents() = 0x8;

View File

@ -0,0 +1,9 @@
size 0x14;
property int entityId = 0x0;
property int x = 0x4;
property int y = 0x8;
property int z = 0xc;
property int face = 0x10;
mark-as-simple;

View File

@ -18,6 +18,7 @@ method void renderDebugInfo() = 0x26958;
method void renderProgressIndicator(bool is_touch, int width, int height, float a) = 0x26098;
method void renderVignette(float param_1, int width, int height) = 0x25b0c;
property std::vector<GuiMessage> messages = 0x18;
property Minecraft *minecraft = 0x9f4;
property float selected_item_text_timer = 0x9fc;
property int flashing_slot = 0xa2c;

View File

@ -0,0 +1,6 @@
size 0x8;
property std::string message = 0x0;
property int time = 0x4;
mark-as-simple;

View File

@ -1,5 +1,7 @@
size 0x28;
constructor (Entity *entity) = 0xd3a98;
property int type = 0x0;
property int x = 0x4;
property int y = 0x8;

View File

@ -1,3 +1,5 @@
vtable 0x115d08;
extends TileEntity;
property std::string lines[4] = 0x30;