From 3ff24c2a92b1d9439c88b7f734ca2e2430add9df Mon Sep 17 00:00:00 2001 From: Bigjango13 Date: Fri, 8 Mar 2024 18:03:19 -0500 Subject: [PATCH 1/6] Add chat history - More symbols too - Made CUSTOM_VTABLE not static, for modders --- libreborn/include/libreborn/util.h | 4 +-- .../mods/text-input-box/TextInputBox.h | 5 ++- mods/src/chat/ui.cpp | 11 +++++-- mods/src/text-input-box/TextInputBox.cpp | 33 ++++++++++++++++++- symbols/CMakeLists.txt | 2 ++ symbols/src/entity/Entity.def | 2 ++ symbols/src/game/GameRenderer.def | 1 + symbols/src/game/Minecraft.def | 11 ++++--- symbols/src/item/DiggerItem.def | 3 ++ symbols/src/level/Biome.def | 18 ++++++++++ symbols/src/level/Level.def | 4 +++ symbols/src/level/LevelRenderer.def | 1 + symbols/src/level/RandomLevelSource.def | 1 + symbols/src/level/container/Inventory.def | 2 ++ symbols/src/level/feature/Feature.def | 7 ++++ symbols/src/misc/Mth.def | 1 + symbols/src/tile/Tile.def | 1 + symbols/src/tile/TileRenderer.def | 6 +++- 18 files changed, 102 insertions(+), 11 deletions(-) create mode 100644 symbols/src/item/DiggerItem.def create mode 100644 symbols/src/level/feature/Feature.def diff --git a/libreborn/include/libreborn/util.h b/libreborn/include/libreborn/util.h index b63e86b..707fdf0 100644 --- a/libreborn/include/libreborn/util.h +++ b/libreborn/include/libreborn/util.h @@ -52,7 +52,7 @@ int reborn_is_server(); // Customize VTable #define CUSTOM_VTABLE(name, parent) \ - static void _setup_##name##_vtable(parent##_vtable *vtable); \ + void _setup_##name##_vtable(parent##_vtable *vtable); \ static parent##_vtable *get_##name##_vtable() { \ static parent##_vtable *vtable = NULL; \ /* Allocate VTable */ \ @@ -67,7 +67,7 @@ int reborn_is_server(); return vtable; \ } \ /* User-Defined Setup Code */ \ - static void _setup_##name##_vtable(parent##_vtable *vtable) + void _setup_##name##_vtable(parent##_vtable *vtable) #ifdef __cplusplus } diff --git a/mods/include/mods/text-input-box/TextInputBox.h b/mods/include/mods/text-input-box/TextInputBox.h index 16f62bf..9fcaf18 100644 --- a/mods/include/mods/text-input-box/TextInputBox.h +++ b/mods/include/mods/text-input-box/TextInputBox.h @@ -3,7 +3,7 @@ #include struct TextInputBox { - static TextInputBox *create(const std::string &placeholder = "", const std::string &text = ""); + static TextInputBox *create(const std::string &placeholder = "", const std::string &text = "", const std::vector *history = NULL); GuiComponent super; @@ -21,6 +21,8 @@ struct TextInputBox { bool isFocused(); void setMaxLength(int max_length); + int history_pos; + private: void recalculateScroll(); @@ -38,4 +40,5 @@ private: Font *m_pFont; int m_maxLength; int m_scrollPos; + const std::vector *history; }; diff --git a/mods/src/chat/ui.cpp b/mods/src/chat/ui.cpp index 4aa18c1..bdc2dc2 100644 --- a/mods/src/chat/ui.cpp +++ b/mods/src/chat/ui.cpp @@ -10,6 +10,8 @@ #include #include +std::vector history; + // Structure struct ChatScreen { TextInputScreen super; @@ -24,7 +26,7 @@ CUSTOM_VTABLE(chat_screen, Screen) { original_init(super); ChatScreen *self = (ChatScreen *) super; // Text Input - self->chat = TextInputBox::create(); + self->chat = TextInputBox::create("", "", &history); self->super.m_textInputs->push_back(self->chat); self->chat->init(super->font); self->chat->setFocused(true); @@ -78,7 +80,11 @@ CUSTOM_VTABLE(chat_screen, Screen) { ChatScreen *self = (ChatScreen *) super; if (key == 0x0d && self->chat->isFocused()) { if (self->chat->getText().length() > 0) { - _chat_queue_message(self->chat->getText().c_str()); + std::string text = self->chat->getText(); + if (self->chat->history_pos != int(history.size() - 1)) { + history.push_back(text); + } + _chat_queue_message(text.c_str()); } Minecraft_setScreen(super->minecraft, NULL); } @@ -113,6 +119,7 @@ static Screen *create_chat_screen() { // Init void _init_chat_ui() { + history = {}; misc_run_on_game_key_press([](Minecraft *minecraft, int key) { if (key == 0x54) { if (Minecraft_isLevelGenerated(minecraft) && minecraft->screen == NULL) { diff --git a/mods/src/text-input-box/TextInputBox.cpp b/mods/src/text-input-box/TextInputBox.cpp index 22d0c8e..cfbda59 100644 --- a/mods/src/text-input-box/TextInputBox.cpp +++ b/mods/src/text-input-box/TextInputBox.cpp @@ -2,7 +2,16 @@ #include -TextInputBox *TextInputBox::create(const std::string &placeholder, const std::string &text) { +static int get_vec_size(const std::vector *vec) { + return vec ? vec->size() : 0; +} + +static std::string index_vec(const std::vector *vec, int pos) { + if (vec == NULL || pos == get_vec_size(vec)) return ""; + return vec->at(pos); +} + +TextInputBox *TextInputBox::create(const std::string &placeholder, const std::string &text, const std::vector *history) { // Construct TextInputBox *self = new TextInputBox; GuiComponent_constructor(&self->super); @@ -22,6 +31,8 @@ TextInputBox *TextInputBox::create(const std::string &placeholder, const std::st self->m_pFont = nullptr; self->m_maxLength = -1; self->m_scrollPos = 0; + self->history = history; + self->history_pos = get_vec_size(history); // Return return self; @@ -88,6 +99,16 @@ void TextInputBox::keyPressed(int key) { recalculateScroll(); break; } + case 0x26: { + // Up + int old_pos = history_pos; + history_pos -= 1; + if (history_pos < 0) history_pos = get_vec_size(history); + if (old_pos == history_pos) break; + m_text = index_vec(history, history_pos); + m_insertHead = int(m_text.size()); + break; + } case 0x27: { // Right m_insertHead++; @@ -101,6 +122,16 @@ void TextInputBox::keyPressed(int key) { recalculateScroll(); break; } + case 0x28: { + // Down + int old_pos = history_pos; + history_pos += 1; + if (history_pos > get_vec_size(history)) history_pos = 0; + if (old_pos == history_pos) break; + m_text = index_vec(history, history_pos); + m_insertHead = int(m_text.size()); + break; + } case 0x0d: { // Enter m_bFocused = false; diff --git a/symbols/CMakeLists.txt b/symbols/CMakeLists.txt index cabb173..55be867 100644 --- a/symbols/CMakeLists.txt +++ b/symbols/CMakeLists.txt @@ -66,6 +66,7 @@ set(SRC src/level/container/Container.def src/level/container/ContainerMenu.def src/level/container/Inventory.def + src/level/feature/Feature.def src/level/feature/LargeFeature.def src/level/feature/LargeCaveFeature.def src/level/Material.def @@ -97,6 +98,7 @@ set(SRC src/item/ArmorItem.def src/item/TileItem.def src/item/FoodItem.def + src/item/DiggerItem.def src/api/OffsetPosTranslator.def src/api/CommandServer.def src/api/ConnectedClient.def diff --git a/symbols/src/entity/Entity.def b/symbols/src/entity/Entity.def index ec7a88b..bd5e7ff 100644 --- a/symbols/src/entity/Entity.def +++ b/symbols/src/entity/Entity.def @@ -1,5 +1,6 @@ virtual-method void remove() = 0x10; virtual-method void tick() = 0x34; +virtual-method float getBrightness(float param_1) = 0x64; virtual-method bool interact(Player *with) = 0x6c; virtual-method void playerTouch(Player *player) = 0x70; virtual-method bool isPlayer() = 0x94; @@ -37,3 +38,4 @@ property int fire_timer = 0xa0; property int renderer_id = 0xa8; property bool on_ground = 0xb2; property bool freeze_physics = 0xb9; +property float fall_distance = 0xac; diff --git a/symbols/src/game/GameRenderer.def b/symbols/src/game/GameRenderer.def index 2e149cb..b8795ef 100644 --- a/symbols/src/game/GameRenderer.def +++ b/symbols/src/game/GameRenderer.def @@ -1,3 +1,4 @@ +method void tick(int tick, int max_ticks) = 0x495bc; method void render(float param_1) = 0x4a338; method void setupCamera(float param_1, int param_2) = 0x489f8; diff --git a/symbols/src/game/Minecraft.def b/symbols/src/game/Minecraft.def index 04707c0..35229b9 100644 --- a/symbols/src/game/Minecraft.def +++ b/symbols/src/game/Minecraft.def @@ -4,7 +4,7 @@ method void tickInput() = 0x15ffc; method void setIsCreativeMode(int is_creative) = 0x16ec4; method int isTouchscreen() = 0x1639c; method void setScreen(Screen *screen) = 0x15d6c; -method void tick(int param_1, int param_2) = 0x16934; +method void tick(int tick, int max_ticks) = 0x16934; method void hostMultiplayer(int port) = 0x16664; method char *getProgressMessage() = 0x16e58; method uint isLevelGenerated() = 0x16e6c; @@ -27,21 +27,24 @@ property int screen_width = 0x20; property int screen_height = 0x24; property Options options = 0x3c; property LevelRenderer *levelrenderer = 0x150; +property GameRenderer *gamerenderer = 0x154; property GameMode *game_mode = 0x160; property Textures *textures = 0x164; +property ScreenChooser screen_chooser = 0x168; +property Font *font = 0x16c; property RakNetInstance *rak_net_instance = 0x170; property NetEventCallback *network_handler = 0x174; property Level *level = 0x188; +property LocalPlayer *player = 0x18c; property Mob *camera = 0x194; property Gui gui = 0x198; -property LocalPlayer *player = 0x18c; property Screen *screen = 0xc10; property HitResult hit_result = 0xc38; property int progress = 0xc60; +property int ticks_per_update = 0xc70; +property bool is_creative_mode = 0xcb5; property PerfRenderer *perf_renderer = 0xcbc; property CommandServer *command_server = 0xcc0; -property Font *font = 0x16c; -property ScreenChooser screen_chooser = 0x168; // Smooth Lighting static-property bool useAmbientOcclusion = 0x136b90; diff --git a/symbols/src/item/DiggerItem.def b/symbols/src/item/DiggerItem.def new file mode 100644 index 0000000..7d114e8 --- /dev/null +++ b/symbols/src/item/DiggerItem.def @@ -0,0 +1,3 @@ +extends Item; + +property float speed = 0x24; diff --git a/symbols/src/level/Biome.def b/symbols/src/level/Biome.def index 4b1e307..4b5fa33 100644 --- a/symbols/src/level/Biome.def +++ b/symbols/src/level/Biome.def @@ -1,2 +1,20 @@ +vtable 0x110180; +vtable-size 0x24; + +static-method void initBiomes() = 0xae320; +static-method void recalc() = 0xae010; +static-method Biome *_getBiome(float temp, float humidity) = 0xadf04; + +virtual-method Feature *getTreeFeature(Random *random) = 0x8; +virtual-method Feature *getGrassFeature(Random *random) = 0xc; +virtual-method float adjustScale(float scale) = 0x10; +virtual-method float adjustDepth(float depth) = 0x14; +virtual-method uint getSkyColor(float temp) = 0x18; +//virtual-method ??? *getMobs(MobCategory *category) = 0x1c; +virtual-method float getCreatureProbability() = 0x20; + property int color = 0x2c; property int leaf_color = 0x34; + +// 64x64, Temp x humidity +static-property-array Biome *map = 0x17c970; diff --git a/symbols/src/level/Level.def b/symbols/src/level/Level.def index 14b50f9..c604a9c 100644 --- a/symbols/src/level/Level.def +++ b/symbols/src/level/Level.def @@ -11,17 +11,21 @@ method Entity *getEntity(int id) = 0xa45a4; method bool addEntity(Entity *entity) = 0xa7cbc; method int getBrightness2(LightLayer *layer, int x, int y, int z) = 0xa3c70; method void playSound(Entity *entity, std::string *name, float volume, float pitch) = 0xa42a8; +// Searches aabb for entities, ignores the entity "ignore", overwrites the same vector each time +method std::vector *getEntities(Entity *ignore, AABB *aabb) = 0xa5a4c; // Searches aabb for entities of type type_id, adds then to buff, returns the number of entities added method int getEntitiesOfType(int type_id, AABB *aabb, std::vector *buff) = 0xa612c; // Searches aabb for entities of base type base_type, adds then to buff, returns the number of entities added method int getEntitiesOfClass(int base_type, AABB *aabb, std::vector *buff) = 0xa6240; // This will implicitly make the tile entity if the tile at x, y, z doesn't have one and is an EntityTile method TileEntity *getTileEntity(int x, int y, int z) = 0xa55d4; +method void animateTick(int x, int y, int z) = 0xa5920; virtual-method void tick() = 0x28; virtual-method void updateSleepingPlayerList() = 0x2c; virtual-method ChunkCache *createChunkSource() = 0x30; +property bool done_generating = 0x12; property std::vector entities = 0x20; property std::vector tileentities = 0x50; property std::vector players = 0x60; diff --git a/symbols/src/level/LevelRenderer.def b/symbols/src/level/LevelRenderer.def index 1cb645d..d15a4f4 100644 --- a/symbols/src/level/LevelRenderer.def +++ b/symbols/src/level/LevelRenderer.def @@ -1,3 +1,4 @@ +method void tick() = 0x4da1c; method void render(Mob *mob, int param_1, float delta) = 0x4f710; method void renderDebug(AABB *aabb, float delta) = 0x4d310; method void generateSky() = 0x4d0d4; diff --git a/symbols/src/level/RandomLevelSource.def b/symbols/src/level/RandomLevelSource.def index ea21c11..6d41eea 100644 --- a/symbols/src/level/RandomLevelSource.def +++ b/symbols/src/level/RandomLevelSource.def @@ -5,4 +5,5 @@ vtable 0x110598; method void buildSurface(int chunk_x, int chunk_y, uchar *chunk_data, Biome **biomes) = 0xb32ec; property LargeCaveFeature cave_feature = 0x8; +property Random random = 0x19f8; property Level *level = 0x72c8; diff --git a/symbols/src/level/container/Inventory.def b/symbols/src/level/container/Inventory.def index 7a1158c..6a7441f 100644 --- a/symbols/src/level/container/Inventory.def +++ b/symbols/src/level/container/Inventory.def @@ -6,5 +6,7 @@ method ItemInstance *getSelected() = 0x8d134; // It's just FillingContainer_linkSlot with selectedSlot as linked_slot method bool moveToSelectedSlot(int unlinked_slot, bool push_aside) = 0x8d148; method void setupDefault() = 0x8d164; +method void clearInventoryWithDefault() = 0x8e7c8; +method void clearInventory() = 0x92b84; property int selectedSlot = 0x28; diff --git a/symbols/src/level/feature/Feature.def b/symbols/src/level/feature/Feature.def new file mode 100644 index 0000000..9310d49 --- /dev/null +++ b/symbols/src/level/feature/Feature.def @@ -0,0 +1,7 @@ +vtable 0x10e530; +vtable-size 0x10; + +// Pure virtual +virtual-method bool place(Level *level, Random *random, int x, int y, int z) = 0x8; +// Not sure about args, it doesn't seem to be used at all +virtual-method void init(float x, float y, float z) = 0xc; diff --git a/symbols/src/misc/Mth.def b/symbols/src/misc/Mth.def index 9dd5c78..4133f59 100644 --- a/symbols/src/misc/Mth.def +++ b/symbols/src/misc/Mth.def @@ -5,3 +5,4 @@ static-method float sin(float x) = 0x7775c; static-method float cos(float x) = 0x77728; static-method float abs(float x) = 0x7781c; static-method float min(float a, float b) = 0x7782c; +static-method float invSqrt(float a) = 0x776d4; \ No newline at end of file diff --git a/symbols/src/tile/Tile.def b/symbols/src/tile/Tile.def index 62270ae..18c0ebd 100644 --- a/symbols/src/tile/Tile.def +++ b/symbols/src/tile/Tile.def @@ -73,3 +73,4 @@ static-property Tile *grass_carried = 0x181dd4; // Sounds static-property Tile_SoundType SOUND_STONE = 0x181c80; +static-property Tile_SoundType SOUND_WOOD = 0x181cb4; diff --git a/symbols/src/tile/TileRenderer.def b/symbols/src/tile/TileRenderer.def index e779491..23a3d3d 100644 --- a/symbols/src/tile/TileRenderer.def +++ b/symbols/src/tile/TileRenderer.def @@ -1,4 +1,8 @@ +size 0xb8; + +constructor (Minecraft *minecraft, LevelSource *level) = 0x53e58; + method bool tesselateBlockInWorld(Tile *tile, int x, int y, int z) = 0x59e30; method bool tesselateInWorld(Tile *tile, int x, int y, int z) = 0x5e80c; -property Level *level = 0x0; +property LevelSource *level = 0x0; -- 2.45.1 From a6e0cd8f1389a0f85b6f9ba59890f7ebdde3b2c3 Mon Sep 17 00:00:00 2001 From: Bigjango13 Date: Sat, 9 Mar 2024 13:01:52 -0500 Subject: [PATCH 2/6] Fix history editing bug - Use the `get_` pattern for chat's `history`. - Make the Biome_map comment clearer --- mods/src/chat/ui.cpp | 11 +++++++---- symbols/src/item/ItemInHandRenderer.def | 2 ++ symbols/src/level/Biome.def | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mods/src/chat/ui.cpp b/mods/src/chat/ui.cpp index bdc2dc2..12157b7 100644 --- a/mods/src/chat/ui.cpp +++ b/mods/src/chat/ui.cpp @@ -10,7 +10,10 @@ #include #include -std::vector history; +static std::vector &get_history() { + static std::vector history = {}; + return history; +} // Structure struct ChatScreen { @@ -26,7 +29,7 @@ CUSTOM_VTABLE(chat_screen, Screen) { original_init(super); ChatScreen *self = (ChatScreen *) super; // Text Input - self->chat = TextInputBox::create("", "", &history); + self->chat = TextInputBox::create("", "", &get_history()); self->super.m_textInputs->push_back(self->chat); self->chat->init(super->font); self->chat->setFocused(true); @@ -81,7 +84,8 @@ CUSTOM_VTABLE(chat_screen, Screen) { if (key == 0x0d && self->chat->isFocused()) { if (self->chat->getText().length() > 0) { std::string text = self->chat->getText(); - if (self->chat->history_pos != int(history.size() - 1)) { + std::vector &history = get_history(); + if (history.size() == 0 || text != history.back()) { history.push_back(text); } _chat_queue_message(text.c_str()); @@ -119,7 +123,6 @@ static Screen *create_chat_screen() { // Init void _init_chat_ui() { - history = {}; misc_run_on_game_key_press([](Minecraft *minecraft, int key) { if (key == 0x54) { if (Minecraft_isLevelGenerated(minecraft) && minecraft->screen == NULL) { diff --git a/symbols/src/item/ItemInHandRenderer.def b/symbols/src/item/ItemInHandRenderer.def index ac3f3ed..e6cbe76 100644 --- a/symbols/src/item/ItemInHandRenderer.def +++ b/symbols/src/item/ItemInHandRenderer.def @@ -5,3 +5,5 @@ property Minecraft *mc = 0x18; method void renderItem(Mob *mob, ItemInstance *item) = 0x4b824; method void render(float param_1) = 0x4bfcc; + +static-property ItemInHandRenderer *instance = 0x137bc0; \ No newline at end of file diff --git a/symbols/src/level/Biome.def b/symbols/src/level/Biome.def index 4b5fa33..3fed3d5 100644 --- a/symbols/src/level/Biome.def +++ b/symbols/src/level/Biome.def @@ -16,5 +16,5 @@ virtual-method float getCreatureProbability() = 0x20; property int color = 0x2c; property int leaf_color = 0x34; -// 64x64, Temp x humidity +// This is a Biome*[64x64], temp x humidity static-property-array Biome *map = 0x17c970; -- 2.45.1 From 5e5088e3eff516ec4640fb29c5697272ca179d7c Mon Sep 17 00:00:00 2001 From: Bigjango13 Date: Sun, 10 Mar 2024 22:46:34 -0400 Subject: [PATCH 3/6] Move chat history into chat - `get_death_message` is no longer static - Fix ItemInHandRenderer_instance symbol --- .../mods/text-input-box/TextInputBox.h | 6 +-- mods/src/chat/ui.cpp | 26 ++++++++++++- mods/src/death/death.cpp | 2 +- mods/src/text-input-box/TextInputBox.cpp | 38 +++---------------- symbols/src/item/ItemInHandRenderer.def | 2 +- symbols/src/misc/Tesselator.def | 1 + symbols/src/tile/Tile.def | 8 ++++ symbols/src/tile/TileRenderer.def | 4 ++ 8 files changed, 48 insertions(+), 39 deletions(-) diff --git a/mods/include/mods/text-input-box/TextInputBox.h b/mods/include/mods/text-input-box/TextInputBox.h index 9fcaf18..3a582b1 100644 --- a/mods/include/mods/text-input-box/TextInputBox.h +++ b/mods/include/mods/text-input-box/TextInputBox.h @@ -3,7 +3,7 @@ #include struct TextInputBox { - static TextInputBox *create(const std::string &placeholder = "", const std::string &text = "", const std::vector *history = NULL); + static TextInputBox *create(const std::string &placeholder = "", const std::string &text = ""); GuiComponent super; @@ -18,11 +18,10 @@ struct TextInputBox { void onClick(int x, int y); bool clicked(int x, int y); std::string getText(); + void setText(std::string text); bool isFocused(); void setMaxLength(int max_length); - int history_pos; - private: void recalculateScroll(); @@ -40,5 +39,4 @@ private: Font *m_pFont; int m_maxLength; int m_scrollPos; - const std::vector *history; }; diff --git a/mods/src/chat/ui.cpp b/mods/src/chat/ui.cpp index 12157b7..b0fa8a0 100644 --- a/mods/src/chat/ui.cpp +++ b/mods/src/chat/ui.cpp @@ -15,11 +15,16 @@ static std::vector &get_history() { return history; } +static std::string index_vec(const std::vector &vec, int pos) { + return pos == int(vec.size()) ? "" : vec.at(pos); +} + // Structure struct ChatScreen { TextInputScreen super; TextInputBox *chat; Button *send; + int history_pos; }; CUSTOM_VTABLE(chat_screen, Screen) { TextInputScreen::setup(vtable); @@ -29,10 +34,11 @@ CUSTOM_VTABLE(chat_screen, Screen) { original_init(super); ChatScreen *self = (ChatScreen *) super; // Text Input - self->chat = TextInputBox::create("", "", &get_history()); + self->chat = TextInputBox::create(); self->super.m_textInputs->push_back(self->chat); self->chat->init(super->font); self->chat->setFocused(true); + self->history_pos = get_history().size(); // Determine Max Length std::string prefix = _chat_get_prefix(Strings_default_username); int max_length = MAX_CHAT_MESSAGE_LENGTH - prefix.length(); @@ -91,6 +97,24 @@ CUSTOM_VTABLE(chat_screen, Screen) { _chat_queue_message(text.c_str()); } Minecraft_setScreen(super->minecraft, NULL); + } else if (key == 0x26 && self->chat->isFocused()) { + // Up + int old_pos = self->history_pos; + self->history_pos -= 1; + if (self->history_pos < 0) self->history_pos = get_history().size(); + if (old_pos != self->history_pos) { + self->chat->setText(index_vec(get_history(), self->history_pos)); + } + return; + } else if (key == 0x28 && self->chat->isFocused()) { + // Down + int old_pos = self->history_pos; + self->history_pos += 1; + if (self->history_pos > int(get_history().size())) self->history_pos = 0; + if (old_pos != self->history_pos) { + self->chat->setText(index_vec(get_history(), self->history_pos)); + } + return; } // Call Original Method original_keyPressed(super, key); diff --git a/mods/src/death/death.cpp b/mods/src/death/death.cpp index 2b88ba6..487faba 100644 --- a/mods/src/death/death.cpp +++ b/mods/src/death/death.cpp @@ -8,7 +8,7 @@ // Death Messages static const char *monster_names[] = {"Zombie", "Creeper", "Skeleton", "Spider", "Zombie Pigman"}; -static std::string get_death_message(Player *player, Entity *cause, bool was_shot = false) { +std::string get_death_message(Player *player, Entity *cause, bool was_shot = false) { // Prepare Death Message std::string message = player->username; if (cause) { diff --git a/mods/src/text-input-box/TextInputBox.cpp b/mods/src/text-input-box/TextInputBox.cpp index cfbda59..3ec57ce 100644 --- a/mods/src/text-input-box/TextInputBox.cpp +++ b/mods/src/text-input-box/TextInputBox.cpp @@ -2,16 +2,7 @@ #include -static int get_vec_size(const std::vector *vec) { - return vec ? vec->size() : 0; -} - -static std::string index_vec(const std::vector *vec, int pos) { - if (vec == NULL || pos == get_vec_size(vec)) return ""; - return vec->at(pos); -} - -TextInputBox *TextInputBox::create(const std::string &placeholder, const std::string &text, const std::vector *history) { +TextInputBox *TextInputBox::create(const std::string &placeholder, const std::string &text) { // Construct TextInputBox *self = new TextInputBox; GuiComponent_constructor(&self->super); @@ -31,8 +22,6 @@ TextInputBox *TextInputBox::create(const std::string &placeholder, const std::st self->m_pFont = nullptr; self->m_maxLength = -1; self->m_scrollPos = 0; - self->history = history; - self->history_pos = get_vec_size(history); // Return return self; @@ -99,16 +88,6 @@ void TextInputBox::keyPressed(int key) { recalculateScroll(); break; } - case 0x26: { - // Up - int old_pos = history_pos; - history_pos -= 1; - if (history_pos < 0) history_pos = get_vec_size(history); - if (old_pos == history_pos) break; - m_text = index_vec(history, history_pos); - m_insertHead = int(m_text.size()); - break; - } case 0x27: { // Right m_insertHead++; @@ -122,16 +101,6 @@ void TextInputBox::keyPressed(int key) { recalculateScroll(); break; } - case 0x28: { - // Down - int old_pos = history_pos; - history_pos += 1; - if (history_pos > get_vec_size(history)) history_pos = 0; - if (old_pos == history_pos) break; - m_text = index_vec(history, history_pos); - m_insertHead = int(m_text.size()); - break; - } case 0x0d: { // Enter m_bFocused = false; @@ -316,6 +285,11 @@ std::string TextInputBox::getText() { return m_text; } +void TextInputBox::setText(std::string str) { + m_text = str; + m_insertHead = int(m_text.size()); +} + bool TextInputBox::isFocused() { return m_bFocused; } diff --git a/symbols/src/item/ItemInHandRenderer.def b/symbols/src/item/ItemInHandRenderer.def index e6cbe76..1c239b9 100644 --- a/symbols/src/item/ItemInHandRenderer.def +++ b/symbols/src/item/ItemInHandRenderer.def @@ -6,4 +6,4 @@ property Minecraft *mc = 0x18; method void renderItem(Mob *mob, ItemInstance *item) = 0x4b824; method void render(float param_1) = 0x4bfcc; -static-property ItemInHandRenderer *instance = 0x137bc0; \ No newline at end of file +static-property ItemInHandRenderer **instance = 0x137bc0; \ No newline at end of file diff --git a/symbols/src/misc/Tesselator.def b/symbols/src/misc/Tesselator.def index c9c1e5e..92ea2e3 100644 --- a/symbols/src/misc/Tesselator.def +++ b/symbols/src/misc/Tesselator.def @@ -4,5 +4,6 @@ method void colorABGR(int color) = 0x52b54; method void color(int r, int g, int b, int a) = 0x52a48; method void vertex(float x, float y, float z) = 052bc0; method void vertexUV(float x, float y, float z, float u, float v) = 0x52d40; +method void addOffset(float x, float y, float z) = 0x52d90; static-property Tesselator instance = 0x137538; diff --git a/symbols/src/tile/Tile.def b/symbols/src/tile/Tile.def index 18c0ebd..7d7471c 100644 --- a/symbols/src/tile/Tile.def +++ b/symbols/src/tile/Tile.def @@ -23,6 +23,8 @@ virtual-method void tick(Level *level, int x, int y, int z) = 0x58; virtual-method void neighborChanged(Level *level, int x, int y, int z, int neighborId) = 0x64; virtual-method void onPlace(Level *level, int x, int y, int z) = 0x68; virtual-method void onRemove(Level *level, int x, int y, int z) = 0x6c; +virtual-method int getResource(int data, Random *random) = 0x70; +virtual-method int getResourceCount(Random *random) = 0x74; virtual-method int getRenderLayer() = 0x94; virtual-method int use(Level *level, int x, int y, int z, Player *player) = 0x98; virtual-method void setPlacedBy(Level *level, int x, int y, int z, Mob *placer) = 0xa8; @@ -38,6 +40,12 @@ virtual-method Tile *setDestroyTime(float destroy_time) = 0xf8; property int texture = 0x4; property int id = 0x8; +property float x1 = 0xc; +property float y1 = 0x10; +property float z1 = 0x14; +property float x2 = 0x18; +property float y2 = 0x1c; +property float z2 = 0x20; property int category = 0x3c; property AABB aabb = 0x40; diff --git a/symbols/src/tile/TileRenderer.def b/symbols/src/tile/TileRenderer.def index 23a3d3d..2ba223c 100644 --- a/symbols/src/tile/TileRenderer.def +++ b/symbols/src/tile/TileRenderer.def @@ -2,7 +2,11 @@ size 0xb8; constructor (Minecraft *minecraft, LevelSource *level) = 0x53e58; +static-method bool canRender(int shape) = 0x5accc; + method bool tesselateBlockInWorld(Tile *tile, int x, int y, int z) = 0x59e30; method bool tesselateInWorld(Tile *tile, int x, int y, int z) = 0x5e80c; +method void renderGuiTile(Tile *tile, int aux) = 0x5ad0c; +method void renderTile(Tile *tile, int data) = 0x5dcb0; property LevelSource *level = 0x0; -- 2.45.1 From 8de638eb1a6d140305b06e40ca7dd0420b266e85 Mon Sep 17 00:00:00 2001 From: Bigjango13 Date: Mon, 18 Mar 2024 19:44:17 -0400 Subject: [PATCH 4/6] Make chat history edits saved temporarily --- mods/include/mods/title-screen/title-screen.h | 2 + mods/src/chat/chat.cpp | 8 +-- mods/src/chat/ui.cpp | 64 ++++++++++--------- symbols/src/entity/Entity.def | 1 + symbols/src/entity/EntityRenderDispatcher.def | 2 + symbols/src/item/ItemInHandRenderer.def | 4 +- symbols/src/level/Level.def | 18 +++++- symbols/src/level/Material.def | 3 +- symbols/src/level/ServerLevel.def | 1 + symbols/src/level/feature/Feature.def | 2 + symbols/src/misc/CompoundTag.def | 3 + symbols/src/network/packet/ChatPacket.def | 2 +- symbols/src/network/packet/Packet.def | 3 +- symbols/src/tile/EntityTile.def | 1 + symbols/src/tile/Tile.def | 22 ++++++- 15 files changed, 93 insertions(+), 43 deletions(-) diff --git a/mods/include/mods/title-screen/title-screen.h b/mods/include/mods/title-screen/title-screen.h index bbe30a4..cf6330d 100644 --- a/mods/include/mods/title-screen/title-screen.h +++ b/mods/include/mods/title-screen/title-screen.h @@ -3,4 +3,6 @@ #include #include +extern "C" { void title_screen_load_splashes(std::vector &splashes); +} diff --git a/mods/src/chat/chat.cpp b/mods/src/chat/chat.cpp index 563d670..857e1eb 100644 --- a/mods/src/chat/chat.cpp +++ b/mods/src/chat/chat.cpp @@ -60,9 +60,9 @@ void chat_handle_packet_send(Minecraft *minecraft, ChatPacket *packet) { RakNetInstance *rak_net_instance = minecraft->rak_net_instance; if (rak_net_instance->vtable->isServer(rak_net_instance)) { // Hosting Multiplayer - char *message = packet->message; + const char *message = packet->message.c_str(); ServerSideNetworkHandler *server_side_network_handler = (ServerSideNetworkHandler *) minecraft->network_handler; - chat_send_message(server_side_network_handler, Strings_default_username, message); + chat_send_message(server_side_network_handler, Strings_default_username, (char *) message); } else { // Client rak_net_instance->vtable->send(rak_net_instance, (Packet *) packet); @@ -82,8 +82,8 @@ static void ServerSideNetworkHandler_handle_ChatPacket_injection(ServerSideNetwo Player *player = ServerSideNetworkHandler_getPlayer(server_side_network_handler, rak_net_guid); if (player != NULL) { const char *username = player->username.c_str(); - char *message = chat_packet->message; - chat_send_message(server_side_network_handler, (char *) username, message); + const char *message = chat_packet->message.c_str(); + chat_send_message(server_side_network_handler, (char *) username, (char *) message); } } diff --git a/mods/src/chat/ui.cpp b/mods/src/chat/ui.cpp index b0fa8a0..50cd2ef 100644 --- a/mods/src/chat/ui.cpp +++ b/mods/src/chat/ui.cpp @@ -15,10 +15,6 @@ static std::vector &get_history() { return history; } -static std::string index_vec(const std::vector &vec, int pos) { - return pos == int(vec.size()) ? "" : vec.at(pos); -} - // Structure struct ChatScreen { TextInputScreen super; @@ -29,6 +25,7 @@ struct ChatScreen { CUSTOM_VTABLE(chat_screen, Screen) { TextInputScreen::setup(vtable); // Init + static std::vector local_history = {}; static Screen_init_t original_init = vtable->init; vtable->init = [](Screen *super) { original_init(super); @@ -39,6 +36,8 @@ CUSTOM_VTABLE(chat_screen, Screen) { self->chat->init(super->font); self->chat->setFocused(true); self->history_pos = get_history().size(); + local_history = get_history(); + local_history.push_back(""); // Determine Max Length std::string prefix = _chat_get_prefix(Strings_default_username); int max_length = MAX_CHAT_MESSAGE_LENGTH - prefix.length(); @@ -87,34 +86,39 @@ CUSTOM_VTABLE(chat_screen, Screen) { vtable->keyPressed = [](Screen *super, int key) { // Handle Enter ChatScreen *self = (ChatScreen *) super; - if (key == 0x0d && self->chat->isFocused()) { - if (self->chat->getText().length() > 0) { - std::string text = self->chat->getText(); - std::vector &history = get_history(); - if (history.size() == 0 || text != history.back()) { - history.push_back(text); + if (self->chat->isFocused()) { + if (key == 0x0d) { + if (self->chat->getText().length() > 0) { + std::string text = self->chat->getText(); + if (get_history().size() == 0 || text != get_history().back()) { + get_history().push_back(text); + } + _chat_queue_message(text.c_str()); } - _chat_queue_message(text.c_str()); + Minecraft_setScreen(super->minecraft, NULL); + } else if (key == 0x26) { + // Up + local_history.at(self->history_pos) = self->chat->getText(); + // Change + int old_pos = self->history_pos; + self->history_pos -= 1; + if (self->history_pos < 0) self->history_pos = local_history.size() - 1; + if (old_pos != self->history_pos) { + self->chat->setText(local_history.at(self->history_pos)); + } + return; + } else if (key == 0x28) { + // Down + local_history.at(self->history_pos) = self->chat->getText(); + // Change + int old_pos = self->history_pos; + self->history_pos += 1; + if (self->history_pos > int(local_history.size()) - 1) self->history_pos = 0; + if (old_pos != self->history_pos) { + self->chat->setText(local_history.at(self->history_pos)); + } + return; } - Minecraft_setScreen(super->minecraft, NULL); - } else if (key == 0x26 && self->chat->isFocused()) { - // Up - int old_pos = self->history_pos; - self->history_pos -= 1; - if (self->history_pos < 0) self->history_pos = get_history().size(); - if (old_pos != self->history_pos) { - self->chat->setText(index_vec(get_history(), self->history_pos)); - } - return; - } else if (key == 0x28 && self->chat->isFocused()) { - // Down - int old_pos = self->history_pos; - self->history_pos += 1; - if (self->history_pos > int(get_history().size())) self->history_pos = 0; - if (old_pos != self->history_pos) { - self->chat->setText(index_vec(get_history(), self->history_pos)); - } - return; } // Call Original Method original_keyPressed(super, key); diff --git a/symbols/src/entity/Entity.def b/symbols/src/entity/Entity.def index bd5e7ff..3405fe0 100644 --- a/symbols/src/entity/Entity.def +++ b/symbols/src/entity/Entity.def @@ -37,5 +37,6 @@ property float height_offset = 0x68; property int fire_timer = 0xa0; property int renderer_id = 0xa8; property bool on_ground = 0xb2; +property bool pending_removal = 0xb8; property bool freeze_physics = 0xb9; property float fall_distance = 0xac; diff --git a/symbols/src/entity/EntityRenderDispatcher.def b/symbols/src/entity/EntityRenderDispatcher.def index 355dc45..7ba54d4 100644 --- a/symbols/src/entity/EntityRenderDispatcher.def +++ b/symbols/src/entity/EntityRenderDispatcher.def @@ -3,3 +3,5 @@ constructor () = 0x6096c; method void assign(uchar entity_id, EntityRenderer *renderer) = 0x6094c; method void render(Entity *entity, float x, float y, float z, float rot, float unknown) = 0x60674; static-method EntityRenderDispatcher *getInstance() = 0x60e90; + +property ItemInHandRenderer *item_renderer = 0x0; diff --git a/symbols/src/item/ItemInHandRenderer.def b/symbols/src/item/ItemInHandRenderer.def index 1c239b9..56fd212 100644 --- a/symbols/src/item/ItemInHandRenderer.def +++ b/symbols/src/item/ItemInHandRenderer.def @@ -4,6 +4,4 @@ property ItemInstance item = 0xc; property Minecraft *mc = 0x18; method void renderItem(Mob *mob, ItemInstance *item) = 0x4b824; -method void render(float param_1) = 0x4bfcc; - -static-property ItemInHandRenderer **instance = 0x137bc0; \ No newline at end of file +method void render(float param_1) = 0x4bfcc; \ No newline at end of file diff --git a/symbols/src/level/Level.def b/symbols/src/level/Level.def index c604a9c..03f8ebd 100644 --- a/symbols/src/level/Level.def +++ b/symbols/src/level/Level.def @@ -3,13 +3,20 @@ extends LevelSource; vtable 0x10fcf0; method void saveLevelData() = 0xa2e94; +method void setTile(int x, int y, int z, int id) = 0xa3904; method void setTileAndData(int x, int y, int z, int id, int data) = 0xa38b4; method void setTileAndDataNoUpdate(int x, int y, int z, int id, int data) = 0xa33d0; -method HitResult clip(uchar *param_1, uchar *param_2, bool clip_liquids, bool param_3) = 0xa3db0; +// clip_liquids and clip_hitboxes default to true +// If clip_hitboxes is true it will ignore blocks that have their getAABB return NULL +method HitResult clip(uchar *param_1, uchar *param_2, bool clip_liquids, bool clip_hitboxes) = 0xa3db0; +// Valid particles are crit, flame, lava, smoke, largesmoke, reddust, snowballpoof, and explode +// There is also bubble which only works under water and ironcrack which will crash the game method void addParticle(std::string *particle, float x, float y, float z, float deltaX, float deltaY, float deltaZ, int count) = 0xa449c; method Entity *getEntity(int id) = 0xa45a4; method bool addEntity(Entity *entity) = 0xa7cbc; method int getBrightness2(LightLayer *layer, int x, int y, int z) = 0xa3c70; +method int getRawBrightness(int x, int y, int z) = 0xa3b70; +// See mods/src/sound/repository.cpp for a list of sounds method void playSound(Entity *entity, std::string *name, float volume, float pitch) = 0xa42a8; // Searches aabb for entities, ignores the entity "ignore", overwrites the same vector each time method std::vector *getEntities(Entity *ignore, AABB *aabb) = 0xa5a4c; @@ -19,7 +26,16 @@ method int getEntitiesOfType(int type_id, AABB *aabb, std::vector *buff method int getEntitiesOfClass(int base_type, AABB *aabb, std::vector *buff) = 0xa6240; // This will implicitly make the tile entity if the tile at x, y, z doesn't have one and is an EntityTile method TileEntity *getTileEntity(int x, int y, int z) = 0xa55d4; +method void removeTileEntity(int x, int y, int z) = 0xa7aac; method void animateTick(int x, int y, int z) = 0xa5920; +// Called by trapdoors, doors, and tnt +method bool hasNeighborSignal(int x, int y, int z) = 0xa5f08; +// Called by hasNeighborSignal +method bool getSignal(int x, int y, int z, int direction) = 0xa5e6c; +// Called by getSignal +method bool hasDirectSignal(int x, int y, int z) = 0xa5d88; +// Called by hasDirectSignal +method bool getDirectSignal(int x, int y, int z, int direction) = 0xa5d2c; virtual-method void tick() = 0x28; virtual-method void updateSleepingPlayerList() = 0x2c; diff --git a/symbols/src/level/Material.def b/symbols/src/level/Material.def index fb420b0..bfde2e0 100644 --- a/symbols/src/level/Material.def +++ b/symbols/src/level/Material.def @@ -1,7 +1,8 @@ virtual-method bool isSolid() = 0x8; // Globals -static-property Material *dirt = 0x180a94; +static-property Material *dirt = 0x180a94; static-property Material *stone = 0x180a9c; static-property Material *metal = 0x180aa0; +static-property Material *plant = 0x180ab0; static-property Material *glass = 0x180acc; diff --git a/symbols/src/level/ServerLevel.def b/symbols/src/level/ServerLevel.def index 5416505..c562b23 100644 --- a/symbols/src/level/ServerLevel.def +++ b/symbols/src/level/ServerLevel.def @@ -1,5 +1,6 @@ extends Level; +vtable 0x109da0; size 0xb80; constructor (uchar *storage, uchar *name, LevelSettings *settings, int param_4, Dimension *dimension) = 0x7692c; diff --git a/symbols/src/level/feature/Feature.def b/symbols/src/level/feature/Feature.def index 9310d49..65cb5a9 100644 --- a/symbols/src/level/feature/Feature.def +++ b/symbols/src/level/feature/Feature.def @@ -1,3 +1,5 @@ + +constructor () = 0xb64a0; vtable 0x10e530; vtable-size 0x10; diff --git a/symbols/src/misc/CompoundTag.def b/symbols/src/misc/CompoundTag.def index bd3a465..ebc4dda 100644 --- a/symbols/src/misc/CompoundTag.def +++ b/symbols/src/misc/CompoundTag.def @@ -5,6 +5,9 @@ size 0x24; constructor (std::string name) = 0x69740; method bool getBoolean(std::string *name) = 0xd1b28; +method char getByte(std::string *name) = 0x7f00c; +method void putByte(std::string *name, char i) = 0x7d6d0; method short getShort(std::string *name) = 0x459c0; +method void putShort(std::string *name, short i) = 0x7d60c; method bool contains(std::string *name, int type) = 0x7d130; method void put(std::string *name, Tag *tag) = 0x6a040; diff --git a/symbols/src/network/packet/ChatPacket.def b/symbols/src/network/packet/ChatPacket.def index 35b8833..518acb1 100644 --- a/symbols/src/network/packet/ChatPacket.def +++ b/symbols/src/network/packet/ChatPacket.def @@ -2,4 +2,4 @@ extends Packet; vtable 0x108a98; -property char *message = 0xc; +property std::string message = 0xc; diff --git a/symbols/src/network/packet/Packet.def b/symbols/src/network/packet/Packet.def index bcc587c..80c6ac4 100644 --- a/symbols/src/network/packet/Packet.def +++ b/symbols/src/network/packet/Packet.def @@ -1,5 +1,6 @@ constructor () = 0x6fc18; -size 0x10; + +size 0x8; vtable 0x1024d8; vtable-size 0x14; diff --git a/symbols/src/tile/EntityTile.def b/symbols/src/tile/EntityTile.def index 2d0fec2..bc1e59e 100644 --- a/symbols/src/tile/EntityTile.def +++ b/symbols/src/tile/EntityTile.def @@ -4,4 +4,5 @@ vtable 0x111348; vtable-size 0x108; size 0x5c; +// Pure virtual virtual-method TileEntity *newTileEntity() = 0x104; diff --git a/symbols/src/tile/Tile.def b/symbols/src/tile/Tile.def index 7d7471c..b147e08 100644 --- a/symbols/src/tile/Tile.def +++ b/symbols/src/tile/Tile.def @@ -19,17 +19,32 @@ virtual-method int getTexture2(int face, int data) = 0x2c; virtual-method int getTexture3(LevelSource *level, int x, int y, int z, int face) = 0x30; virtual-method AABB *getAABB(Level *level, int x, int y, int z) = 0x34; virtual-method bool isSolidRender() = 0x40; +virtual-method bool mayPlace(Level *level, int x, int y, int z, uchar face) = 0x4c; +virtual-method bool mayPlace2(Level *level, int x, int y, int z) = 0x50; virtual-method void tick(Level *level, int x, int y, int z) = 0x58; virtual-method void neighborChanged(Level *level, int x, int y, int z, int neighborId) = 0x64; virtual-method void onPlace(Level *level, int x, int y, int z) = 0x68; virtual-method void onRemove(Level *level, int x, int y, int z) = 0x6c; +// Resource is the dropped item virtual-method int getResource(int data, Random *random) = 0x70; virtual-method int getResourceCount(Random *random) = 0x74; +// Returns 1 (default, not transparent), 2 (transparent when the texture is, like bushes), or 3 (semi-transparent, like water) virtual-method int getRenderLayer() = 0x94; virtual-method int use(Level *level, int x, int y, int z, Player *player) = 0x98; virtual-method void setPlacedBy(Level *level, int x, int y, int z, Mob *placer) = 0xa8; virtual-method void handleEntityInside(Level *level, int x, int y, int z, Entity *entity, Vec3 *speed) = 0xb4; +// Note that this may be ignored depending on the value of getRenderShape virtual-method int getColor(LevelSource *level_source, int x, int y, int z) = 0xb8; +// This doesn't mean that it *is* producing a signal, rather that it might be +// Called by trapdoors, doors, and tnt. Never overridden (always returns false) +virtual-method bool isSignalSource() = 0xbc; +// Doesn't seem to be used, but it's hard to tell with virtual methods +// Yes, this IS a bool and not a char. +virtual-method bool getSignal(LevelSource *level, int x, int y, int z) = 0xc0; +// Called at the end of Level_getSignal +virtual-method bool getSignal2(LevelSource *level, int x, int y, int z, int direction) = 0xc4; +// Called by Level_hasDirectSignal +virtual-method bool getDirectSignal(Level *level, int x, int y, int z, int direction) = 0xc8; virtual-method void entityInside(Level *level, int x, int y, int z, Entity *entity) = 0xcc; virtual-method std::string getDescriptionId() = 0xdc; virtual-method Tile *setDescriptionId(std::string *description_id) = 0xe0; @@ -46,6 +61,8 @@ property float z1 = 0x14; property float x2 = 0x18; property float y2 = 0x1c; property float z2 = 0x20; +property float destroyTime = 0x34; +property float explodeable = 0x38; property int category = 0x3c; property AABB aabb = 0x40; @@ -55,6 +72,8 @@ static-property-array float lightEmission = 0x181214; static-property-array bool isEntityTile = 0x181f20; // Tiles +static-property Tile *grass = 0x181b14; +static-property Tile *leaves = 0x18120c; static-property Tile *chest = 0x181d60; static-property Tile *water = 0x181b3c; static-property Tile *lava = 0x181cc8; @@ -74,11 +93,10 @@ static-property Tile *stoneSlab = 0x181b44; static-property Tile *fire = 0x181de0; // "Carried" Tiles -static-property Tile *leaves = 0x18120c; static-property Tile *leaves_carried = 0x181dd8; -static-property Tile *grass = 0x181b14; static-property Tile *grass_carried = 0x181dd4; // Sounds static-property Tile_SoundType SOUND_STONE = 0x181c80; static-property Tile_SoundType SOUND_WOOD = 0x181cb4; +static-property Tile_SoundType SOUND_GRASS = 0x181c94; -- 2.45.1 From a6ad1994de805169b10fe9cae5ee797c1b7f4849 Mon Sep 17 00:00:00 2001 From: Bigjango13 Date: Mon, 18 Mar 2024 19:58:38 -0400 Subject: [PATCH 5/6] Remove left over check --- mods/src/chat/ui.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/mods/src/chat/ui.cpp b/mods/src/chat/ui.cpp index 50cd2ef..692728f 100644 --- a/mods/src/chat/ui.cpp +++ b/mods/src/chat/ui.cpp @@ -100,23 +100,17 @@ CUSTOM_VTABLE(chat_screen, Screen) { // Up local_history.at(self->history_pos) = self->chat->getText(); // Change - int old_pos = self->history_pos; self->history_pos -= 1; if (self->history_pos < 0) self->history_pos = local_history.size() - 1; - if (old_pos != self->history_pos) { - self->chat->setText(local_history.at(self->history_pos)); - } + self->chat->setText(local_history.at(self->history_pos)); return; } else if (key == 0x28) { // Down local_history.at(self->history_pos) = self->chat->getText(); // Change - int old_pos = self->history_pos; self->history_pos += 1; if (self->history_pos > int(local_history.size()) - 1) self->history_pos = 0; - if (old_pos != self->history_pos) { - self->chat->setText(local_history.at(self->history_pos)); - } + self->chat->setText(local_history.at(self->history_pos)); return; } } -- 2.45.1 From 76a66a0ba566dfcf74a9b56f25f2c36ed76b7f8a Mon Sep 17 00:00:00 2001 From: Bigjango13 Date: Mon, 18 Mar 2024 21:02:01 -0400 Subject: [PATCH 6/6] Sneak in Level_setTileEntity --- symbols/src/level/Level.def | 1 + 1 file changed, 1 insertion(+) diff --git a/symbols/src/level/Level.def b/symbols/src/level/Level.def index 03f8ebd..797380f 100644 --- a/symbols/src/level/Level.def +++ b/symbols/src/level/Level.def @@ -26,6 +26,7 @@ method int getEntitiesOfType(int type_id, AABB *aabb, std::vector *buff method int getEntitiesOfClass(int base_type, AABB *aabb, std::vector *buff) = 0xa6240; // This will implicitly make the tile entity if the tile at x, y, z doesn't have one and is an EntityTile method TileEntity *getTileEntity(int x, int y, int z) = 0xa55d4; +method void setTileEntity(int x, int y, int z, TileEntity *tileEntity) = 0xa7b58; method void removeTileEntity(int x, int y, int z) = 0xa7aac; method void animateTick(int x, int y, int z) = 0xa5920; // Called by trapdoors, doors, and tnt -- 2.45.1