@@ -549,12 +549,20 @@ func (r *ResourcePackHandler) OnResourcePackStack(pk *packet.ResourcePackStack)
549549 pk .BehaviourPacks = append (pk .BehaviourPacks [:i ], pk .BehaviourPacks [i + 1 :]... )
550550 }
551551 }
552- if ! r .hasPack (pack .UUID , pack .Version , false ) {
552+ id , err := uuid .Parse (pack .UUID )
553+ if err != nil {
554+ continue
555+ }
556+ if ! r .hasPack (id , pack .Version , false ) {
553557 return fmt .Errorf ("texture pack {uuid=%v, version=%v} not downloaded" , pack .UUID , pack .Version )
554558 }
555559 }
556560 for _ , pack := range pk .BehaviourPacks {
557- if ! r .hasPack (pack .UUID , pack .Version , true ) {
561+ id , err := uuid .Parse (pack .UUID )
562+ if err != nil {
563+ continue
564+ }
565+ if ! r .hasPack (id , pack .Version , true ) {
558566 return fmt .Errorf ("behaviour pack {uuid=%v, version=%v} not downloaded" , pack .UUID , pack .Version )
559567 }
560568 }
@@ -859,17 +867,24 @@ var exemptedPacks = map[string]bool{
859867 "0fba4063-dba1-4281-9b89-ff9390653530_1.0.0" : true ,
860868}
861869
862- func (r * ResourcePackHandler ) hasPack (uuid string , version string , hasBehaviours bool ) bool {
863- if exemptedPacks [uuid + "_" + version ] {
870+ func (r * ResourcePackHandler ) hasPack (id uuid.UUID , version string , hasBehaviours bool ) bool {
871+ search := id .String () + "_" + version
872+ if exemptedPacks [search ] {
864873 // The server may send this resource pack on the stack without sending it in the info, as the client
865874 // always has it downloaded.
866875 return true
867876 }
868-
869- if uuid == "" {
877+ if id == uuid .Max {
870878 return true
871879 }
872880
873- search := uuid + "_" + version
881+ // not sent in resourcepacks info, just ignore it from the stack
882+ if r .remotePacksInfo != nil {
883+ if ! slices .ContainsFunc (r .remotePacksInfo .TexturePacks , func (pack protocol.TexturePackInfo ) bool {
884+ return pack .UUID == id && pack .Version == version
885+ }) {
886+ return true
887+ }
888+ }
874889 return slices .Contains (r .finishedPacks , search )
875890}
0 commit comments