From 9b59eb420e62eca718ced8f727d31b829527265d Mon Sep 17 00:00:00 2001 From: WillowSauceR Date: Fri, 28 Jul 2023 12:45:13 +0800 Subject: [PATCH] feat: adapt to 1.20.13 --- include/mediaplayer/mc/actor.h | 2 +- src/mc/actor.c | 4 ++-- src/mc/network.c | 2 +- src/plugin.c | 11 +---------- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/include/mediaplayer/mc/actor.h b/include/mediaplayer/mc/actor.h index 37b54f3..4179599 100644 --- a/include/mediaplayer/mc/actor.h +++ b/include/mediaplayer/mc/actor.h @@ -9,4 +9,4 @@ struct vec3 *actor_get_pos(struct actor *actor); float calc_attack_damage(struct actor *attacker, struct actor *casualty); const char *get_name_tag(struct actor *actor); unsigned get_entity_type_id(struct actor *actor); -uintptr_t get_unique_id(struct actor *actor); +uintptr_t get_or_create_unique_id(struct actor *actor); diff --git a/src/mc/actor.c b/src/mc/actor.c index a5a0a98..4c0e23b 100644 --- a/src/mc/actor.c +++ b/src/mc/actor.c @@ -31,9 +31,9 @@ unsigned get_entity_type_id(struct actor *actor) actor); } -uintptr_t get_unique_id(struct actor *actor) +uintptr_t get_or_create_unique_id(struct actor *actor) { - return TLCALL("?getUniqueID@Actor@@QEBAAEBUActorUniqueID@@XZ", + return TLCALL("?getOrCreateUniqueID@Actor@@QEBAAEBUActorUniqueID@@XZ", uintptr_t (*)(struct actor *actor), actor); } diff --git a/src/mc/network.c b/src/mc/network.c index 84ed72e..d892fc6 100644 --- a/src/mc/network.c +++ b/src/mc/network.c @@ -60,7 +60,7 @@ void send_boss_event_packet(struct player *player, const char *name, float per, enum boss_bar_event_type type) { uintptr_t pkt = create_packet(74); - uintptr_t unique_id = DEREFERENCE(uintptr_t, get_unique_id((struct actor *)player), 0); + uintptr_t unique_id = DEREFERENCE(uintptr_t, get_or_create_unique_id((struct actor *)player), 0); struct string *name_cpp_str = std_string_string(name); DEREFERENCE(uintptr_t, pkt, 56) = unique_id; DEREFERENCE(int, pkt, 72) = type; diff --git a/src/plugin.c b/src/plugin.c index 55ce97e..4aae62b 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -11,16 +11,7 @@ TLHOOK(on_initialize_logging, void, // Constructor for Level TLHOOK(level_construct, struct level *, - "??0Level@@QEAA@AEBV?$not_null@V?$NonOwnerPointer@VSoundPlayerInterface@@@Bedrock@@@" - "gsl@@V?$unique_ptr@VLevelStorage@@U?$default_delete@VLevelStorage@@@std@@@std@@" - "V?$unique_ptr@VLevelLooseFileStorage@@U?$default_delete@VLevelLooseFileStorage@@@" - "std@@@4@AEAVIMinecraftEventing@@_NW4SubClientId@@AEAVScheduler@@V?$not_null@" - "V?$NonOwnerPointer@VStructureManager@@@Bedrock@@@2@AEAVResourcePackManager@@" - "AEBV?$not_null@V?$NonOwnerPointer@VIEntityRegistryOwner@@@Bedrock@@@2@V?$WeakRefT@" - "UEntityRefTraits@@@@V?$unique_ptr@VBlockComponentFactory@@U?$default_delete@" - "VBlockComponentFactory@@@std@@@4@V?$unique_ptr@VBlockDefinitionGroup@@" - "U?$default_delete@VBlockDefinitionGroup@@@std@@@4@VItemRegistryRef@@V?$weak_ptr@" - "VBlockTypeRegistry@@@4@44AEBUNetworkPermissions@@V?$optional@VDimensionDefinitionGroup@@@4@@Z", + "??0Level@@QEAA@AEBV?$not_null@V?$NonOwnerPointer@VSoundPlayerInterface@@@Bedrock@@@gsl@@V?$OwnerPtrT@U?$SharePtrRefTraits@VLevelStorage@@@@@@AEAVIMinecraftEventing@@_NW4SubClientId@@AEAVScheduler@@V?$not_null@V?$NonOwnerPointer@VStructureManager@@@Bedrock@@@2@AEAVResourcePackManager@@AEBV?$not_null@V?$NonOwnerPointer@VIEntityRegistryOwner@@@Bedrock@@@2@V?$WeakRefT@UEntityRefTraits@@@@V?$unique_ptr@VBlockComponentFactory@@U?$default_delete@VBlockComponentFactory@@@std@@@std@@V?$unique_ptr@VBlockDefinitionGroup@@U?$default_delete@VBlockDefinitionGroup@@@std@@@std@@VItemRegistryRef@@V?$weak_ptr@VBlockTypeRegistry@@@std@@33AEBUNetworkPermissions@@V?$optional@VDimensionDefinitionGroup@@@std@@@Z", struct level *level, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9, uintptr_t a10, uintptr_t a11, uintptr_t a12, uintptr_t a13, uintptr_t a14, uintptr_t a15, uintptr_t a16, uintptr_t a17,