diff --git a/mods/src/api/api.cpp b/mods/src/api/api.cpp index 20144dd3..b383de63 100644 --- a/mods/src/api/api.cpp +++ b/mods/src/api/api.cpp @@ -189,7 +189,7 @@ static const std::string player_namespace = "player."; (void) 0 #define next_int(out) next_number(out, int, std::stoi) #define next_float(out) next_number(out, float, std::stof) -std::string CommandServer_parse_injection(CommandServer_parse_t old, CommandServer *server, ConnectedClient &client, const std::string &command) { +static std::string CommandServer_parse_injection(CommandServer_parse_t original, CommandServer *server, ConnectedClient &client, const std::string &command) { // Parse Command size_t arg_start = command.find('('); if (arg_start == std::string::npos) { @@ -515,7 +515,7 @@ sign->lines[i] = api_get_input(line_##i); \ } else { // Call Original Method api_suppress_chat_events = client.sock >= 0; // Suppress If Real API Client - std::string ret = old(server, client, command); + std::string ret = original(server, client, command); api_suppress_chat_events = false; return ret; } diff --git a/mods/src/api/compat.cpp b/mods/src/api/compat.cpp index acc59e4a..a3b0d44a 100644 --- a/mods/src/api/compat.cpp +++ b/mods/src/api/compat.cpp @@ -90,6 +90,7 @@ void api_convert_to_outside_entity_type(int &type) { for (const std::pair &pair : modern_entity_id_mapping) { if (static_cast(pair.second) == type) { type = pair.first; + break; } } } diff --git a/mods/src/misc/api.cpp b/mods/src/misc/api.cpp index 10633a92..ef4b410b 100644 --- a/mods/src/misc/api.cpp +++ b/mods/src/misc/api.cpp @@ -206,10 +206,32 @@ std::map> &misc_get_entity_type_ // Spawn Entities Entity *misc_make_entity_from_id(Level *level, const int id) { - if (id < 0x40) { + if (id < static_cast(EntityType::DROPPED_ITEM)) { + // Spwn Mob return (Entity *) MobFactory::CreateMob(id, level); } else { - return EntityFactory::CreateEntity(id, level); + // Spawn Entity + Entity *entity = EntityFactory::CreateEntity(id, level); + switch (id) { + case static_cast(EntityType::PAINTING): { + // Fix Crash + ((Painting *) entity)->motive = Motive::DefaultImage; + break; + } + case static_cast(EntityType::FALLING_SAND): { + // Sensible Default + FallingTile *sand = (FallingTile *) entity; + sand->tile_id = Tile::sand->id; + sand->time = 1; + break; + } + case static_cast(EntityType::DROPPED_ITEM): { + // Sensible Default + ((ItemEntity *) entity)->item.constructor_item(Item::sword_iron); + break; + } + } + return entity; } } diff --git a/symbols/CMakeLists.txt b/symbols/CMakeLists.txt index ecdab66a..7f63293e 100644 --- a/symbols/CMakeLists.txt +++ b/symbols/CMakeLists.txt @@ -71,9 +71,13 @@ set(SRC src/entity/ItemEntity.def src/entity/Arrow.def src/entity/ArrowRenderer.def - src/entity/PaintingRenderer.def src/entity/Throwable.def src/entity/Particle.def + src/entity/painting/Painting.def + src/entity/painting/PaintingRenderer.def + src/entity/painting/HangingEntity.def + src/entity/painting/Motive.def + src/entity/FallingTile.def src/level/container/FillingContainer.def src/level/container/Container.def src/level/container/ContainerMenu.def diff --git a/symbols/src/entity/FallingTile.def b/symbols/src/entity/FallingTile.def new file mode 100644 index 00000000..37248ddc --- /dev/null +++ b/symbols/src/entity/FallingTile.def @@ -0,0 +1,7 @@ +extends Entity; + +vtable 0x10c460; + +property int tile_id = 0xd0; +property int data = 0xd4; +property int time = 0xd8; \ No newline at end of file diff --git a/symbols/src/entity/painting/HangingEntity.def b/symbols/src/entity/painting/HangingEntity.def new file mode 100644 index 00000000..d280437c --- /dev/null +++ b/symbols/src/entity/painting/HangingEntity.def @@ -0,0 +1,3 @@ +extends Entity; + +vtable 0x10aba8; \ No newline at end of file diff --git a/symbols/src/entity/painting/Motive.def b/symbols/src/entity/painting/Motive.def new file mode 100644 index 00000000..0f1c1fff --- /dev/null +++ b/symbols/src/entity/painting/Motive.def @@ -0,0 +1 @@ +static-property Motive *DefaultImage = 0x135dc0; \ No newline at end of file diff --git a/symbols/src/entity/painting/Painting.def b/symbols/src/entity/painting/Painting.def new file mode 100644 index 00000000..be0aa4a1 --- /dev/null +++ b/symbols/src/entity/painting/Painting.def @@ -0,0 +1,5 @@ +extends HangingEntity; + +vtable 0x10b0b0; + +property Motive *motive = 0xe4; \ No newline at end of file diff --git a/symbols/src/entity/PaintingRenderer.def b/symbols/src/entity/painting/PaintingRenderer.def similarity index 100% rename from symbols/src/entity/PaintingRenderer.def rename to symbols/src/entity/painting/PaintingRenderer.def diff --git a/symbols/src/tile/Tile.def b/symbols/src/tile/Tile.def index 34fbd0be..d6bea285 100644 --- a/symbols/src/tile/Tile.def +++ b/symbols/src/tile/Tile.def @@ -97,6 +97,7 @@ static-property Tile *bedrock = 0x181cc4; static-property Tile *tallgrass = 0x181d0c; static-property Tile *stoneSlab = 0x181b44; static-property Tile *fire = 0x181de0; +static-property Tile *sand = 0x181b20; // "Carried" Tiles static-property Tile *leaves_carried = 0x181dd8;