diff --git a/include/bedrock/resources/pack_source.h b/include/bedrock/resources/pack_source.h index 317c7381a..99b636cd4 100644 --- a/include/bedrock/resources/pack_source.h +++ b/include/bedrock/resources/pack_source.h @@ -36,14 +36,18 @@ class PackSource { virtual ~PackSource() = 0; virtual void forEachPackConst(ConstPackCallback callback) const = 0; virtual void forEachPack(PackCallback callback) = 0; - [[nodiscard]] virtual PackOrigin getPackOrigin() const; - [[nodiscard]] virtual PackType getPackType() const; + [[nodiscard]] virtual PackOrigin getPackOrigin() const = 0; + [[nodiscard]] virtual PackType getPackType() const = 0; virtual PackSourceReport load(IPackManifestFactory &factory, - Bedrock::NotNullNonOwnerPtr const &a3) = 0; + Bedrock::NotNullNonOwnerPtr const &) = 0; }; class CompositePackSource : public PackSource { public: + void addPackSource(PackSource *pack_source); + void clear(); + std::vector getPackSources(); + private: std::vector pack_sources_; }; diff --git a/include/bedrock/resources/resource_pack_repository.h b/include/bedrock/resources/resource_pack_repository.h index 340cf9494..8b4750958 100644 --- a/include/bedrock/resources/resource_pack_repository.h +++ b/include/bedrock/resources/resource_pack_repository.h @@ -16,4 +16,12 @@ #include "bedrock/resources/resource_pack_repository_interface.h" -class ResourcePackRepository : public IResourcePackRepository {}; +class ResourcePackRepository : public IResourcePackRepository { +public: +private: + ENDSTONE_HOOK void _initializePackSource(); // NOLINT + + Bedrock::NotNullNonOwnerPtr file_path_manager_; // +24 + std::vector> all_resource_packs_; // +40 + std::unique_ptr pack_source_; // +64 +}; diff --git a/python/src/endstone/_internal/symbols.toml b/python/src/endstone/_internal/symbols.toml index 7cbc2c8f9..8732ce9b7 100644 --- a/python/src/endstone/_internal/symbols.toml +++ b/python/src/endstone/_internal/symbols.toml @@ -1,4 +1,4 @@ -timestamp = 1727987716 +timestamp = 1728933927 version = "1.21.30" [windows] @@ -70,6 +70,8 @@ version = "1.21.30" "?ToString@SystemAddress@RakNet@@QEBAX_NPEADD@Z" = 37138000 # RakPeerHelper "?peerStartup@RakPeerHelper@@QEAA?AW4StartupResult@RakNet@@PEAVRakPeerInterface@3@AEBUConnectionDefinition@@W4PeerPurpose@1@@Z" = 8265632 +# ResourcePackRepository +"?_initializePackSource@ResourcePackRepository@@AEAAXXZ" = 9253008 # SayCommand "?_sendMessage@SayCommand@@CAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$optional@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@3@0AEBUCommandOriginIdentity@@AEAVLevel@@@Z" = 23116144 # Scoreboard @@ -173,6 +175,8 @@ version = "1.21.30" "_ZNK6RakNet13SystemAddress8ToStringEbPcc" = 134586416 # RakPeerHelper "_ZN13RakPeerHelper11peerStartupEPN6RakNet16RakPeerInterfaceERK20ConnectionDefinitionNS_11PeerPurposeE" = 78459312 +# ResourcePackRepository +"_ZN22ResourcePackRepository21_initializePackSourceEv" = 80958128 # SayCommand "_ZN10SayCommand12_sendMessageERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_8optionalIS6_EES8_RK21CommandOriginIdentityR5Level" = 90709328 # Scoreboard @@ -205,4 +209,4 @@ version = "1.21.30" "_ZNK15StartGamePacket5writeER12BinaryStream" = 79691312 # TeleportCommand "_ZN15TeleportCommand11applyTargetER5Actor14TeleportTargetb" = 90108320 -"_ZN15TeleportCommand13computeTargetER5Actor4Vec3PS2_11AutomaticIDI9DimensioniERKNSt3__18optionalIN20RotationCommandUtils12RotationDataEEEi" = 90108704 \ No newline at end of file +"_ZN15TeleportCommand13computeTargetER5Actor4Vec3PS2_11AutomaticIDI9DimensioniERKNSt3__18optionalIN20RotationCommandUtils12RotationDataEEEi" = 90108704 diff --git a/src/endstone_runtime/bedrock/resources/pack_source.cpp b/src/endstone_runtime/bedrock/resources/pack_source.cpp new file mode 100644 index 000000000..34d25329f --- /dev/null +++ b/src/endstone_runtime/bedrock/resources/pack_source.cpp @@ -0,0 +1,30 @@ +// Copyright (c) 2024, The Endstone Project. (https://endstone.dev) All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "bedrock/resources/pack_source.h" + +void CompositePackSource::addPackSource(PackSource *pack_source) +{ + pack_sources_.emplace_back(pack_source); +} + +void CompositePackSource::clear() +{ + pack_sources_.clear(); +} + +std::vector CompositePackSource::getPackSources() +{ + return pack_sources_; +} diff --git a/src/endstone_runtime/bedrock/resources/resource_pack_repository.cpp b/src/endstone_runtime/bedrock/resources/resource_pack_repository.cpp index ca951334f..3aac4433a 100644 --- a/src/endstone_runtime/bedrock/resources/resource_pack_repository.cpp +++ b/src/endstone_runtime/bedrock/resources/resource_pack_repository.cpp @@ -13,3 +13,10 @@ // limitations under the License. #include "bedrock/resources/resource_pack_repository.h" + +#include "endstone/detail/hook.h" + +void ResourcePackRepository::_initializePackSource() +{ + ENDSTONE_HOOK_CALL_ORIGINAL(&ResourcePackRepository::_initializePackSource, this); +}