@@ -116,6 +116,39 @@ void createListWrapsOnlyNonCompoundElementsWhenMixedWithCompound() {
116116 assertThat (OPS .getStream (list )).hasStreamResultThat ().containsExactly (a , LinIntTag .of (2 )).inOrder ();
117117 }
118118
119+ @ Test
120+ @ NbtOpsBehavior
121+ void createListWrapsWrapperShapedCompoundElements () {
122+ LinCompoundTag wrapperShaped = wrap (LinIntTag .of (1 ));
123+ LinCompoundTag other = LinCompoundTag .builder ().putInt ("a" , 1 ).build ();
124+ LinTag <?> list = OPS .createList (Stream .of (wrapperShaped , other ));
125+ assertThat (list )
126+ .isEqualTo (LinListTag .of (LinTagType .compoundTag (), List .of (wrap (wrapperShaped ), other )));
127+ assertThat (OPS .getStream (list ))
128+ .hasStreamResultThat ().containsExactly (wrapperShaped , other ).inOrder ();
129+ }
130+
131+ @ Test
132+ @ NbtOpsBehavior
133+ void createListWrapsWrapperShapedCompoundElementsAlone () {
134+ LinCompoundTag wrapperShaped = wrap (LinIntTag .of (1 ));
135+ LinTag <?> list = OPS .createList (Stream .of (wrapperShaped ));
136+ assertThat (list )
137+ .isEqualTo (LinListTag .of (LinTagType .compoundTag (), List .of (wrap (wrapperShaped ))));
138+ assertThat (OPS .getStream (list ))
139+ .hasStreamResultThat ().containsExactly (wrapperShaped ).inOrder ();
140+ }
141+
142+ @ Test
143+ @ NbtOpsBehavior
144+ void createListOfOnlyWrapperShapedCompoundsRoundTrips () {
145+ LinCompoundTag a = wrap (LinIntTag .of (1 ));
146+ LinCompoundTag b = wrap (LinStringTag .of ("x" ));
147+ LinTag <?> list = OPS .createList (Stream .of (a , b ));
148+ assertThat (list ).isEqualTo (LinListTag .of (LinTagType .compoundTag (), List .of (wrap (a ), wrap (b ))));
149+ assertThat (OPS .getStream (list )).hasStreamResultThat ().containsExactly (a , b ).inOrder ();
150+ }
151+
119152 @ Test
120153 void mergeToListOntoEndTakesElementType () {
121154 assertThat (OPS .mergeToList (LinEndTag .instance (), LinIntTag .of (1 )))
@@ -157,6 +190,20 @@ void mergeToListGrowsWrappedList() {
157190 )));
158191 }
159192
193+ @ Test
194+ @ NbtOpsBehavior
195+ void mergeToListWrapsWrapperShapedCompound () {
196+ LinCompoundTag wrapperShaped = wrap (LinIntTag .of (2 ));
197+ LinTag <?> list = OPS .mergeToList (
198+ LinListTag .of (LinTagType .intTag (), List .of (LinIntTag .of (1 ))), wrapperShaped
199+ ).result ().orElseThrow ();
200+ assertThat (list ).isEqualTo (LinListTag .of (LinTagType .compoundTag (), List .of (
201+ wrap (LinIntTag .of (1 )), wrap (wrapperShaped )
202+ )));
203+ assertThat (OPS .getStream (list ))
204+ .hasStreamResultThat ().containsExactly (LinIntTag .of (1 ), wrapperShaped ).inOrder ();
205+ }
206+
160207 @ Test
161208 void mergeToListAppendsSeveralValues () {
162209 assertThat (OPS .mergeToList (
0 commit comments