@@ -173,27 +173,44 @@ public static <I> TerminalCraftingPlanFlatStatic<I> deserialize(ValueInput value
173173
174174 public static class Entry implements ITerminalCraftingPlanFlat .IEntry {
175175
176- private final IPrototypedIngredient <?, ?> instance ;
176+ private final List < IPrototypedIngredient <?, ?>> instances ;
177177 private long quantityToCraft ;
178178 private long quantityCrafting ;
179179 private long quantityInStorage ;
180180 private long quantityMissing ;
181181
182- public Entry (IPrototypedIngredient <?, ?> instance , long quantityToCraft , long quantityCrafting , long quantityInStorage , long quantityMissing ) {
183- this .instance = instance ;
182+ public Entry (List < IPrototypedIngredient <?, ?>> instances , long quantityToCraft , long quantityCrafting , long quantityInStorage , long quantityMissing ) {
183+ this .instances = instances ;
184184 this .quantityToCraft = quantityToCraft ;
185185 this .quantityCrafting = quantityCrafting ;
186186 this .quantityInStorage = quantityInStorage ;
187187 this .quantityMissing = quantityMissing ;
188188 }
189189
190+ public Entry (List <IPrototypedIngredient <?, ?>> instances ) {
191+ this (instances , 0 , 0 , 0 , 0 );
192+ }
193+
194+ /**
195+ * @deprecated Use {@link #Entry(List)} instead. TODO: rm in next major
196+ */
197+ @ Deprecated
190198 public Entry (IPrototypedIngredient <?, ?> instance ) {
191- this (instance , 0 , 0 , 0 , 0 );
199+ this (List . of ( instance ) , 0 , 0 , 0 , 0 );
192200 }
193201
202+ /**
203+ * @deprecated Use {@link #getInstances()} instead. TODO: rm in next major
204+ */
194205 @ Override
206+ @ Deprecated
195207 public IPrototypedIngredient <?, ?> getInstance () {
196- return instance ;
208+ return instances .get (0 );
209+ }
210+
211+ @ Override
212+ public List <IPrototypedIngredient <?, ?>> getInstances () {
213+ return instances ;
197214 }
198215
199216 @ Override
@@ -233,21 +250,27 @@ public void setQuantityMissing(long quantityMissing) {
233250 }
234251
235252 public static void serialize (ValueOutput valueOutput , Entry entry ) {
236- IPrototypedIngredient .serialize (valueOutput .child ("instance" ), entry .getInstance ());
253+ ValueOutput .ValueOutputList instances = valueOutput .childrenList ("instances" );
254+ for (IPrototypedIngredient <?, ?> instance : entry .getInstances ()) {
255+ IPrototypedIngredient .serialize (instances .addChild (), instance );
256+ }
237257 valueOutput .putLong ("quantityToCraft" , entry .getQuantityToCraft ());
238258 valueOutput .putLong ("quantityCrafting" , entry .getQuantityCrafting ());
239259 valueOutput .putLong ("quantityInStorage" , entry .getQuantityInStorage ());
240260 valueOutput .putLong ("quantityMissing" , entry .getQuantityMissing ());
241261 }
242262
243263 public static TerminalCraftingPlanFlatStatic .Entry deserialize (ValueInput valueInput ) {
244- IPrototypedIngredient <?, ?> instance = IPrototypedIngredient .deserialize (valueInput .child ("instance" ).orElseThrow ());
264+ List <IPrototypedIngredient <?, ?>> instances = Lists .newArrayList ();
265+ for (ValueInput instance : valueInput .childrenList ("instances" ).orElseThrow ()) {
266+ instances .add (IPrototypedIngredient .deserialize (instance ));
267+ }
245268 long quantityToCraft = valueInput .getLong ("quantityToCraft" ).orElseThrow ();
246269 long quantityCrafting = valueInput .getLong ("quantityCrafting" ).orElseThrow ();
247270 long quantityInStorage = valueInput .getLong ("quantityInStorage" ).orElseThrow ();
248271 long quantityMissing = valueInput .getLong ("quantityMissing" ).orElseThrow ();
249272
250- return new TerminalCraftingPlanFlatStatic .Entry (instance , quantityToCraft , quantityCrafting , quantityInStorage , quantityMissing );
273+ return new TerminalCraftingPlanFlatStatic .Entry (instances , quantityToCraft , quantityCrafting , quantityInStorage , quantityMissing );
251274 }
252275
253276 }
0 commit comments