1313import lombok .val ;
1414import net .minecraft .nbt .NBTBase ;
1515import net .minecraft .nbt .NBTTagCompound ;
16+ import net .minecraftforge .common .util .Constants ;
1617import net .minecraftforge .fml .common .network .simpleimpl .IMessage ;
1718import net .minecraftforge .fml .common .network .simpleimpl .MessageContext ;
1819import org .spongepowered .asm .mixin .Unique ;
@@ -62,17 +63,17 @@ public IMessage onMessage(RCActionButton message, MessageContext ctx) {
6263 && pattern .hasTagCompound ()
6364 && !(pNbt = pattern .getTagCompound ()).getBoolean ("crafting" )
6465 ) {
65- val in = pNbt .getTagList ("in" , 10 );
66+ val in = pNbt .getTagList ("in" , Constants . NBT . TAG_COMPOUND );
6667 boolean success = true ;
6768 List <NBTBase > list = new ObjectArrayList <>(in .tagList );
68- list .addAll (pNbt .getTagList ("out" , 10 ).tagList );
69+ list .addAll (pNbt .getTagList ("out" , Constants . NBT . TAG_COMPOUND ).tagList );
6970 if (pNbt .hasKey ("Inputs" )) {
70- list .addAll (pNbt .getTagList ("Inputs" , 10 ).tagList );
71- list .addAll (pNbt .getTagList ("Outputs" , 10 ).tagList );
71+ list .addAll (pNbt .getTagList ("Inputs" , Constants . NBT . TAG_COMPOUND ).tagList );
72+ list .addAll (pNbt .getTagList ("Outputs" , Constants . NBT . TAG_COMPOUND ).tagList );
7273 }
7374 for (NBTBase item : list ) {
7475 if (!(item instanceof NBTTagCompound nbt ) || !nbt .hasKey ("Count" )) continue ;
75- int oldSize = nbt .getInteger ("Count" );
76+ int oldSize = nbt .hasKey ( "stackSize" ) ? nbt . getInteger ( "stackSize" ) : nbt . getInteger ("Count" );
7677 if (!r$correctQuantity (oldSize , action )) {
7778 success = false ;
7879 break ;
@@ -89,6 +90,8 @@ public IMessage onMessage(RCActionButton message, MessageContext ctx) {
8990 if (success )
9091 nbt .setInteger ("Cnt" , r$quantityProcessing (oldSize , action ));
9192 }
93+ if (newSize > 127 ) nbt .setInteger ("stackSize" , newSize );
94+ else nbt .removeTag ("stackSize" );
9295 }
9396 }
9497 if (success ) {
0 commit comments