Update Example Mods

This commit is contained in:
TheBrokenRail 2024-01-06 20:36:59 -05:00
parent b7b60876d8
commit 34c24378f3
3 changed files with 14 additions and 12 deletions

View File

@ -1,17 +1,16 @@
// Headers
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include <mods/chat/chat.h>
#include <mods/misc/misc.h>
// The Actual Mod
HOOK(chat_handle_packet_send, void, (unsigned char *minecraft, unsigned char *packet)) {
HOOK(chat_handle_packet_send, void, (Minecraft *minecraft, ChatPacket *packet)) {
// Get Message
char *message = *(char **) (packet + ChatPacket_message_property_offset);
char *message = packet->message;
if (message[0] == '/') {
// API Command
unsigned char *gui = minecraft + Minecraft_gui_property_offset;
Gui *gui = &minecraft->gui;
std::string out = chat_send_api_command(minecraft, &message[1]);
if (out.length() > 0 && out[out.length() - 1] == '\n') {
out[out.length() - 1] = '\0';

View File

@ -1,12 +1,10 @@
// Headers
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include <mods/misc/misc.h>
// The Actual Mod
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(unsigned char *filling_container) {
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) {
ItemInstance *fire_instance = new ItemInstance;
ALLOC_CHECK(fire_instance);
fire_instance->count = 255;

View File

@ -1,11 +1,10 @@
// Headers
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include <mods/misc/misc.h>
// Custom Crafting Recipes
static void Recipes_injection(unsigned char *recipes) {
static void Recipes_injection(Recipes *recipes) {
// Add
Recipes_Type type1 = {
.item = 0,
@ -32,13 +31,19 @@ static void Recipes_injection(unsigned char *recipes) {
.id = 344,
.auxiliary = 0
};
(*Recipes_addShapelessRecipe)(recipes, result, {type1, type2});
std::vector<Recipes_Type> types = {type1, type2};
(*Recipes_addShapelessRecipe)(recipes, &result, &types);
}
// Custom Furnace Recipes
static void FurnaceRecipes_injection(unsigned char *recipes) {
static void FurnaceRecipes_injection(FurnaceRecipes *recipes) {
// Add
(*FurnaceRecipes_addFurnaceRecipe)(recipes, 49, {.count = 1, .id = 246, .auxiliary = 0});
ItemInstance result = {
.count = 1,
.id = 246,
.auxiliary = 0
};
(*FurnaceRecipes_addFurnaceRecipe)(recipes, 49, &result);
}
// Init