Update Example Mods
This commit is contained in:
parent
b7b60876d8
commit
34c24378f3
@ -1,17 +1,16 @@
|
|||||||
// Headers
|
// Headers
|
||||||
|
|
||||||
#include <libreborn/libreborn.h>
|
#include <libreborn/libreborn.h>
|
||||||
#include <symbols/minecraft.h>
|
#include <symbols/minecraft.h>
|
||||||
#include <mods/chat/chat.h>
|
#include <mods/chat/chat.h>
|
||||||
#include <mods/misc/misc.h>
|
#include <mods/misc/misc.h>
|
||||||
|
|
||||||
// The Actual Mod
|
// 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
|
// Get Message
|
||||||
char *message = *(char **) (packet + ChatPacket_message_property_offset);
|
char *message = packet->message;
|
||||||
if (message[0] == '/') {
|
if (message[0] == '/') {
|
||||||
// API Command
|
// API Command
|
||||||
unsigned char *gui = minecraft + Minecraft_gui_property_offset;
|
Gui *gui = &minecraft->gui;
|
||||||
std::string out = chat_send_api_command(minecraft, &message[1]);
|
std::string out = chat_send_api_command(minecraft, &message[1]);
|
||||||
if (out.length() > 0 && out[out.length() - 1] == '\n') {
|
if (out.length() > 0 && out[out.length() - 1] == '\n') {
|
||||||
out[out.length() - 1] = '\0';
|
out[out.length() - 1] = '\0';
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
// Headers
|
// Headers
|
||||||
|
|
||||||
#include <libreborn/libreborn.h>
|
#include <libreborn/libreborn.h>
|
||||||
#include <symbols/minecraft.h>
|
#include <symbols/minecraft.h>
|
||||||
#include <mods/misc/misc.h>
|
#include <mods/misc/misc.h>
|
||||||
|
|
||||||
// The Actual Mod
|
// The Actual Mod
|
||||||
|
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) {
|
||||||
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(unsigned char *filling_container) {
|
|
||||||
ItemInstance *fire_instance = new ItemInstance;
|
ItemInstance *fire_instance = new ItemInstance;
|
||||||
ALLOC_CHECK(fire_instance);
|
ALLOC_CHECK(fire_instance);
|
||||||
fire_instance->count = 255;
|
fire_instance->count = 255;
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
// Headers
|
// Headers
|
||||||
|
|
||||||
#include <libreborn/libreborn.h>
|
#include <libreborn/libreborn.h>
|
||||||
#include <symbols/minecraft.h>
|
#include <symbols/minecraft.h>
|
||||||
#include <mods/misc/misc.h>
|
#include <mods/misc/misc.h>
|
||||||
|
|
||||||
// Custom Crafting Recipes
|
// Custom Crafting Recipes
|
||||||
static void Recipes_injection(unsigned char *recipes) {
|
static void Recipes_injection(Recipes *recipes) {
|
||||||
// Add
|
// Add
|
||||||
Recipes_Type type1 = {
|
Recipes_Type type1 = {
|
||||||
.item = 0,
|
.item = 0,
|
||||||
@ -32,13 +31,19 @@ static void Recipes_injection(unsigned char *recipes) {
|
|||||||
.id = 344,
|
.id = 344,
|
||||||
.auxiliary = 0
|
.auxiliary = 0
|
||||||
};
|
};
|
||||||
(*Recipes_addShapelessRecipe)(recipes, result, {type1, type2});
|
std::vector<Recipes_Type> types = {type1, type2};
|
||||||
|
(*Recipes_addShapelessRecipe)(recipes, &result, &types);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom Furnace Recipes
|
// Custom Furnace Recipes
|
||||||
static void FurnaceRecipes_injection(unsigned char *recipes) {
|
static void FurnaceRecipes_injection(FurnaceRecipes *recipes) {
|
||||||
// Add
|
// 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
|
// Init
|
||||||
|
Loading…
Reference in New Issue
Block a user