2020-12-02 18:18:49 -05:00
|
|
|
#include <vector>
|
|
|
|
|
2021-01-27 16:26:19 -05:00
|
|
|
#include <libreborn/libreborn.h>
|
2021-09-11 23:18:12 -04:00
|
|
|
#include <symbols/minecraft.h>
|
2020-12-02 18:18:49 -05:00
|
|
|
|
2022-06-25 17:30:08 -04:00
|
|
|
#include <mods/init/init.h>
|
|
|
|
#include <mods/feature/feature.h>
|
|
|
|
#include <mods/sign/sign.h>
|
2020-12-02 18:18:49 -05:00
|
|
|
|
|
|
|
// Open Sign Screen
|
2024-07-17 06:42:58 -04:00
|
|
|
static void LocalPlayer_openTextEdit_injection(__attribute__((unused)) LocalPlayer_openTextEdit_t original, LocalPlayer *local_player, TileEntity *sign) {
|
2024-02-12 02:29:35 -05:00
|
|
|
if (sign->type == 4) {
|
2024-01-06 06:30:23 -05:00
|
|
|
Minecraft *minecraft = local_player->minecraft;
|
2024-05-17 00:36:28 -04:00
|
|
|
TextEditScreen *screen = new TextEditScreen;
|
2021-02-16 12:26:40 -05:00
|
|
|
ALLOC_CHECK(screen);
|
2024-05-15 05:02:19 -04:00
|
|
|
screen = screen->constructor((SignTileEntity *) sign);
|
|
|
|
minecraft->setScreen((Screen *) screen);
|
2020-12-02 18:18:49 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Store Text Input
|
2024-06-21 01:19:37 -04:00
|
|
|
void sign_key_press(const char key) {
|
2024-05-17 02:52:55 -04:00
|
|
|
Keyboard::_inputText.push_back(key);
|
2020-12-02 18:18:49 -05:00
|
|
|
}
|
|
|
|
|
2021-06-28 22:59:24 -04:00
|
|
|
// Init
|
|
|
|
void init_sign() {
|
2022-04-09 20:01:16 -04:00
|
|
|
if (feature_has("Fix Sign Placement", server_disabled)) {
|
2020-12-02 18:18:49 -05:00
|
|
|
// Fix Signs
|
2024-07-17 06:42:58 -04:00
|
|
|
overwrite_calls(LocalPlayer_openTextEdit, LocalPlayer_openTextEdit_injection);
|
2020-12-02 18:18:49 -05:00
|
|
|
}
|
2021-06-28 22:59:24 -04:00
|
|
|
}
|